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

    <record id="res_config_settings_view_form_fusion_schedule" model="ir.ui.view">
        <field name="name">res.config.settings.view.form.fusion.schedule</field>
        <field name="model">res.config.settings</field>
        <field name="inherit_id" ref="base.res_config_settings_view_form"/>
        <field name="priority">90</field>
        <field name="arch" type="xml">
            <xpath expr="//form" position="inside">
                <app data-string="Fusion Schedule" string="Fusion Schedule" name="fusion_schedule"
                     logo="/fusion_schedule/static/description/icon.png">

                    <!-- ===== CALENDAR SYNC ===== -->
                    <h2>Calendar Sync</h2>

                    <div class="row mt-4 o_settings_container">
                        <div class="col-12 col-lg-6 o_setting_box">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Sync Interval</span>
                                <div class="text-muted">
                                    How often connected calendars are synchronised automatically
                                </div>
                                <div class="mt-2 row">
                                    <div class="col-4">
                                        <field name="x_fc_sync_interval_minutes"/>
                                    </div>
                                    <div class="col-8 pt-2 text-muted">minutes (default: 5)</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- ===== GOOGLE CALENDAR ===== -->
                    <h2>Google Calendar</h2>

                    <div class="row mt-4 o_settings_container">
                        <div class="col-12 col-lg-6 o_setting_box">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Google OAuth Credentials</span>
                                <div class="text-muted">
                                    Required to connect Google Calendar accounts.
                                    Get these from Google Cloud Console.
                                </div>
                                <div class="mt-2">
                                    <div class="row mb-2">
                                        <label for="x_fc_google_client_id" class="col-5 col-form-label">Client ID</label>
                                        <div class="col-7">
                                            <field name="x_fc_google_client_id"
                                                   placeholder="Leave empty to use Odoo default"/>
                                        </div>
                                    </div>
                                    <div class="row mb-2">
                                        <label for="x_fc_google_client_secret" class="col-5 col-form-label">Client Secret</label>
                                        <div class="col-7">
                                            <field name="x_fc_google_client_secret" password="True"
                                                   placeholder="Leave empty to use Odoo default"/>
                                        </div>
                                    </div>
                                </div>
                                <field name="x_fc_google_has_fallback" invisible="True"/>
                                <div class="alert alert-info mt-2 py-2 px-3" role="alert"
                                     invisible="not x_fc_google_has_fallback">
                                    <i class="fa fa-info-circle me-1"/>
                                    Using Odoo's default Google credentials as fallback
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- ===== MICROSOFT OUTLOOK ===== -->
                    <h2>Microsoft Outlook</h2>

                    <div class="row mt-4 o_settings_container">
                        <div class="col-12 col-lg-6 o_setting_box">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Microsoft OAuth Credentials</span>
                                <div class="text-muted">
                                    Required to connect Outlook / Microsoft 365 accounts.
                                    Get these from Azure Portal.
                                </div>
                                <div class="mt-2">
                                    <div class="row mb-2">
                                        <label for="x_fc_microsoft_client_id" class="col-5 col-form-label">Client ID</label>
                                        <div class="col-7">
                                            <field name="x_fc_microsoft_client_id"
                                                   placeholder="Leave empty to use Odoo default"/>
                                        </div>
                                    </div>
                                    <div class="row mb-2">
                                        <label for="x_fc_microsoft_client_secret" class="col-5 col-form-label">Client Secret</label>
                                        <div class="col-7">
                                            <field name="x_fc_microsoft_client_secret" password="True"
                                                   placeholder="Leave empty to use Odoo default"/>
                                        </div>
                                    </div>
                                </div>
                                <field name="x_fc_microsoft_has_fallback" invisible="True"/>
                                <div class="alert alert-info mt-2 py-2 px-3" role="alert"
                                     invisible="not x_fc_microsoft_has_fallback">
                                    <i class="fa fa-info-circle me-1"/>
                                    Using Odoo's default Microsoft credentials as fallback
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- ===== SCHEDULE DEFAULTS ===== -->
                    <h2>Schedule Defaults</h2>

                    <div class="row mt-4 o_settings_container">
                        <div class="col-12 col-lg-6 o_setting_box">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Work Hours</span>
                                <div class="text-muted">
                                    Default work day start and end times for staff scheduling
                                </div>
                                <div class="mt-2 d-flex align-items-center gap-2">
                                    <field name="x_fc_default_work_start" widget="float_time" style="max-width: 90px;"/>
                                    <span class="text-muted">to</span>
                                    <field name="x_fc_default_work_end" widget="float_time" style="max-width: 90px;"/>
                                </div>
                            </div>
                        </div>

                        <div class="col-12 col-lg-6 o_setting_box">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Break / Lunch</span>
                                <div class="text-muted">
                                    Default fixed break time for staff
                                </div>
                                <div class="mt-2 d-flex align-items-center gap-2">
                                    <field name="x_fc_default_break_start" widget="float_time" style="max-width: 90px;"/>
                                    <span class="text-muted">for</span>
                                    <field name="x_fc_default_break_duration" widget="float_time" style="max-width: 90px;"/>
                                </div>
                            </div>
                        </div>

                        <div class="col-12 col-lg-6 o_setting_box">
                            <div class="o_setting_right_pane">
                                <span class="o_form_label">Travel Buffer</span>
                                <div class="text-muted">
                                    Minimum travel time buffer between consecutive appointments
                                </div>
                                <div class="mt-2 row">
                                    <div class="col-4">
                                        <field name="x_fc_default_travel_buffer"/>
                                    </div>
                                    <div class="col-8 pt-2 text-muted">minutes (default: 30)</div>
                                </div>
                            </div>
                        </div>
                    </div>

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

</odoo>
