from odoo import models, fields


class EncoachAdaptiveEvent(models.Model):
    _name = 'encoach.adaptive.event'
    _description = 'Adaptive Learning Event'
    _order = 'created_at desc'

    student_id = fields.Many2one('res.users', required=True, ondelete='cascade', index=True)
    course_id = fields.Many2one('op.course', ondelete='set null')
    event_type = fields.Selection([
        ('signal', 'Signal'),
        ('decision', 'Decision'),
    ], required=True)
    signal_name = fields.Char(size=100)
    signal_value = fields.Float()
    decision = fields.Char(size=200)
    context = fields.Text()
    created_at = fields.Datetime(default=fields.Datetime.now)
