from odoo import models, fields


class EncoachAiIeltsGenerationLog(models.Model):
    _name = 'encoach.ai.ielts.generation.log'
    _description = 'AI IELTS Generation Log'

    skill = fields.Selection([
        ('listening', 'Listening'),
        ('reading', 'Reading'),
        ('writing', 'Writing'),
        ('speaking', 'Speaking'),
    ], required=True)
    brief = fields.Text()
    format_check_result = fields.Text()
    band_check_result = fields.Text()
    examiner_id = fields.Many2one('res.users', ondelete='set null')
    status = fields.Selection([
        ('generating', 'Generating'),
        ('format_check', 'Format Check'),
        ('examiner_review', 'Examiner Review'),
        ('approved', 'Approved'),
        ('rejected', 'Rejected'),
    ], default='generating', required=True)
    attempts = fields.Integer(default=0)
    created_at = fields.Datetime(default=fields.Datetime.now)
    review_status = fields.Selection([
        ('draft', 'Draft'),
        ('pending_review', 'Pending Review'),
        ('approved', 'Approved'),
        ('rejected', 'Rejected'),
        ('revision_needed', 'Revision Needed'),
    ], default='draft')
    examiner_notes = fields.Text()
    reviewed_at = fields.Datetime()
