<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <!-- Company List View -->
        <record id="view_marketplace_company_list" model="ir.ui.view">
            <field name="name">marketplace.company.list</field>
            <field name="model">marketplace.company</field>
            <field name="arch" type="xml">
                <list string="Companies">
                    <field name="name"/>
                    <field name="tax_id"/>
                    <field name="country_id"/>
                    <field name="active"/>
                </list>
            </field>
        </record>

        <!-- Company Form View -->
        <record id="view_marketplace_company_form" model="ir.ui.view">
            <field name="name">marketplace.company.form</field>
            <field name="model">marketplace.company</field>
            <field name="arch" type="xml">
                <form string="Company">
                    <sheet>
                        <group>
                            <field name="name" required="1"/>
                            <field name="tax_id" required="1"/>
                            <field name="country_id" required="1"/>
                            <field name="active"/>
                            <field name="uuid" readonly="1"/>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

        <!-- Company Search View -->
        <record id="view_marketplace_company_search" model="ir.ui.view">
            <field name="name">marketplace.company.search</field>
            <field name="model">marketplace.company</field>
            <field name="arch" type="xml">
                <search string="Companies">
                    <field name="name"/>
                    <field name="tax_id"/>
                    <field name="country_id"/>
                    
                    <filter string="Active" name="active" domain="[('active', '=', True)]"/>
                    <filter string="Inactive" name="inactive" domain="[('active', '=', False)]"/>
                    
                    <group expand="0" string="Group By">
                        <filter string="Country" name="group_by_country" context="{'group_by': 'country_id'}"/>
                    </group>
                </search>
            </field>
        </record>

        <!-- Company Action -->
        <record id="action_marketplace_company" model="ir.actions.act_window">
            <field name="name">Companies</field>
            <field name="res_model">marketplace.company</field>
            <field name="view_mode">list,form</field>
            <field name="context">{}</field>
            <field name="help" type="html">
                <p class="o_view_nocontent_smiling_face">
                    Create a new company
                </p>
                <p>
                    Companies represent logistics providers, service companies, and other marketplace participants.
                </p>
            </field>
        </record>
    </data>
</odoo>