<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2024-2025 Nexa Systems Inc.
    License OPL-1 (Odoo Proprietary License v1.0)
    Part of the Fusion Claim Assistant product family.
-->
<odoo>
    <!-- Device Import Wizard Form -->
    <record id="view_device_import_wizard_form" model="ir.ui.view">
        <field name="name">fusion.central.device.import.wizard.form</field>
        <field name="model">fusion_claims.device.import.wizard</field>
        <field name="arch" type="xml">
            <form string="Import ADP Device Codes">
                <!-- Draft State: Upload -->
                <group invisible="state == 'done'">
                    <div class="alert alert-info" role="alert">
                        <h5>Import Device Codes from Mobility Manual</h5>
                        <p>Upload a <strong>CSV</strong> file (ADP Mobility Manual format) or a <strong>JSON</strong> file.</p>
                        <p><strong>CSV columns:</strong> Device Type, Manufacturer, Device Description, Device Code, Qty, Approved Price, Serial</p>
                    </div>
                    <group>
                        <field name="file_type" widget="radio" options="{'horizontal': True}"/>
                        <field name="file" filename="filename"/>
                        <field name="filename" invisible="1"/>
                    </group>
                </group>
                
                <!-- Done State: Results -->
                <group invisible="state != 'done'">
                    <div class="alert alert-success" role="alert">
                        <h5><i class="fa fa-check-circle"/> Import Complete!</h5>
                    </div>
                    <group string="Results">
                        <field name="result_created"/>
                        <field name="result_updated"/>
                    </group>
                    <group string="Errors" invisible="not result_errors">
                        <div class="alert alert-warning" role="alert">
                            <field name="result_errors" nolabel="1"/>
                        </div>
                    </group>
                </group>
                
                <field name="state" invisible="1"/>
                
                <footer>
                    <button string="Import" name="action_import" type="object" 
                            class="btn-primary" invisible="state == 'done'"
                            icon="fa-upload"/>
                    <button string="Close" class="btn-secondary" special="cancel"/>
                </footer>
            </form>
        </field>
    </record>

    <!-- Menu Action -->
    <record id="action_device_import_wizard" model="ir.actions.act_window">
        <field name="name">Import Device Codes</field>
        <field name="res_model">fusion_claims.device.import.wizard</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>
</odoo>

