/* folds-data.jsx — v0.3 surface labels + data spine
   ============================================================
   SURFACE LABELS (visitor sees) — per session debrief A.1:
     01 Typology    02 Site    03 Operation    04 Story    05 Atmosphere

   Data spine (5W) lives internally and is never displayed.
     typology → WHAT
     site     → WHERE
     operation→ WHO + HOW (collapsed per A.8 — operator stack is one continuous layer)
     story    → WHY
     atmosphere → ATTN (now TWO parallel 28-word grids per Section B)

   FOLD SHAPE
     01 TYPOLOGY    — taxonomy tree (parent-child + standalone) × bracket × renovation flag
     02 SITE        — pin (lat/lng + addr) + site-type words + climate (derived) + land status
     03 OPERATION   — capacity (typology unit) + WHO groups + HOW model + AI/robotics layer
     04 STORY       — owner motivation chips + open why-field (3-10 sentences, brain-read)
     05 ATMOSPHERE  — Grid 1 Feeling (≤4) + Grid 2 Materiality (≤4)

   Plus reference tag (60 char) at top of configurator — quiet retrieval handle.
*/

/* Reference tag config — per session debrief A.5 */
const REFERENCE_TAG = {
  label: 'Reference (optional)',
  maxChars: 60,
  placeholder: 'Name this project',
};

/* ───────────── 02 SITE — site-type words ───────────── */
const SITE_TYPE = [
  { id:'urban-core',   label:'Urban Core' },
  { id:'urban-edge',   label:'Urban Edge' },
  { id:'waterfront',   label:'Waterfront' },
  { id:'coastal',      label:'Coastal' },
  { id:'island',       label:'Island' },
  { id:'mountain',     label:'Mountain' },
  { id:'desert',       label:'Desert' },
  { id:'forest',       label:'Forest' },
  { id:'farmland',     label:'Farmland' },
  { id:'vineyard',     label:'Vineyard' },
  { id:'historic-dst', label:'Historic District' },
  { id:'industrial-z', label:'Industrial Reuse' },
  { id:'rooftop',      label:'Rooftop' },
];

const LAND_STATUS = [
  { id:'have',         label:'Have site',     gloss:'Owned, optioned, or under contract.' },
  { id:'searching',    label:'Searching',     gloss:'Region known, parcel not yet identified.' },
  { id:'confidential', label:'Confidential',  gloss:"Won't disclose at this stage. Brain works at region resolution." },
];

/* Köppen-lite from latitude — refine with proper zone DB later. */
const climateFromLatLng = (lat, lng) => {
  if (lat == null || lng == null) return null;
  const a = Math.abs(lat);
  if (a < 23.5) return { code: 'tropical',    label: 'Tropical · humid · year-round warmth' };
  if (a < 35)   return { code: 'arid-warm',   label: 'Subtropical · seasonally hot, mild winters' };
  if (a < 50)   return { code: 'temperate',   label: 'Temperate · four seasons, moderate extremes' };
  if (a < 60)   return { code: 'continental', label: 'Continental · cold winters, warm summers' };
  return          { code: 'polar',       label: 'Polar · long winters, short summers' };
};

/* ───────────── 03 OPERATION — collapsed per A.8 ─────────────
   Three groups still live internally (guests / operators / ai+robotics)
   but presented under one fold heading "Operation". */
