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

@Entity('recruiter_cv_usage')
export class Usage {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  recruiter_id: number;

  @Column({
    type: 'enum',
    enum: ['free', 'basic', 'premium', 'enterprise'],
    default: 'free',
  })
  plan_type: string;

  @Column({ default: 100 })
  total_cv_limit: number;

  @Column({ default: 0 })
  used_cv_downloads: number;

  @Column({ default: 100 })
  remaining_cv_downloads: number;

  @Column({ type: 'timestamp', nullable: true })
  last_download_at: Date;

  @Column({ type: 'date' })
  plan_start_date: Date;

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

  @CreateDateColumn()
  created_at: Date;

  @UpdateDateColumn()
  updated_at: Date;
}
