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

@Entity('job_packages')
@Index('idx_boost', ['boost_level'])
@Index('idx_visibility', ['visibility'])
@Index('idx_active', ['is_active'])
export class JobPackage {
  @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true })
  id: number;

  @Column({ length: 50, unique: true })
  code: string;

  @Column({ length: 100 })
  name: string;

  @Column({ type: 'decimal', precision: 10, scale: 2 })
  price: number;

  @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true })
  original_price: number;

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

  @Column({ length: 10, default: 'INR' })
  currency: string;

  @Column({ type: 'int', default: 0 })
  job_credits: number;

  @Column({ type: 'int', default: 0 })
  ai_credits: number;

  @Column({ type: 'int', default: 1 })
  boost_level: number;

  @Column({ type: 'enum', enum: ['basic', 'higher', 'maximum'] })
  visibility: 'basic' | 'higher' | 'maximum';

  @Column({ type: 'int' })
  duration_days: number;

  @Column({ type: 'json', nullable: true })
  features: any;

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

  @Column({ default: true })
  is_active: boolean;

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

  @CreateDateColumn()
  created_at: Date;
}
