import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
  OneToOne,
  JoinColumn,
} from 'typeorm';
import { MockTestAttempts } from '../../mock_test_attempts/entities/mock_test_attempts.entity';

@Entity('candidate_feedback')
export class CandidateFeedback {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  attempt_id: number;

  @Column('json')
  feedback: any;

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

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

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

  @Column({ type: 'tinyint', width: 1, default: 0 })
  llm_generated: number;

  @Column({ length: 50, default: 'groq' })
  llm_provider: string;

  @CreateDateColumn()
  created_at: Date;

  @UpdateDateColumn()
  updated_at: Date;

  @OneToOne(() => MockTestAttempts, { onDelete: 'CASCADE' })
  @JoinColumn({ name: 'attempt_id' })
  attempt: MockTestAttempts;
}
