import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  ManyToOne,
  JoinColumn,
  CreateDateColumn,
} from 'typeorm';
import { QuestionBank } from '../../question_bank/entities/question_bank.entity';

@Entity('mcq_options')
export class McqOptions {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  question_id: number;

  @Column('text')
  option_text: string;

  @Column({ type: 'tinyint', default: 0 })
  order_index: number;

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

  @CreateDateColumn()
  created_at: Date;

  @ManyToOne(() => QuestionBank, (question) => question.options)
  @JoinColumn({ name: 'question_id' })
  question: QuestionBank;
}
