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

    <!-- Correction Form: AI Advice Button and Field -->
    <record id="view_fusion_clock_correction_form_ai" model="ir.ui.view">
        <field name="name">fusion.clock.correction.form.ai</field>
        <field name="model">fusion.clock.correction</field>
        <field name="inherit_id" ref="fusion_clock.view_fusion_clock_correction_form"/>
        <field name="arch" type="xml">
            <!-- Add AI Advice button in header -->
            <xpath expr="//button[@name='action_reject']" position="after">
                <button name="action_get_ai_advice" type="object"
                        string="Get AI Advice" class="btn-secondary"
                        invisible="state != 'pending'"
                        groups="fusion_clock.group_fusion_clock_manager"
                        icon="fa-magic"/>
            </xpath>

            <!-- Add AI Advice section before chatter -->
            <xpath expr="//chatter" position="before">
                <group string="AI Review Advice" invisible="not x_fclk_ai_advice">
                    <field name="x_fclk_ai_advice" nolabel="1" colspan="2" readonly="1"/>
                </group>
            </xpath>
        </field>
    </record>

</odoo>
