from odoo import models, fields


class EncoachExamTemplate(models.Model):
    _name = 'encoach.exam.template'
    _description = 'Exam Template'

    name = fields.Char(size=200, required=True)
    code = fields.Char(size=50)
    type = fields.Selection([
        ('international', 'International'),
        ('custom', 'Custom'),
    ], required=True)
    editable = fields.Boolean(default=True)
    active = fields.Boolean(default=True)
    subject_id = fields.Many2one('encoach.subject', ondelete='set null')
    entity_id = fields.Many2one('encoach.entity', ondelete='set null')
    teacher_id = fields.Many2one('res.users', ondelete='set null')
    structure = fields.Text()
    total_time_min = fields.Integer()
    pass_threshold = fields.Float()
    results_release_mode = fields.Selection([
        ('auto', 'Auto'),
        ('manual_approval', 'Manual Approval'),
    ], default='auto')
    randomize_questions = fields.Boolean(default=False)
    description = fields.Text()