const WHO_GROUPS = [
  {
    id: 'guests',
    label: 'Guests',
    sub: 'The people you serve.',
    options: [
      { id:'solo-trav',    label:'Solo Travelers' },
      { id:'couples',      label:'Couples · Retreat' },
      { id:'families',     label:'Families' },
      { id:'biz-exec',     label:'Business · Executive' },
      { id:'creatives',    label:'Creatives · Residencies' },
      { id:'wellness-s',   label:'Wellness Seekers' },
      { id:'gastronomes',  label:'Gastronomes' },
      { id:'long-stay',    label:'Long-Stay · Members' },
      { id:'events',       label:'Events · Weddings' },
      { id:'eco-travel',   label:'Eco-Conscious' },
      { id:'gen-tour',     label:'Generational Tourism' },
      { id:'lux-conn',     label:'Luxury Connoisseurs' },
    ],
  },
  {
    id: 'operators',
    label: 'Human Operators',
    sub: 'Who runs the room, the kitchen, the floor.',
    options: [
      { id:'host-led',     label:'Host-Led · Family' },
      { id:'gm-team',      label:'GM + Team' },
      { id:'chef-led',     label:'Chef-Led' },
      { id:'brand-flag',   label:'Brand · Flag' },
      { id:'indie-coll',   label:'Indie Collective' },
      { id:'staff-resid',  label:'Resident Staff' },
      { id:'concierge',    label:'Concierge-First' },
      { id:'sommelier',    label:'Sommelier-Led' },
      { id:'community-mgr',label:'Community Manager' },
      { id:'security',     label:'Security · Privacy Lead' },
      { id:'maint-eng',    label:'Maintenance · Engineering' },
    ],
  },
  {
    id: 'ai_robotics',
    label: 'AI · Robotics',
    sub: 'Where the brain extends the team. The differentiator.',
    options: [
      { id:'agentic-conc', label:'Agentic Concierge' },
      { id:'agentic-rev',  label:'Agentic Revenue · Yield' },
      { id:'kitchen-robo', label:'Kitchen Robotics' },
      { id:'service-robo', label:'Service Robotics' },
      { id:'cleaning-robo',label:'Cleaning Robotics' },
      { id:'iot-mesh',     label:'IoT · Sensor Mesh' },
      { id:'ai-security',  label:'AI Security · Vision' },
      { id:'predictive-m', label:'Predictive Maintenance' },
      { id:'voice-assist', label:'Voice Assistant · In-Room' },
      { id:'energy-ai',    label:'Energy · Climate AI' },
      { id:'menu-ai',      label:'Menu · Inventory AI' },
      { id:'guest-data',   label:'Guest Data · Personalization' },
    ],
  },
];

/* Operating model toggles */
const HOW_MODEL = [
  { id:'year-round',   label:'Year-Round' },
  { id:'seasonal',     label:'Seasonal' },
  { id:'pop-up',       label:'Pop-Up · Limited Run' },
  { id:'membership',   label:'Membership · Members-First' },
  { id:'mixed-use',    label:'Mixed-Use · Programmed' },
  { id:'dayparts',     label:'Strong Dayparts' },
  { id:'24-7',         label:'24/7' },
  { id:'closed-mon',   label:'Closed Mondays · Tradition' },
];

/* ───────────── 04 STORY — owner motivation chips ───────────── */
const STORY_WORDS = [
  { id:'pay-back',     label:'Pay Back' },
  { id:'legacy',       label:'Legacy Asset' },
  { id:'cash-flow',    label:'Cash Flow' },
  { id:'brand-anchor', label:'Brand Anchor' },
  { id:'community',    label:'Community Anchor' },
  { id:'climate',      label:'Climate-Resilient' },
  { id:'cult-revive',  label:'Cultural Revival' },
  { id:'land-stew',    label:'Land Stewardship' },
  { id:'lifestyle',    label:'Lifestyle Statement' },
  { id:'portfolio',    label:'Portfolio Diversification' },
  { id:'mission',      label:'Mission-Driven' },
  { id:'flagship',     label:'Flagship · Showcase' },
];

/* The why-field is the only one the brain reads in full. */
const STORY_FIELD = {
  prompt: 'The moment that made this real.',
  hint: 'The Brain reads this once and builds the story of your brief from it.',
  maxChars: 800,
};

/* ───────────── 05 ATMOSPHERE — two parallel grids ─────────────
   Word lists live in data/grids.jsx (GRID_FEELING, GRID_MATERIALITY).
   Each grid: 1–4 selections.
*/

/* ───────────── FOLD MAP — surface labels + internal kind ───────────── */
const FOLDS = [
  { id:'typology', num:'01', kind:'typology', surface:'Typology',
    q:'Define the venue signal.',
    sub:"Pick one. Add a second if it's a two-part concept." },
  { id:'site',     num:'02', kind:'where', surface:'Site',
    q:'Every concept lands somewhere.',
    sub:"Drop a pin on the site. No site yet? Choose Searching or Confidential." },
  { id:'operation',num:'03', kind:'operation', surface:'Operation',
    q:'How does it run, and who runs it?',
    sub:"Set the size, the rhythm and the people who run it." },
  { id:'story',    num:'04', kind:'story', surface:'Story',
    q:'What made this worth building?',
    sub:"Pick the reasons behind it, then write the spark in your own words.", words: STORY_WORDS },
  { id:'atmosphere', num:'05', kind:'atmosphere', surface:'Atmosphere',
    q:'Give the room a soul and a skin.',
    sub:"Left is the soul: how the room feels. Right is the skin: what it is made of. Up to four each." },
];

Object.assign(window, {
  REFERENCE_TAG,
  SITE_TYPE, LAND_STATUS, climateFromLatLng,
  WHO_GROUPS, HOW_MODEL,
  STORY_WORDS, STORY_FIELD,
  FOLDS,
});
