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

@Entity('cv_downloads')
export class CvDownloadLog {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  recruiter_user_id: number;

  @Column()
  seeker_user_id: number;

  @Column({ nullable: true })
  job_id: number; // Optional: context of download

  @Column({
    type: 'enum',
    enum: ['view', 'download', 'export'],
    default: 'download',
  })
  action_type: string;

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

  @CreateDateColumn()
  created_at: Date;

  @Column({ type: 'varchar', length: 45, nullable: true })
  ip_address: string;

  @Column({ type: 'text', nullable: true })
  user_agent: string;
}
