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

    <!-- Prompt List View -->
    <record id="view_ai_prompt_list" model="ir.ui.view">
        <field name="name">fusion.clock.ai.prompt.list</field>
        <field name="model">fusion.clock.ai.prompt</field>
        <field name="arch" type="xml">
            <list string="AI Prompt Templates" default_order="key">
                <field name="key"/>
                <field name="name"/>
                <field name="feature_category" widget="badge"/>
                <field name="active"/>
            </list>
        </field>
    </record>

    <!-- Prompt Form View -->
    <record id="view_ai_prompt_form" model="ir.ui.view">
        <field name="name">fusion.clock.ai.prompt.form</field>
        <field name="model">fusion.clock.ai.prompt</field>
        <field name="arch" type="xml">
            <form string="AI Prompt Template">
                <sheet>
                    <div class="oe_button_box" name="button_box">
                        <field name="active" widget="boolean_button"
                               options='{"terminology": "archive"}'/>
                    </div>
                    <group>
                        <group>
                            <field name="key"/>
                            <field name="name"/>
                        </group>
                        <group>
                            <field name="feature_category"/>
                        </group>
                    </group>
                    <group string="Description">
                        <field name="description" nolabel="1" colspan="2"
                               placeholder="Explain when this prompt is used and what variables are available..."/>
                    </group>
                    <group string="Prompt Content">
                        <field name="content" nolabel="1" colspan="2"
                               placeholder="Enter the system prompt template..."
                               widget="text"/>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <!-- Prompt Search View -->
    <record id="view_ai_prompt_search" model="ir.ui.view">
        <field name="name">fusion.clock.ai.prompt.search</field>
        <field name="model">fusion.clock.ai.prompt</field>
        <field name="arch" type="xml">
            <search string="Search Prompts">
                <field name="key"/>
                <field name="name"/>
                <filter name="active" string="Active" domain="[('active', '=', True)]"/>
                <filter name="archived" string="Archived" domain="[('active', '=', False)]"/>
                <separator/>
                <filter name="group_category" string="Category"
                        context="{'group_by': 'feature_category'}"/>
            </search>
        </field>
    </record>

    <!-- Prompt Action -->
    <record id="action_ai_prompt" model="ir.actions.act_window">
        <field name="name">Prompt Templates</field>
        <field name="res_model">fusion.clock.ai.prompt</field>
        <field name="view_mode">list,form</field>
        <field name="search_view_id" ref="view_ai_prompt_search"/>
        <field name="context">{'search_default_active': 1}</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                No prompt templates defined
            </p>
            <p>
                Create prompt templates to customize AI behavior for different features.
            </p>
        </field>
    </record>

</odoo>
