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

    <!-- ============================================================ -->
    <!--                       Rubric Views                           -->
    <!-- ============================================================ -->

    <record id="view_rubric_form" model="ir.ui.view">
        <field name="name">encoach.rubric.form</field>
        <field name="model">encoach.rubric</field>
        <field name="arch" type="xml">
            <form string="Rubric">
                <sheet>
                    <div class="oe_title">
                        <h1>
                            <field name="name" placeholder="Rubric Name"/>
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="skill"/>
                            <field name="exam_type"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Criteria" name="criteria">
                            <field name="criteria" widget="text" placeholder="Define rubric criteria (JSON or structured text)..."/>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_rubric_list" model="ir.ui.view">
        <field name="name">encoach.rubric.list</field>
        <field name="model">encoach.rubric</field>
        <field name="arch" type="xml">
            <list string="Rubrics">
                <field name="name"/>
                <field name="skill"/>
                <field name="exam_type"/>
            </list>
        </field>
    </record>

    <record id="view_rubric_search" model="ir.ui.view">
        <field name="name">encoach.rubric.search</field>
        <field name="model">encoach.rubric</field>
        <field name="arch" type="xml">
            <search string="Search Rubrics">
                <field name="name"/>
                <separator/>
                <filter string="Writing" name="filter_writing" domain="[('skill', '=', 'writing')]"/>
                <filter string="Speaking" name="filter_speaking" domain="[('skill', '=', 'speaking')]"/>
                <separator/>
                <filter string="Academic" name="filter_academic" domain="[('exam_type', '=', 'academic')]"/>
                <filter string="General Training" name="filter_general" domain="[('exam_type', '=', 'general_training')]"/>
                <filter string="Skill" name="group_skill" context="{'group_by': 'skill'}"/>
                <filter string="Exam Type" name="group_exam_type" context="{'group_by': 'exam_type'}"/>
            </search>
        </field>
    </record>

    <record id="action_rubric" model="ir.actions.act_window">
        <field name="name">Rubrics</field>
        <field name="res_model">encoach.rubric</field>
        <field name="view_mode">list,form</field>
        <field name="search_view_id" ref="view_rubric_search"/>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Create your first scoring rubric
            </p>
        </field>
    </record>

</odoo>
