<script setup lang="ts">
usePageTitle('Quote requests · Settings')

const { quoteRequestEmailEnabled, setQuoteRequestEmailEnabled } = useQuoteRequestEmailEnabled()
</script>

<template>
  <div class="mx-auto max-w-3xl space-y-8">
    <div class="flex flex-wrap items-center gap-x-3 gap-y-2 text-sm">
      <NuxtLink
        to="/settings"
        class="font-medium text-[var(--text-muted)] transition hover:text-[var(--text-primary)]"
      >
        ← All settings
      </NuxtLink>
    </div>

    <div>
      <h1 class="mt-1 text-2xl font-semibold tracking-tight text-[var(--text-primary)]">Quote requests</h1>
      <p class="mt-2 max-w-2xl text-[14px] leading-relaxed text-[var(--text-muted)]">
        Control whether the app <strong>describes</strong> outbound emails to carrier quoting addresses (Settings →
        Providers). Turn off when your tenant already gets rates from published tables, direct APIs, or agentic / AI
        quoting — so users aren’t prompted to “email” carriers unnecessarily.
      </p>
    </div>

    <UCard class="border-[var(--sidebar-border)] bg-[var(--surface)] ring-1 ring-black/5">
      <div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
        <div>
          <p class="font-semibold text-[var(--text-primary)]">Provider quote emails</p>
          <p class="mt-1 text-sm text-[var(--text-muted)]">
            When enabled, auto and health quote flows explain that requests can be emailed to providers. When disabled,
            runs are saved in-app for manual pricing, rate tables, or future automation — without implying email dispatch.
          </p>
        </div>
        <UToggle :model-value="quoteRequestEmailEnabled" @update:model-value="setQuoteRequestEmailEnabled" />
      </div>
    </UCard>

    <UAlert color="neutral" variant="soft" title="Note" description="This is a UI and workflow toggle for the mock app. Production would enforce the same rule with server-side job dispatch and audit logging." />
  </div>
</template>
