import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
} from 'typeorm';

@Entity('reports_history')
export class ReportsHistory {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    type: 'enum',
    enum: ['job', 'company', 'user', 'finance'],
  })
  type: 'job' | 'company' | 'user' | 'finance';

  @Column({ type: 'varchar', length: 255 })
  file_path: string;

  @Column({ type: 'int', nullable: true })
  created_by: number;

  @Column({ type: 'int', nullable: true })
  franchise_id: number;

  @CreateDateColumn({ type: 'timestamp' })
  created_at: Date;

  @Column({ type: 'date', nullable: true })
  date_range_start: Date;

  @Column({ type: 'date', nullable: true })
  date_range_end: Date;

  @Column({
    type: 'enum',
    enum: ['generated', 'emailed'],
    default: 'generated',
  })
  status: 'generated' | 'emailed';
}
