<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <record id="view_cat_session_form" model="ir.ui.view">
        <field name="name">encoach.cat.session.form</field>
        <field name="model">encoach.cat.session</field>
        <field name="arch" type="xml">
            <form string="CAT Session">
                <header>
                    <field name="status" widget="statusbar" statusbar_visible="active,completed"/>
                </header>
                <sheet>
                    <group>
                        <group>
                            <field name="student_id"/>
                            <field name="subject_id"/>
                            <field name="current_section"/>
                        </group>
                        <group>
                            <field name="started_at"/>
                            <field name="completed_at"/>
                            <field name="current_theta"/>
                            <field name="current_sem"/>
                            <field name="questions_answered"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Autosave Data" name="autosave">
                            <field name="autosave_data"/>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_cat_session_list" model="ir.ui.view">
        <field name="name">encoach.cat.session.list</field>
        <field name="model">encoach.cat.session</field>
        <field name="arch" type="xml">
            <list string="CAT Sessions">
                <field name="student_id"/>
                <field name="status" widget="badge" decoration-info="status == 'active'" decoration-success="status == 'completed'" decoration-danger="status == 'abandoned'"/>
                <field name="current_theta"/>
                <field name="current_sem"/>
                <field name="questions_answered"/>
                <field name="started_at"/>
            </list>
        </field>
    </record>

    <record id="view_cat_session_search" model="ir.ui.view">
        <field name="name">encoach.cat.session.search</field>
        <field name="model">encoach.cat.session</field>
        <field name="arch" type="xml">
            <search string="Search CAT Sessions">
                <field name="student_id"/>
                <separator/>
                <filter string="Active" name="active" domain="[('status', '=', 'active')]"/>
                <filter string="Completed" name="completed" domain="[('status', '=', 'completed')]"/>
                <filter string="Abandoned" name="abandoned" domain="[('status', '=', 'abandoned')]"/>
                <separator/>
                <filter string="Student" name="group_student" context="{'group_by': 'student_id'}"/>
            </search>
        </field>
    </record>

    <record id="action_cat_session" model="ir.actions.act_window">
        <field name="name">Placements</field>
        <field name="res_model">encoach.cat.session</field>
        <field name="view_mode">list,form</field>
    </record>

</odoo>
