<odoo>
  <record id="view_affiliate_widget_config_tree" model="ir.ui.view">
    <field name="name">affiliate.widget.config.tree</field>
    <field name="model">affiliate.widget.config</field>
    <field name="arch" type="xml">
      <list>
        <field name="partner_id"/>
        <field name="widget_key"/>
        <field name="widget_mode"/>
        <field name="is_active"/>
        <field name="language"/>
        <field name="total_impressions"/>
        <field name="total_clicks"/>
      </list>
    </field>
  </record>

  <record id="view_affiliate_widget_config_form" model="ir.ui.view">
    <field name="name">affiliate.widget.config.form</field>
    <field name="model">affiliate.widget.config</field>
    <field name="arch" type="xml">
      <form>
        <sheet>
          <div class="oe_button_box" name="button_box"/>
          <group>
            <group>
              <field name="partner_id"/>
              <field name="widget_key"/>
              <field name="is_active"/>
              <field name="widget_mode"/>
              <field name="language"/>
              <field name="landing_page"/>
            </group>
            <group>
              <field name="primary_color" widget="color"/>
              <field name="text_color" widget="color"/>
              <field name="total_impressions"/>
              <field name="total_clicks"/>
            </group>
          </group>

          <notebook>
            <!-- Shared Theme Settings -->
            <page string="Theme" name="theme">
              <group>
                <group string="Base Theme">
                  <field name="theme_color" widget="color"/>
                  <field name="theme_font_family"/>
                  <field name="theme_font_size"/>
                </group>
                <group string="Color Overrides">
                  <field name="theme_bg_color" widget="color"/>
                  <field name="theme_heading_color" widget="color"/>
                  <field name="theme_text_color" widget="color"/>
                  <field name="theme_link_color" widget="color"/>
                  <field name="theme_btn_color" widget="color"/>
                  <field name="theme_border_color" widget="color"/>
                </group>
              </group>
              <group>
                <group string="Navbar">
                  <field name="theme_navbar_scheme"/>
                  <field name="theme_navbar_bg" widget="color"
                         invisible="theme_navbar_scheme != 'custom'"/>
                  <field name="theme_navbar_text" widget="color"
                         invisible="theme_navbar_scheme != 'custom'"/>
                </group>
                <group string="Site Footer">
                  <field name="theme_site_footer_visible"/>
                  <field name="theme_site_footer_scheme"
                         invisible="not theme_site_footer_visible"/>
                  <field name="theme_site_footer_bg" widget="color"
                         invisible="theme_site_footer_scheme != 'custom'"/>
                  <field name="theme_site_footer_text" widget="color"
                         invisible="theme_site_footer_scheme != 'custom'"/>
                </group>
              </group>
              <group>
                <group string="Cards &amp; Forms">
                  <field name="theme_card_bg" widget="color"/>
                  <field name="theme_card_header_bg" widget="color"/>
                  <field name="theme_input_bg" widget="color"/>
                  <field name="theme_form_bg" widget="color"/>
                </group>
                <group string="Content Visibility">
                  <field name="theme_show_search"/>
                  <field name="theme_show_logo"/>
                  <field name="theme_show_newsletter_popup"/>
                  <field name="theme_custom_title"/>
                  <field name="theme_no_results_text"/>
                </group>
              </group>
            </page>

            <!-- Overlay Settings -->
            <page string="Overlay Settings" name="overlay"
                  invisible="widget_mode != 'overlay'">
              <group>
                <group string="Button">
                  <field name="show_button"/>
                  <field name="position"/>
                  <field name="button_style"/>
                  <field name="button_text"/>
                </group>
                <group string="Toolbar">
                  <field name="show_logo"/>
                  <field name="toolbar_height"/>
                  <field name="overlay_radius"/>
                </group>
              </group>
              <group>
                <group string="Backdrop &amp; Overlay">
                  <field name="backdrop_opacity"/>
                  <field name="overlay_border"/>
                  <field name="border_color" widget="color"
                         invisible="not overlay_border"/>
                  <field name="bg_image_url" widget="url"/>
                  <field name="bg_image_opacity"/>
                </group>
                <group string="Navigation Sidebar">
                  <field name="nav_layout"/>
                  <field name="nav_bg_color" widget="color"
                         invisible="nav_layout == 'hidden'"/>
                  <field name="nav_font_color" widget="color"
                         invisible="nav_layout == 'hidden'"/>
                </group>
              </group>
              <group string="Widget Footer">
                <field name="show_footer"/>
                <field name="footer_text" invisible="not show_footer"/>
                <field name="footer_bg_color" widget="color"
                       invisible="not show_footer"/>
                <field name="footer_font_color" widget="color"
                       invisible="not show_footer"/>
              </group>
            </page>

            <!-- Inline Settings -->
            <page string="Inline Settings" name="inline"
                  invisible="widget_mode not in ('inline', 'grid')">
              <group>
                <group string="Container">
                  <field name="inline_width"/>
                  <field name="inline_height"/>
                  <field name="inline_auto_resize"/>
                  <field name="inline_border_radius"/>
                </group>
                <group string="Header &amp; Menu">
                  <field name="inline_show_header"/>
                  <field name="inline_show_topbar"
                         invisible="not inline_show_header"/>
                  <field name="inline_show_logo"
                         invisible="not inline_show_header"/>
                  <field name="inline_show_menu"
                         invisible="not inline_show_header"/>
                  <field name="inline_menu_layout"
                         invisible="not inline_show_menu or not inline_show_header"/>
                  <field name="inline_show_menu_actions"
                         invisible="not inline_show_menu or not inline_show_header"/>
                </group>
                <group string="Menu Items"
                       invisible="not inline_show_menu or not inline_show_header">
                  <field name="inline_show_menu_stellenangebote"/>
                  <field name="inline_show_menu_firmenprofile"/>
                  <field name="inline_show_menu_karriere_tipps"/>
                </group>
                <group string="Custom Logo">
                  <field name="inline_custom_logo" widget="image"
                         invisible="not inline_show_header"/>
                  <field name="inline_custom_logo_url"
                         invisible="not inline_show_header"/>
                </group>
              </group>
            </page>

            <!-- Box Widget Settings -->
            <page string="Box Widget" name="box"
                  invisible="widget_mode != 'box'">
              <group>
                <group string="Layout">
                  <field name="box_title"/>
                  <field name="box_job_count"/>
                  <field name="box_layout"/>
                  <field name="box_link_target"/>
                  <field name="box_width"/>
                  <field name="box_height"/>
                </group>
                <group string="Header">
                  <field name="box_header_bg" widget="color"/>
                  <field name="box_header_text" widget="color"/>
                  <field name="box_header_font_size"/>
                </group>
              </group>
              <group>
                <group string="Body">
                  <field name="box_body_bg" widget="color"/>
                  <field name="box_body_font_size"/>
                  <field name="box_link_color" widget="color"/>
                  <field name="box_show_border"/>
                  <field name="box_border_color" widget="color"
                         invisible="not box_show_border"/>
                </group>
                <group string="Footer">
                  <field name="box_footer_bg" widget="color"/>
                  <field name="box_footer_text" widget="color"/>
                </group>
              </group>
            </page>

            <!-- Job Filters -->
            <page string="Job Filters" name="filters">
              <group>
                <field name="filter_mode"/>
              </group>
              <group invisible="filter_mode != 'curated'">
                <field name="filter_job_ids" widget="many2many_tags"/>
              </group>
              <group invisible="filter_mode != 'filtered'">
                <field name="filter_field_ids" widget="many2many_tags"/>
                <field name="filter_function_ids" widget="many2many_tags"/>
                <field name="filter_employer_ids" widget="many2many_tags"/>
              </group>
            </page>
          </notebook>
        </sheet>
      </form>
    </field>
  </record>

  <record id="action_affiliate_widget_config" model="ir.actions.act_window">
    <field name="name">Affiliate Widgets</field>
    <field name="res_model">affiliate.widget.config</field>
    <field name="view_mode">list,form</field>
  </record>

  <menuitem id="menu_affiliate_widget_root"
            name="Affiliate Widgets"
            parent="hr_recruitment.menu_hr_recruitment_root"
            sequence="90"/>

  <menuitem id="menu_affiliate_widget_config"
            name="Widget Configurations"
            parent="menu_affiliate_widget_root"
            action="action_affiliate_widget_config"
            sequence="10"/>
</odoo>
