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

    <record id="view_ai_generation_log_form" model="ir.ui.view">
        <field name="name">encoach.ai.generation.log.form</field>
        <field name="model">encoach.ai.generation.log</field>
        <field name="arch" type="xml">
            <form string="AI Generation Log">
                <header>
                    <field name="status" widget="statusbar" statusbar_visible="generating,quality_check,pending_review,approved"/>
                </header>
                <sheet>
                    <group>
                        <group>
                            <field name="student_id"/>
                            <field name="course_type"/>
                            <field name="attempts"/>
                        </group>
                        <group>
                            <field name="final_resource_id"/>
                            <field name="approved_by"/>
                            <field name="created_at"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Brief" name="brief">
                            <field name="brief"/>
                        </page>
                        <page string="Error Log" name="error_log">
                            <field name="error_log"/>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_ai_generation_log_list" model="ir.ui.view">
        <field name="name">encoach.ai.generation.log.list</field>
        <field name="model">encoach.ai.generation.log</field>
        <field name="arch" type="xml">
            <list string="AI Generation Logs">
                <field name="course_type"/>
                <field name="status" widget="badge" decoration-info="status == 'generating'" decoration-warning="status == 'pending_review'" decoration-success="status == 'approved'" decoration-danger="status == 'rejected'"/>
                <field name="attempts"/>
                <field name="student_id"/>
                <field name="created_at"/>
            </list>
        </field>
    </record>

    <record id="view_ai_generation_log_search" model="ir.ui.view">
        <field name="name">encoach.ai.generation.log.search</field>
        <field name="model">encoach.ai.generation.log</field>
        <field name="arch" type="xml">
            <search string="Search AI Generation Logs">
                <field name="student_id"/>
                <separator/>
                <filter string="Generating" name="generating" domain="[('status', '=', 'generating')]"/>
                <filter string="Quality Check" name="quality_check" domain="[('status', '=', 'quality_check')]"/>
                <filter string="Pending Review" name="pending_review" domain="[('status', '=', 'pending_review')]"/>
                <filter string="Approved" name="approved" domain="[('status', '=', 'approved')]"/>
                <filter string="Rejected" name="rejected" domain="[('status', '=', 'rejected')]"/>
                <separator/>
                <filter string="General English" name="general_english" domain="[('course_type', '=', 'general_english')]"/>
                <filter string="IELTS" name="ielts" domain="[('course_type', '=', 'ielts')]"/>
            </search>
        </field>
    </record>

    <record id="action_ai_generation_log" model="ir.actions.act_window">
        <field name="name">AI Generation Logs</field>
        <field name="res_model">encoach.ai.generation.log</field>
        <field name="view_mode">list,form</field>
    </record>

</odoo>
