<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <!-- Vista de lista de citas -->
    <record id="view_skeen_cita_tree" model="ir.ui.view">
        <field name="name">skeen.cita.tree</field>
        <field name="model">skeen.cita</field>
        <field name="arch" type="xml">
            <tree decoration-success="state=='done'" decoration-danger="state=='cancelled'" decoration-warning="state=='pending'">
                <field name="name"/>
                <field name="partner_id"/>
                <field name="partner_phone"/>
                <field name="servicio_id"/>
                <field name="date"/>
                <field name="time" widget="float_time"/>
                <field name="state" widget="badge" decoration-success="state=='done'" decoration-danger="state=='cancelled'" decoration-warning="state=='pending'" decoration-info="state=='confirmed'"/>
                <field name="payment_state" widget="badge"/>
            </tree>
        </field>
    </record>

    <!-- Vista de formulario de citas -->
    <record id="view_skeen_cita_form" model="ir.ui.view">
        <field name="name">skeen.cita.form</field>
        <field name="model">skeen.cita</field>
        <field name="arch" type="xml">
            <form>
                <header>
                    <button name="action_confirm" string="Confirmar" type="object" invisible="state != 'pending'" class="oe_highlight"/>
                    <button name="action_arrive" string="Llegó" type="object" invisible="state != 'confirmed'" class="oe_highlight"/>
                    <button name="action_start" string="Iniciar" type="object" invisible="state != 'arrived'" class="oe_highlight"/>
                    <button name="action_done" string="Completar" type="object" invisible="state != 'in_progress'" class="oe_highlight"/>
                    <button name="action_cancel" string="Cancelar" type="object" invisible="state not in ('pending', 'confirmed', 'arrived', 'in_progress')"/>
                    <button name="action_no_show" string="No Show" type="object" invisible="state not in ('confirmed', 'arrived')"/>
                    <field name="state" widget="statusbar" statusbar_visible="pending,confirmed,arrived,in_progress,done"/>
                </header>
                <sheet>
                    <group>
                        <group>
                            <field name="name" readonly="1"/>
                            <field name="partner_id" options="{'no_create': True}"/>
                            <field name="partner_phone" readonly="1"/>
                            <field name="partner_email" readonly="1"/>
                        </group>
                        <group>
                            <field name="servicio_id"/>
                            <field name="servicio_price" readonly="1"/>
                            <field name="servicio_duration" readonly="1"/>
                            <field name="date"/>
                            <field name="time" widget="float_time"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Notas">
                            <field name="notes"/>
                        </page>
                        <page string="Pago">
                            <group>
                                <field name="payment_state"/>
                                <field name="amount_paid"/>
                            </group>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <!-- Vista calendario de citas -->
    <record id="view_skeen_cita_calendar" model="ir.ui.view">
        <field name="name">skeen.cita.calendar</field>
        <field name="model">skeen.cita</field>
        <field name="arch" type="xml">
            <calendar string="Citas" date_start="datetime_start" date_stop="datetime_end" color="partner_id">
                <field name="name"/>
                <field name="partner_id"/>
                <field name="servicio_id"/>
                <field name="state"/>
            </calendar>
        </field>
    </record>

    <!-- Acción para citas -->
    <record id="action_skeen_cita_tree" model="ir.actions.act_window">
        <field name="name">Citas</field>
        <field name="res_model">skeen.cita</field>
        <field name="view_mode">tree,form,calendar</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                ¡Crea tu primera cita!
            </p>
        </field>
    </record>

    <!-- Vista de lista de servicios -->
    <record id="view_skeen_servicio_tree" model="ir.ui.view">
        <field name="name">skeen.servicio.tree</field>
        <field name="model">skeen.servicio</field>
        <field name="arch" type="xml">
            <tree>
                <field name="code"/>
                <field name="name"/>
                <field name="category"/>
                <field name="price"/>
                <field name="duration_min"/>
                <field name="active"/>
            </tree>
        </field>
    </record>

    <!-- Vista de formulario de servicios -->
    <record id="view_skeen_servicio_form" model="ir.ui.view">
        <field name="name">skeen.servicio.form</field>
        <field name="model">skeen.servicio</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <group>
                        <group>
                            <field name="name"/>
                            <field name="code"/>
                            <field name="category"/>
                            <field name="active"/>
                        </group>
                        <group>
                            <field name="price"/>
                            <field name="duration_min"/>
                            <field name="sequence"/>
                        </group>
                    </group>
                    <field name="description"/>
                </sheet>
            </form>
        </field>
    </record>

    <!-- Acción para servicios -->
    <record id="action_skeen_servicio_tree" model="ir.actions.act_window">
        <field name="name">Servicios</field>
        <field name="res_model">skeen.servicio</field>
        <field name="view_mode">tree,form</field>
    </record>
</odoo>