<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="view_encoach_entity_list" model="ir.ui.view">
        <field name="name">encoach.entity.list</field>
        <field name="model">encoach.entity</field>
        <field name="arch" type="xml">
            <list string="Entities">
                <field name="name"/>
                <field name="code"/>
                <field name="type"/>
                <field name="white_label_domain"/>
                <field name="user_count"/>
                <field name="results_release_mode"/>
                <field name="active" column_invisible="True"/>
            </list>
        </field>
    </record>

    <record id="view_encoach_entity_form" model="ir.ui.view">
        <field name="name">encoach.entity.form</field>
        <field name="model">encoach.entity</field>
        <field name="arch" type="xml">
            <form string="Entity">
                <sheet>
                    <div class="oe_button_box" name="button_box">
                    </div>
                    <field name="logo" widget="image" class="oe_avatar"/>
                    <div class="oe_title">
                        <h1><field name="name" placeholder="Entity Name"/></h1>
                    </div>
                    <group>
                        <group>
                            <field name="code"/>
                            <field name="type"/>
                            <field name="active"/>
                        </group>
                        <group>
                            <field name="white_label_domain"/>
                            <field name="results_release_mode"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Branding">
                            <group>
                                <group>
                                    <field name="primary_color" widget="color"/>
                                    <field name="secondary_color" widget="color"/>
                                    <field name="background_color" widget="color"/>
                                </group>
                                <group>
                                    <field name="logo_url"/>
                                    <field name="login_title"/>
                                    <field name="favicon" widget="image"/>
                                </group>
                            </group>
                            <field name="login_description"/>
                        </page>
                        <page string="Users">
                            <field name="user_ids">
                                <list>
                                    <field name="name"/>
                                    <field name="login"/>
                                    <field name="user_type"/>
                                </list>
                            </field>
                        </page>
                        <page string="Roles">
                            <field name="role_ids">
                                <list>
                                    <field name="name"/>
                                </list>
                            </field>
                        </page>
                    </notebook>
                </sheet>
                <chatter/>
            </form>
        </field>
    </record>

    <record id="view_encoach_entity_search" model="ir.ui.view">
        <field name="name">encoach.entity.search</field>
        <field name="model">encoach.entity</field>
        <field name="arch" type="xml">
            <search string="Search Entities">
                <field name="name"/>
                <field name="code"/>
                <filter string="Corporate" name="corporate" domain="[('type', '=', 'corporate')]"/>
                <filter string="University" name="university" domain="[('type', '=', 'university')]"/>
                <filter string="School" name="school" domain="[('type', '=', 'school')]"/>
                <separator/>
                <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
            </search>
        </field>
    </record>

    <record id="action_encoach_entity" model="ir.actions.act_window">
        <field name="name">Entities</field>
        <field name="res_model">encoach.entity</field>
        <field name="view_mode">list,form</field>
        <field name="search_view_id" ref="view_encoach_entity_search"/>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Create your first entity
            </p>
            <p>Entities represent organizations (corporates, universities, schools) on the EnCoach platform.</p>
        </field>
    </record>

    <menuitem id="menu_encoach_entity_list"
              name="Entities"
              parent="menu_encoach_entity"
              action="action_encoach_entity"
              sequence="1"/>
</odoo>
