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

    <record id="view_otp_form" model="ir.ui.view">
        <field name="name">encoach.otp.form</field>
        <field name="model">encoach.otp</field>
        <field name="arch" type="xml">
            <form string="OTP Record">
                <sheet>
                    <group>
                        <group>
                            <field name="email"/>
                            <field name="otp_hash"/>
                            <field name="expires_at"/>
                        </group>
                        <group>
                            <field name="used"/>
                            <field name="resend_count"/>
                            <field name="created_at"/>
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_otp_list" model="ir.ui.view">
        <field name="name">encoach.otp.list</field>
        <field name="model">encoach.otp</field>
        <field name="arch" type="xml">
            <list string="OTP Records" create="false" edit="false">
                <field name="email"/>
                <field name="otp_hash"/>
                <field name="expires_at"/>
                <field name="used" widget="badge" decoration-success="used" decoration-muted="not used"/>
                <field name="resend_count"/>
                <field name="created_at"/>
            </list>
        </field>
    </record>

    <record id="view_otp_search" model="ir.ui.view">
        <field name="name">encoach.otp.search</field>
        <field name="model">encoach.otp</field>
        <field name="arch" type="xml">
            <search string="Search OTP Records">
                <field name="email"/>
                <separator/>
                <filter string="Used" name="used" domain="[('used', '=', True)]"/>
                <filter string="Unused" name="unused" domain="[('used', '=', False)]"/>
            </search>
        </field>
    </record>

    <record id="action_otp" model="ir.actions.act_window">
        <field name="name">OTP Records</field>
        <field name="res_model">encoach.otp</field>
        <field name="view_mode">list,form</field>
    </record>

</odoo>
