from odoo import models, fields


class EncoachLesson(models.Model):
    _name = 'encoach.lesson'
    _description = 'Lesson'
    _order = 'start_datetime desc, id desc'

    name = fields.Char(string='Name')
    lesson_topic = fields.Char(string='Topic')
    course_id = fields.Many2one('op.course', string='Course', ondelete='cascade')
    batch_id = fields.Many2one('op.batch', string='Batch', ondelete='set null')
    subject_id = fields.Many2one('op.subject', string='Subject', ondelete='set null')
    session_id = fields.Many2one('op.session', string='Session', ondelete='set null')
    faculty_id = fields.Many2one('op.faculty', string='Faculty', ondelete='set null')
    start_datetime = fields.Datetime(string='Start')
    end_datetime = fields.Datetime(string='End')
    content = fields.Text(string='Content')
    status = fields.Selection([
        ('draft', 'Draft'),
        ('scheduled', 'Scheduled'),
        ('done', 'Done'),
        ('cancelled', 'Cancelled'),
    ], default='draft', string='Status')
