from odoo import models, fields


class EncoachQuestion(models.Model):
    _name = 'encoach.question'
    _description = 'Question Item'

    skill = fields.Selection([
        ('listening', 'Listening'),
        ('reading', 'Reading'),
        ('writing', 'Writing'),
        ('speaking', 'Speaking'),
        ('grammar', 'Grammar'),
        ('vocabulary', 'Vocabulary'),
        ('math', 'Mathematics'),
        ('it', 'Information Technology'),
    ], required=True)
    source_type = fields.Selection([
        ('passage', 'Passage'),
        ('audio', 'Audio'),
        ('writing_prompt', 'Writing Prompt'),
        ('speaking_card', 'Speaking Card'),
    ])
    source_id = fields.Integer()
    question_type = fields.Selection([
        ('mcq', 'MCQ'),
        ('mcq_multi', 'MCQ Multiple'),
        ('tfng', 'True/False/Not Given'),
        ('ynng', 'Yes/No/Not Given'),
        ('gap_fill', 'Gap Fill'),
        ('short_answer', 'Short Answer'),
        ('form_completion', 'Form Completion'),
        ('note_completion', 'Note Completion'),
        ('map_labelling', 'Map Labelling'),
        ('matching', 'Matching'),
        ('summary_completion', 'Summary Completion'),
        ('heading_matching', 'Heading Matching'),
        ('matching_features', 'Matching Features'),
        ('numerical', 'Numerical'),
        ('expression', 'Expression'),
        ('code_completion', 'Code Completion'),
        ('code_output', 'Code Output'),
        ('sql_query', 'SQL Query'),
        ('matrix', 'Matrix'),
        ('graph', 'Graph'),
    ], required=True)
    stem = fields.Text(required=True)
    options = fields.Text()
    correct_answer = fields.Text()
    marks = fields.Float(default=1.0)
    difficulty = fields.Selection([
        ('easy', 'Easy'),
        ('medium', 'Medium'),
        ('hard', 'Hard'),
    ], required=True)
    status = fields.Selection([
        ('draft', 'Draft'),
        ('active', 'Active'),
        ('retired', 'Retired'),
        ('flagged', 'Flagged'),
    ], default='draft')
    irt_a = fields.Float(default=1.0)
    irt_b = fields.Float(default=0.0)
    irt_c = fields.Float(default=0.25)
    ai_generated = fields.Boolean(default=False)
    ielts_certified = fields.Boolean(default=False)
    format_validated = fields.Boolean(default=False)
    subject_id = fields.Many2one('encoach.subject', ondelete='set null')
    topic_id = fields.Many2one('encoach.topic', ondelete='set null')
