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

    <record id="view_encoach_resource_form" model="ir.ui.view">
        <field name="name">encoach.resource.form</field>
        <field name="model">encoach.resource</field>
        <field name="arch" type="xml">
            <form string="Resource">
                <header>
                    <field name="review_status" widget="statusbar" statusbar_visible="pending,approved,rejected"/>
                </header>
                <sheet>
                    <group>
                        <group>
                            <field name="name"/>
                            <field name="type"/>
                            <field name="difficulty"/>
                            <field name="duration_minutes"/>
                            <field name="cefr_level"/>
                        </group>
                        <group>
                            <field name="subject_id"/>
                            <field name="topic_ids" widget="many2many_tags"/>
                            <field name="grammar_topic"/>
                            <field name="vocab_band"/>
                            <field name="ai_generated"/>
                            <field name="approved"/>
                        </group>
                    </group>
                    <group string="Content">
                        <field name="url"/>
                        <field name="file" filename="name"/>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_encoach_resource_list" model="ir.ui.view">
        <field name="name">encoach.resource.list</field>
        <field name="model">encoach.resource</field>
        <field name="arch" type="xml">
            <list string="Resources">
                <field name="name"/>
                <field name="type"/>
                <field name="cefr_level"/>
                <field name="difficulty"/>
                <field name="duration_minutes"/>
                <field name="review_status" widget="badge" decoration-info="review_status == 'pending'" decoration-success="review_status == 'approved'" decoration-danger="review_status == 'rejected'"/>
                <field name="ai_generated"/>
            </list>
        </field>
    </record>

    <record id="view_encoach_resource_search" model="ir.ui.view">
        <field name="name">encoach.resource.search</field>
        <field name="model">encoach.resource</field>
        <field name="arch" type="xml">
            <search string="Search Resources">
                <field name="name"/>
                <filter string="AI Generated" name="ai_generated" domain="[('ai_generated', '=', True)]"/>
                <filter string="Pending Review" name="pending_review" domain="[('review_status', '=', 'pending')]"/>
                <filter string="Approved" name="approved" domain="[('review_status', '=', 'approved')]"/>
                <separator/>
                <filter string="Type" name="group_type" context="{'group_by': 'type'}"/>
                <filter string="CEFR Level" name="group_cefr" context="{'group_by': 'cefr_level'}"/>
                <filter string="Review Status" name="group_review" context="{'group_by': 'review_status'}"/>
            </search>
        </field>
    </record>

    <record id="action_encoach_resource" model="ir.actions.act_window">
        <field name="name">Resources</field>
        <field name="res_model">encoach.resource</field>
        <field name="view_mode">list,form</field>
    </record>

</odoo>
