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

@Entity('job_invitations')
export class JobInvitation {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  @Index()
  job_post_id: number;

  @Column()
  @Index()
  seeker_id: number;

  @Column()
  @Index()
  recruiter_id: number;

  @Column({
    type: 'enum',
    enum: ['Pending', 'Accepted', 'Declined'],
    default: 'Pending',
  })
  status: string;

  @CreateDateColumn({
    name: 'created_at',
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
  })
  created_at: Date;

  @UpdateDateColumn({
    name: 'updated_at',
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
    onUpdate: 'CURRENT_TIMESTAMP',
  })
  updated_at: Date;
}
