<%# locals: (user:) %>

<div class="space-y-4">
  <div class="flex items-center justify-between">
    <div class="space-y-1">
      <p class="text-sm"><%= t(".title") %></p>
      <p class="text-gray-500 text-sm"><%= t(".description") %></p>
      <% if self_hosted? %>
        <p class="text-xs italic text-gray-500"><%= t(".self_host_disclaimer") %></p>
      <% end %>
    </div>

    <%= styled_form_with model: user,
                         data: { controller: "auto-submit-form", "auto-submit-form-trigger-event-value": "blur" } do |form| %>
      <div class="relative inline-block select-none">
        <%= form.hidden_field :redirect_to, value: "preferences" %>
        <%= form.fields_for :family do |family_form| %>
          <%= family_form.check_box :data_enrichment_enabled, class: "sr-only peer", "data-auto-submit-form-target": "auto", "data-autosubmit-trigger-event": "input" %>
          <%= family_form.label :data_enrichment_enabled, "&nbsp;".html_safe, class: "maybe-switch" %>
        <% end %>
      </div>
    <% end %>
  </div>
</div>
