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

    <!-- Tree View -->
    <record id="cx_tower_git_remote_view_tree" model="ir.ui.view">
        <field name="name">cx.tower.git.remote.tree</field>
        <field name="model">cx.tower.git.remote</field>
        <field name="arch" type="xml">
            <tree decoration-info="is_private == True">
                <field
                    name="repo_id"
                    placeholder="select or enter a link"
                    options="{'no_create_edit': True}"
                />
                <field name="is_private" optional="hide" />
                <field name="head_type" />
                <field name="head" />
                <field name="enabled" widget="boolean_toggle" />
                <field name="create_uid" optional="hide" groups="base.group_no_one" />
                <field name="reference" optional="hide" groups="base.group_no_one" />
            </tree>
        </field>
    </record>

    <!-- Form View -->
    <record id="cx_tower_git_remote_view_form" model="ir.ui.view">
        <field name="name">cx.tower.git.remote.form</field>
        <field name="model">cx.tower.git.remote</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <widget
                        name="web_ribbon"
                        title="Disabled"
                        bg_color="bg-danger"
                        attrs="{'invisible': [('enabled', '=', True)]}"
                    />
                    <group>
                        <field name="sequence" groups="base.group_no_one" />
                        <field name="enabled" />
                        <field name="active" invisible="1" />
                        <field
                            name="repo_id"
                            placeholder="select or enter a link"
                            options="{'no_create_edit': True}"
                        />
                        <field name="is_private" />
                        <field
                            name="url_protocol"
                            widget="radio"
                            options="{'horizontal': true}"
                        />
                        <field
                            name="head_type"
                            widget="radio"
                            options="{'horizontal': true}"
                        />
                        <field
                            name="head"
                            attrs="{'invisible': [('head_type', '=', False)]}"
                            placeholder="Branch/PR/commit number or link"
                        />
                        <field name="create_uid" groups="base.group_no_one" />
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <!-- Action -->
    <record id="action_cx_tower_git_remote" model="ir.actions.act_window">
        <field name="name">Git Remotes</field>
        <field name="res_model">cx.tower.git.remote</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Create your first git remote!
            </p>
            <p>
                Git remotes represent branches, pull requests, or commits from git repositories.
            </p>
        </field>
    </record>

    </odoo>
