╔══════════════════════════════════════════════════════════════════╗
║  FREE SAMPLE — zicula-booking-kit                                ║
║  This is the REAL config block from the kit's worker.mjs,        ║
║  copied as-is (lines 1–109 of the full 864-line file).           ║
║  This block is everything you edit; the rest of the file         ║
║  (availability engine, booking API, admin panel, ICS, email)     ║
║  comes in the full kit.                                          ║
╚══════════════════════════════════════════════════════════════════╝

// worker.mjs — Booking Kit: your own booking page, on your own Cloudflare account.
// Single file. No npm dependencies. Runs on the Cloudflare Workers free tier.
//
// ═══════════════════════════════════════════════════════════════════════
// HOW TO SET UP (full walkthrough in README.md)
//   1. Edit the CONFIG block below (brand, timezone, hours, services).
//   2. npx wrangler kv namespace create BOOKINGS   → paste the id into wrangler.toml
//   3. npx wrangler secret put ADMIN_TOKEN          → pick a long private token
//   4. npx wrangler deploy
//   5. (Optional) npx wrangler secret put RESEND_API_KEY  → email confirmations
//      + a scheduled 24-hour reminder via the cron trigger in wrangler.toml.
//      Without it, everything else still works — clients get the on-page
//      confirmation and the .ics file.
// Your booking page: https://<your-worker>.<your-subdomain>.workers.dev/
// Your admin panel:  same URL + /admin
// ═══════════════════════════════════════════════════════════════════════

const CONFIG = {
  brand: {
    name: "Sarah Mitchell Coaching",   // your business name
    tagline: "Coaching sessions that fit your week",
    logoText: "SM",                    // short monogram shown in the header
    accent: "#1D4ED8",                 // buttons + highlights
    deep: "#16243D",                   // header band
  },

  timezone: "America/Chicago",         // your business timezone (IANA name), e.g. "Europe/Berlin", "Asia/Bangkok"
  locale: "en-US",                     // date formatting on the page, e.g. "de-DE", "th-TH"

  leadTimeMinutes: 120,                // minimum notice: clients cannot book sooner than this
  maxDaysAhead: 21,                    // how far ahead the calendar shows open days
  slotIntervalMinutes: 30,             // start-time grid; service durations can be any length

  cancelPolicy:
    "Plans change — you can reschedule or cancel free of charge up to 24 hours before your session. " +
    "Later cancellations and no-shows may forfeit the deposit.",

  // Opening hours, 0 = Sunday … 6 = Saturday. null = closed. ["HH:MM","HH:MM"] = open window (your local time).
  hours: {
    0: null,
    1: ["09:00", "17:00"],
    2: ["09:00", "17:00"],
    3: ["09:00", "17:00"],
    4: ["09:00", "17:00"],
    5: ["09:00", "15:00"],
    6: ["10:00", "13:00"],
  },

  // The session types clients can pick. `minutes` is the session length,
  // `buffer` is quiet time you keep free afterwards.
  // `payLink` (optional): a Stripe/PayPal payment link shown on the confirmation
  // so clients can pay the deposit right after booking. Leave empty for none.
  services: [
    {
      id: "intro",
      name: "Intro call (30 min)",
      minutes: 30,
      buffer: 0,
      price: "Free",
      description: "A short call to see whether we are a fit.",
      payLink: "",
    },
    {
      id: "session",
      name: "1:1 coaching session (60 min)",
      minutes: 60,
      buffer: 10,
      price: "$180",
      description: "One focused session on the goal that matters most right now.",
      payLink: "",
    },
    {
      id: "checkin",
      name: "Package check-in (45 min)",
      minutes: 45,
      buffer: 10,
      price: "Package clients",
      description: "For clients with an active package — bring your current focus.",
      payLink: "",
    },
  ],

  // Every client-facing string lives here — translate freely, it is your page.
  strings: {
    pageTitle: "Book a session",
    heroTitle: "Pick a time that works for you",
    heroSub: "Choose a session, pick an open slot, and you are confirmed on the spot — add it to your calendar right from the confirmation.",
    chooseService: "1 · Choose a session",
    chooseTime: "2 · Pick a time",
    yourDetails: "3 · Your details",
    loading: "Loading open times…",
    noSlots: "No open times on this day.",
    name: "Your name",
    email: "Email",
    phone: "Phone (optional)",
    notes: "What would you like to work on? (optional)",
    confirm: "Confirm booking",
    policyTitle: "Cancellation policy",
    confirmedTitle: "You are booked",
    confirmedBody: "Booking reference",
    emailedBody: "A written confirmation is on its way to",
    addCalendar: "Add to calendar (.ics)",
    payNow: "Pay the deposit now",
    bookAnother: "Book another time",
    error: "That time was just taken or something looked off — please pick another slot and try again.",
    weekdays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
    footerNote: "Powered by the coach's own website — your data stays with your coach.",
  },
};
