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

    <record id="res_config_settings_view_form_fusion_faxes" model="ir.ui.view">
        <field name="name">res.config.settings.view.form.inherit.fusion_faxes</field>
        <field name="model">res.config.settings</field>
        <field name="inherit_id" ref="base.res_config_settings_view_form"/>
        <field name="arch" type="xml">
            <xpath expr="//form" position="inside">
                <app data-string="Fusion Faxes" string="Fusion Faxes" name="fusion_faxes"
                     groups="fusion_faxes.group_fax_manager">

                    <h2>RingCentral Configuration</h2>
                    <div class="row mt-4 o_settings_container">

                        <!-- Enable toggle -->
                        <div class="col-12 col-lg-6 o_setting_box">
                            <div class="o_setting_left_pane">
                                <field name="ff_ringcentral_enabled"/>
                            </div>
                            <div class="o_setting_right_pane">
                                <label for="ff_ringcentral_enabled"/>
                                <div class="text-muted">
                                    Enable sending faxes via RingCentral API.
                                </div>
                            </div>
                        </div>

                        <!-- Server URL -->
                        <div class="col-12 col-lg-6 o_setting_box"
                             invisible="not ff_ringcentral_enabled">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Server URL</span>
                                <div class="text-muted">
                                    RingCentral API server URL. Use https://platform.devtest.ringcentral.com for sandbox.
                                </div>
                                <div class="mt-2">
                                    <field name="ff_ringcentral_server_url"
                                           placeholder="https://platform.ringcentral.com"/>
                                </div>
                            </div>
                        </div>

                        <!-- Client ID -->
                        <div class="col-12 col-lg-6 o_setting_box"
                             invisible="not ff_ringcentral_enabled">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Client ID</span>
                                <div class="text-muted">
                                    From your RingCentral Developer Console app.
                                </div>
                                <div class="mt-2">
                                    <field name="ff_ringcentral_client_id"
                                           placeholder="Enter Client ID..."/>
                                </div>
                            </div>
                        </div>

                        <!-- Client Secret -->
                        <div class="col-12 col-lg-6 o_setting_box"
                             invisible="not ff_ringcentral_enabled">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Client Secret</span>
                                <div class="text-muted">
                                    From your RingCentral Developer Console app.
                                </div>
                                <div class="mt-2">
                                    <field name="ff_ringcentral_client_secret"
                                           password="True"
                                           placeholder="Enter Client Secret..."/>
                                </div>
                            </div>
                        </div>

                        <!-- JWT Token -->
                        <div class="col-12 col-lg-6 o_setting_box"
                             invisible="not ff_ringcentral_enabled">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">JWT Token</span>
                                <div class="text-muted">
                                    Generated from RingCentral Developer Console > Credentials > JWT.
                                </div>
                                <div class="mt-2">
                                    <field name="ff_ringcentral_jwt_token"
                                           password="True"
                                           placeholder="Enter JWT Token..."/>
                                </div>
                            </div>
                        </div>

                        <!-- Test Connection button -->
                        <div class="col-12 col-lg-6 o_setting_box"
                             invisible="not ff_ringcentral_enabled">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Test Connection</span>
                                <div class="text-muted">
                                    Verify your RingCentral credentials are working.
                                </div>
                                <div class="mt-2">
                                    <button name="action_test_ringcentral_connection"
                                            string="Test Connection"
                                            type="object"
                                            class="btn-primary"
                                            icon="fa-plug"/>
                                </div>
                            </div>
                        </div>

                    </div>
                </app>
            </xpath>
        </field>
    </record>

</odoo>
