import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
import { EntityHelper } from 'src/utils/entity-helper';
import { Team } from 'src/teams/entities/team.entity';
import { RecurringTransactionIntervalEnum } from 'src/recurring-transactions/recurring-transaction-interval.enum';

@Entity()
export class CashboxExportSubscription extends EntityHelper {
  @PrimaryGeneratedColumn()
  id: number;

  @OneToOne(() => Team, { eager: false })
  @JoinColumn()
  team: Team;

  @Column({ type: 'simple-array' })
  recipients: string[];

  @Column()
  interval: RecurringTransactionIntervalEnum;

  @Column({ default: false })
  active: boolean;

  @Column({ nullable: true })
  nextRunDate: string | null;
}
