<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="ir_mail_server_view_form" model="ir.ui.view">
        <field name="name">ir.mail_server.view.form.inherit.outlook</field>
        <field name="model">ir.mail_server</field>
        <field name="inherit_id" ref="base.ir_mail_server_form"/>
        <field name="arch" type="xml">
            <field name="smtp_ssl_private_key" position="after">
                <div invisible="smtp_authentication != 'outlook'"
                    class="d-flex flex-row align-items-center"
                    colspan="2"
                    groups="base.group_system">
                    <span invisible="smtp_authentication != 'outlook' or not microsoft_outlook_refresh_token"
                        class="badge text-bg-success">
                        Outlook Token Valid
                    </span>
                    <button type="object"
                        name="open_microsoft_outlook_uri" class="btn-link px-0"
                        invisible="smtp_authentication != 'outlook' or microsoft_outlook_refresh_token">
                        <i class="oi oi-arrow-right"/>
                        Connect your Outlook account
                    </button>
                    <button type="object"
                        name="open_microsoft_outlook_uri" class="btn-link px-0 ms-2"
                        invisible="smtp_authentication != 'outlook' or not microsoft_outlook_refresh_token">
                        <i class="fa fa-cog" title="Edit Settings"/>
                    </button>
                </div>
            </field>
            <field name="smtp_authentication_info" position="after">
                <widget invisible="smtp_authentication != 'outlook'" name="documentation_link" path="/applications/general/email_communication/email_servers.html?highlight=outgoing email server#use-a-default-from-email-address" label="Read More"/>
            </field>
        </field>
    </record>
</odoo>
