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

    <record id="view_res_config_settings_form_inherit_debugpy" model="ir.ui.view">
        <field name="name">res.config.settings.form.inherit.debug.py</field>
        <field name="model">res.config.settings</field>
        <field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
        <field name="arch" type="xml">
            <xpath expr="//form" position="inside">
                <app data-string="Debugpy" string="Debugpy" name="debugpy_installed" logo="/odoo_debugpy/static/description/icon.png">
                    <div id="debugpy_entry">
                        <field name="debugpy_is_installed" invisible="1"/>
                        <field name="debugpy_is_client_connected" invisible="1"/>

                        <block title="Debugpy" name="debugpy_is_installed_setting" >
                            <setting id="debugpy_installed" class="o_setting_box col-12 col-lg-12 o_searchable_setting" invisible="debugpy_is_installed == True">
                                <div class="content-group">
                                    <div class="mt16">
                                        <span class="o_form_label">Module Not Installed</span>
                                        <a href="https://pypi.org/project/debugpy/" title="Documentation" class="o_doc_link" target="_blank"/>
                                        <div class="text-muted">
                                            Please install debugpy and restart your system
                                        </div>
                                        <div class="content-group"/>
                                        <div>
                                            <a href="https://docs.python.org/3/installing/index.html" class="oe_link" target="_blank">
                                                <i class="fa fa-arrow-right"/> Learn more
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </setting>

                            <setting id="debugpy_wait" class="o_setting_box col-12 col-lg-12 o_searchable_setting" invisible="debugpy_is_installed == False">
                                <div class="content-group">
                                    <div class="mt16">
                                        <div class="o_setting_left_pane">
                                            <field name="debugpy_wait_for_client" string="Wait for Client" readonly="debugpy_is_client_connected == True"/>
                                        </div>
                                        <div class="o_setting_right_pane">
                                            <label string="Wait for Client" for="debugpy_wait_for_client"/>
                                            <div class="text-muted">
                                                Block program execution until the client is attached
                                            </div>
                                            <div class="content-group"/>
                                        </div>
                                    </div>
                                </div>
                            </setting>

                            <setting id="debugpy_log" class="o_setting_box col-12 col-lg-12 o_searchable_setting" invisible="debugpy_is_installed == False">
                                <div class="content-group">
                                    <div class="mt16">
                                        <div class="o_setting_left_pane">
                                            <field name="debugpy_logging" string="Logging" readonly="debugpy_is_client_connected == True"/>
                                        </div>
                                        <label string="Logging" for="debugpy_logging"/>
                                        <a href="#" title="Documentation" class="o_doc_link" target="_blank"/>
                                        <div class="text-muted">
                                            Create several log files for different components of the debugger
                                        </div>
                                        <div class="content-group">
                                            <div class="row mt16" readonly="debugpy_is_client_connected == True">
                                                <label for="debugpy_log_to" string="Log to" class="col-3 col-lg-3 o_light_label"/>
                                                <field name="debugpy_log_to" nolabel="1" required="1" readonly="debugpy_is_client_connected == True"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </setting>

                            <setting id="debugpy_remote_debugging" class="o_setting_box col-12 col-lg-12 o_searchable_setting" invisible="debugpy_is_installed == False">
                                <div class="content-group">
                                    <div class="mt16">
                                        <span class="o_form_label">Remote Debugging</span>
                                        <a href="#" title="Documentation" class="o_doc_link mr8" target="_blank"/>
                                        <div invisible="debugpy_is_client_connected == True">
                                            <div class="text-muted">
                                                Start the debug adapter
                                            </div>
                                            <div class="content-group">
                                                <div class="row mt16">
                                                    <div class="col-6 col-lg-6">
                                                        <label for="debugpy_host" string="Host" class="o_light_label"/>
                                                        <field name="debugpy_host" nolabel="1" required="1"/>
                                                    </div>
                                                    <div class="col-6 col-lg-6">
                                                        <label for="debugpy_port" string="Port" class="o_light_label"/>
                                                        <field name="debugpy_port" nolabel="1" required="1" options="{'format': 0}"/>
                                                    </div>
                                                </div>
                                                <div>
                                                    <span style="border: 1px solid transparent; padding: 0.375rem 0;"><i class="fa fa-plug"/> Not connected</span>
                                                    <button type="object" name="action_debugpy_listen" string="Listen" class="oe_link" icon="fa-arrow-right"/>
                                                </div>
                                            </div>
                                        </div>
                                        <div invisible="debugpy_is_client_connected == False">
                                            <div class="content-group">
                                                <span class="text-success" style="border: 1px solid transparent; padding: 0.375rem 0;"><i class="fa fa-plug"/> Client connected</span>
                                                <button type="object" name="action_debugpy_test" string="Test" class="oe_link" icon="fa-arrow-right"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </setting>

                            <setting id="debugpy_remote_debugging" class="o_setting_box col-12 col-lg-12 o_searchable_setting" invisible="debugpy_is_installed == False">
                                <div class="content-group">
                                    <div class="mt16">
                                        <span class="o_form_label">Compatiblity &amp; Integration</span>
                                        <div class="text-muted">
                                            Check out these example configurations to get started!
                                        </div>
                                        <div class="content-group">
                                            <div>
                                                <span class="oe_link">
                                                    <i class="fa fa-times"/> PyCharm
                                                </span>
                                                <i class="fa fa-question-circle" title="Not supported"/>
                                            </div>
                                            <div>
                                                <span class="oe_link">
                                                    <i class="fa fa-times"/> PyDev
                                                </span>
                                                <i class="fa fa-question-circle" title="Not supported"/>
                                            </div>
                                            <div>
                                                <a href="/odoo_debugpy/static/json/examples/vscode/launch.json" class="oe_link" download="launch.json">
                                                    <i class="fa fa-arrow-right"/> Visual Studio Code
                                                </a>
                                                <a href="https://code.visualstudio.com/docs/python/debugging#_debugging-by-attaching-over-a-network-connection" title="Documentation" class="o_doc_link" target="_blank"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </setting>
                        </block>
                    </div>
                </app>
            </xpath>
        </field>
    </record>

</odoo>