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

    <!-- Brand Voice List View -->
    <record id="otk_seo_brand_voice_view_tree" model="ir.ui.view">
        <field name="name">otk.seo.brand.voice.list</field>
        <field name="model">otk.seo.brand.voice</field>
        <field name="arch" type="xml">
            <list string="Brand Voices">
                <field name="sequence" widget="handle"/>
                <field name="name"/>
                <field name="voice_tone"/>
                <field name="writing_style"/>
                <field name="is_default" widget="boolean_toggle"/>
                <field name="content_count"/>
                <field name="active" column_invisible="1"/>
            </list>
        </field>
    </record>

    <!-- Brand Voice Form View -->
    <record id="otk_seo_brand_voice_view_form" model="ir.ui.view">
        <field name="name">otk.seo.brand.voice.form</field>
        <field name="model">otk.seo.brand.voice</field>
        <field name="arch" type="xml">
            <form string="Brand Voice">
                <sheet>
                    <div class="oe_button_box" name="button_box">
                        <button name="action_view_content" type="object"
                            class="oe_stat_button" icon="fa-file-text-o">
                            <field name="content_count" widget="statinfo" string="Content"/>
                        </button>
                    </div>

                    <widget name="web_ribbon" title="Default"
                        bg_color="text-bg-success" invisible="not is_default"/>

                    <div class="oe_title">
                        <h1>
                            <field name="name" placeholder="Brand Name"/>
                        </h1>
                    </div>

                    <group>
                        <group string="Settings">
                            <field name="is_default" widget="boolean_toggle"/>
                            <field name="sequence"/>
                        </group>
                        <group string="Voice Style">
                            <field name="voice_tone"/>
                            <field name="writing_style"/>
                            <field name="voice_personality"
                                placeholder="e.g., innovative, trustworthy, approachable"/>
                        </group>
                    </group>

                    <notebook>
                        <page string="Brand Identity" name="identity">
                            <group>
                                <group string="Brand Description">
                                    <field name="brand_description" nolabel="1" colspan="2"
                                        placeholder="Describe your brand, its values, and mission..."/>
                                </group>
                                <group string="Target Audience">
                                    <field name="target_audience" nolabel="1" colspan="2"
                                        placeholder="Describe your ideal reader/customer..."/>
                                </group>
                            </group>
                        </page>

                        <page string="Vocabulary" name="vocabulary">
                            <group>
                                <group string="Preferred Words">
                                    <field name="preferred_words" nolabel="1" colspan="2"
                                        placeholder="Words to use (one per line)..."/>
                                </group>
                                <group string="Words to Avoid">
                                    <field name="avoided_words" nolabel="1" colspan="2"
                                        placeholder="Words to avoid (one per line)..."/>
                                </group>
                            </group>
                            <group string="Industry Terminology">
                                <field name="industry_terms" nolabel="1" colspan="2"
                                    placeholder="Industry terms and preferred usage..."/>
                            </group>
                        </page>

                        <page string="Custom Instructions" name="instructions">
                            <group string="Additional AI Instructions">
                                <field name="custom_instructions" nolabel="1" colspan="2"
                                    placeholder="Additional rules for the AI to follow when generating content..."/>
                            </group>
                        </page>

                        <page string="Examples" name="examples">
                            <group>
                                <group string="Good Example">
                                    <field name="example_good" nolabel="1" colspan="2"
                                        placeholder="Paste content that represents your brand voice well..."/>
                                </group>
                                <group string="What to Avoid">
                                    <field name="example_bad" nolabel="1" colspan="2"
                                        placeholder="Paste content that does NOT match your brand voice..."/>
                                </group>
                            </group>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <!-- Brand Voice Search View -->
    <record id="otk_seo_brand_voice_view_search" model="ir.ui.view">
        <field name="name">otk.seo.brand.voice.search</field>
        <field name="model">otk.seo.brand.voice</field>
        <field name="arch" type="xml">
            <search string="Search Brand Voices">
                <field name="name"/>
                <field name="voice_tone"/>
                <separator/>
                <filter name="filter_default" string="Default Voice"
                    domain="[('is_default', '=', True)]"/>
                <filter name="filter_active" string="Active"
                    domain="[('active', '=', True)]"/>
                <filter name="filter_archived" string="Archived"
                    domain="[('active', '=', False)]"/>
            </search>
        </field>
    </record>

    <!-- Action -->
    <record id="action_otk_seo_brand_voice" model="ir.actions.act_window">
        <field name="name">Brand Voices</field>
        <field name="res_model">otk.seo.brand.voice</field>
        <field name="view_mode">list,form</field>
        <field name="search_view_id" ref="otk_seo_brand_voice_view_search"/>
        <field name="context">{}</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Create your first brand voice!
            </p>
            <p>
                Define your brand's tone, style, and vocabulary to ensure
                all AI-generated content follows your brand guidelines.
            </p>
        </field>
    </record>

</odoo>
