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

    <!-- Report Form: AI Narrative Button and Field -->
    <record id="view_fusion_clock_report_form_ai" model="ir.ui.view">
        <field name="name">fusion.clock.report.form.ai</field>
        <field name="model">fusion.clock.report</field>
        <field name="inherit_id" ref="fusion_clock.view_fusion_clock_report_form"/>
        <field name="arch" type="xml">
            <!-- Add AI Narrative button in header -->
            <xpath expr="//button[@name='action_export_csv']" position="after">
                <button name="action_generate_ai_narrative" type="object"
                        string="Generate AI Narrative" class="btn-secondary"
                        invisible="state == 'draft'"
                        icon="fa-magic"/>
            </xpath>

            <!-- Add AI Narrative tab in notebook -->
            <xpath expr="//page[@name='attendances']" position="after">
                <page string="AI Narrative" name="ai_narrative"
                      invisible="not x_fclk_ai_narrative">
                    <field name="x_fclk_ai_narrative" nolabel="1" readonly="1"/>
                </page>
            </xpath>
        </field>
    </record>

</odoo>
