/* ===== Mi Urbania · Seed / demo data (§17b) ===== */
window.MU = window.MU || {};
(function (MU) {
  // Demo unit handed over ~142 days before the demo "today" so the clock shows rich states.
  const UNITS = [
    {
      id: "25b",
      projectName: "Sky Parc",
      projectId: "skypark",
      towerOrPhase: "Torre Norte",
      floor: "Piso 25",
      model: "Modelo Vista B",
      unitNumber: "25B",
      areaM2: 118,
      parkingIds: ["E-214", "E-215"],
      storageId: "D-37",
      handoverDate: "2026-01-18",
      status: "delivered",
      heroImage: null,
      address: "Av. Balboa, Ciudad de Panamá",
      adminContact: "Administración Sky Parc · admin@skyparc.pa",
      components: [
        { type_es: "Pisos", type_en: "Floors", spec_es: "Porcelanato 60×60, beige", spec_en: 'Porcelain tile 24×24", beige', categoryId: "pisos" },
        { type_es: "Puertas", type_en: "Doors", spec_es: "Entamboradas, acabado blanco", spec_en: "Hollow-core, white finish", categoryId: "puertas" },
        { type_es: "Grifería", type_en: "Faucets", spec_es: "Línea monomando cromada", spec_en: "Single-lever chrome line", categoryId: "sanitarios" },
        { type_es: "Ventanas", type_en: "Windows", spec_es: "Aluminio + vidrio 6 mm", spec_en: "Aluminum + 6 mm glass", categoryId: "vidrios" },
        { type_es: "Cocina", type_en: "Kitchen", spec_es: "Gabinetes melamina + mesón cuarzo", spec_en: "Melamine cabinets + quartz top", categoryId: "carpinteria" },
        { type_es: "Climatización", type_en: "HVAC", spec_es: "Split inverter, 2 zonas", spec_en: "Inverter split, 2 zones", categoryId: "hvac" },
        { type_es: "Pintura", type_en: "Paint", spec_es: "Acabado mate, blanco hueso", spec_en: "Matte finish, bone white", categoryId: "pintura" },
      ],
    },
    {
      id: "casa14",
      projectName: "Paseo California",
      projectId: "paseo",
      towerOrPhase: "Fase 2",
      floor: "2 niveles",
      model: "Modelo Roble",
      unitNumber: "Casa 14",
      areaM2: 196,
      parkingIds: ["Propio ×2"],
      storageId: "—",
      handoverDate: "2026-11-15",
      status: "finishes",
      heroImage: null,
      address: "Costa Sur, Ciudad de Panamá",
      adminContact: "Ventas Paseo · ventas@paseo.pa",
      estHandover: "Noviembre 2026",
      components: [],
    },
  ];

  // Construction milestones for pre-delivery mode
  const MILESTONES = ["reserved", "contract", "construction", "finishes", "inspection", "ready", "delivered"];

  // Claims (frozen verdict at filing — by design, point-in-time)
  const CLAIMS = [
    {
      id: "URB-25B-0007", unitId: "25b", issueId: "crack-hairline", room: "sala",
      subloc: "Pared del comedor", createdAt: "2026-06-03T15:14:00",
      photos: 3, status: "received", isNewIssueType: false,
      verdict: { kind: "crack", categoryId: "aranitas", daysLeft: 98 },
      details_es: "Varias fisuras finas cerca de la ventana.", details_en: "Several fine cracks near the window.",
    },
    {
      id: "URB-25B-0006", unitId: "25b", issueId: "door-rub", room: "cuarto",
      subloc: "Puerta del cuarto máster", createdAt: "2026-05-19T09:40:00",
      photos: 2, status: "scheduled", scheduledFor: "2026-06-12", isNewIssueType: false,
      verdict: { kind: "active", categoryId: "puertas", daysLeft: 244 },
      details_es: "Roza el marco en la parte superior.", details_en: "Rubs the frame at the top.",
    },
    {
      id: "URB-25B-0005", unitId: "25b", issueId: "window-leak", room: "sala",
      subloc: "Ventanal de la sala", createdAt: "2026-05-27T18:02:00",
      photos: 4, status: "review", isNewIssueType: false,
      verdict: { kind: "active", categoryId: "vidrios", daysLeft: 236 },
      details_es: "Entra agua por la esquina cuando llueve fuerte.", details_en: "Water comes in at the corner in heavy rain.",
    },
    {
      id: "URB-25B-0004", unitId: "25b", issueId: "tile-loose", room: "cocina",
      subloc: "Frente al fregadero", createdAt: "2026-04-22T11:25:00",
      photos: 2, status: "resolved", resolvedAt: "2026-05-06", isNewIssueType: false,
      verdict: { kind: "active", categoryId: "pisos", daysLeft: 271 },
      details_es: "Baldosa suelta que suena hueca.", details_en: "Loose tile that sounds hollow.",
      hasResolution: true,
    },
    {
      id: "URB-25B-0003", unitId: "25b", issueId: "floor-scratch", room: "sala",
      subloc: "Centro de la sala", createdAt: "2026-03-30T16:10:00",
      photos: 1, status: "resolved", resolvedAt: "2026-04-10", isNewIssueType: false,
      // Frozen out-of-warranty verdict → demonstrates Garantía-as-a-Service path
      verdict: { kind: "expired", categoryId: "pisos", expiredOn: "2025-06-01", offeredService: true },
      details_es: "Rayón por mover un mueble. Resuelto como servicio.", details_en: "Scratch from moving furniture. Resolved as a service.",
    },
  ];

  const DOCUMENTS = [
    { id: "d1", title_es: "Manual de Entrega", title_en: "Handover Manual", type: "manual", date: "2026-01-18" },
    { id: "d2", title_es: "Acta de Entrega firmada", title_en: "Signed Handover Record", type: "acta", date: "2026-01-18" },
    { id: "d3", title_es: "Certificado de garantía — Estructura", title_en: "Warranty Certificate — Structural", type: "cert", date: "2026-01-18" },
    { id: "d4", title_es: "Certificado — Línea blanca (fabricante)", title_en: "Certificate — Appliances (manufacturer)", type: "cert", date: "2026-01-18" },
    { id: "d5", title_es: "Planos de mi unidad", title_en: "My Unit's Plans", type: "plan", date: "2025-11-02" },
    { id: "d6", title_es: "Manual del aire acondicionado", title_en: "Air Conditioning Manual", type: "manual", date: "2026-01-18" },
    { id: "d7", title_es: "Contrato", title_en: "Contract", type: "contract", date: "2024-08-14" },
  ];

  const NOTIFICATIONS = [
    {
      id: "n1", type: "crack", read: false, date: "2026-06-06", link: { tab: "report", crack: true },
      title_es: "Estás en el mejor momento para reportar fisuras",
      title_en: "Now is the best time to report cracks",
      body_es: "La ventana de fisuras (8 meses) cierra pronto. Repórtalas todas juntas.",
      body_en: "The 8-month crack window closes soon. Report them all at once.",
    },
    {
      id: "n2", type: "claim", read: false, date: "2026-06-04", link: { tab: "report", claim: "URB-25B-0006" },
      title_es: "Tu reporte #URB-25B-0006 fue programado",
      title_en: "Your report #URB-25B-0006 was scheduled",
      body_es: "Visita técnica el 12 de junio. Puerta del cuarto máster.",
      body_en: "Technician visit on June 12. Master bedroom door.",
    },
    {
      id: "n3", type: "expiry", read: false, date: "2026-06-01", link: { tab: "warranties", cat: "pintura" },
      title_es: "Tu garantía de pintura vence en 60 días",
      title_en: "Your paint warranty expires in 60 days",
      body_es: "Revisa paredes y techos antes del vencimiento.",
      body_en: "Check walls and ceilings before it expires.",
    },
    {
      id: "n4", type: "maintenance", read: true, date: "2026-05-20", link: { tab: "help", care: true },
      title_es: "Recordatorio: limpia los filtros del aire",
      title_en: "Reminder: clean your AC filters",
      body_es: "Cada 3 meses para mantener el equipo en garantía.",
      body_en: "Every 3 months to keep the unit under warranty.",
    },
    {
      id: "n5", type: "handover", read: true, date: "2026-01-18", link: { tab: "home" },
      title_es: "¡Tu hogar fue entregado! Tus garantías ya están activas",
      title_en: "Your home was delivered! Your warranties are now active",
      body_es: "Apartamento 25B, Sky Parc.",
      body_en: "Apartment 25B, Sky Parc.",
    },
  ];

  const CARE_ITEMS = [
    { id: "c1", atMonths: 3, done: true, every_es: "Cada 3 meses", every_en: "Every 3 months",
      title_es: "Limpia los filtros del aire acondicionado", title_en: "Clean the AC filters" },
    { id: "c2", atMonths: 6, done: false, every_es: "A los 6 meses", every_en: "At 6 months",
      title_es: "Revisa y limpia los desagües del balcón", title_en: "Check and clean the balcony drains" },
    { id: "c3", atMonths: 6, done: false, every_es: "A los 6 meses", every_en: "At 6 months",
      title_es: "Reporta las fisuras de asentamiento juntas", title_en: "Report settlement cracks together" },
    { id: "c4", atMonths: 1, done: true, every_es: "Cada mes", every_en: "Monthly",
      title_es: "Corre el agua de drenajes poco usados", title_en: "Run water through rarely-used drains" },
    { id: "c5", atMonths: 12, done: false, every_es: "Al año", every_en: "At 1 year",
      title_es: "Reaprieta herrajes de puertas y gabinetes", title_en: "Re-tighten door and cabinet hardware" },
  ];

  const PROTECT = [
    { do: true, es: "Reporta las fisuras dentro de la ventana de 8 meses.", en: "Report cracks within the 8-month window." },
    { do: false, es: "No perfores paredes impermeabilizadas (baños, balcón).", en: "Don't drill into waterproofed walls (baths, balcony)." },
    { do: true, es: "Mantén los drenajes despejados y límpialos seguido.", en: "Keep drains clear and clean them often." },
    { do: false, es: "No sobrecargues repisas ni barras de clóset.", en: "Don't overload shelves or closet rods." },
    { do: true, es: "Anota cualquier detalle en el acta el día de la entrega.", en: "Note any detail in the record on handover day." },
  ];

  const FAQ = [
    { q_es: "¿Qué cubre mi garantía?", q_en: "What does my warranty cover?",
      a_es: "Cada categoría tiene su propia cobertura y plazo, contados desde tu fecha de entrega. Revisa la pestaña Garantías para ver el detalle y lo que sí y no cubre cada una.",
      a_en: "Each category has its own coverage and term, counted from your handover date. Check the Warranties tab for the detail and what each one does and doesn't cover." },
    { q_es: "¿Cómo reporto un problema?", q_en: "How do I report a problem?",
      a_es: "Toca Reportar, elige o describe el problema, agrega una foto y listo. La fecha queda registrada y verás al instante si está en garantía.",
      a_en: "Tap Report, pick or describe the problem, add a photo, and you're done. The date is logged and you'll instantly see if it's under warranty." },
    { q_es: "¿Qué pasa después de reportar?", q_en: "What happens after I report?",
      a_es: "Tu reporte pasa por Recibido → En revisión → Programado → Resuelto. Te avisamos en cada paso.",
      a_en: "Your report moves through Received → In review → Scheduled → Resolved. We notify you at each step." },
    { q_es: "¿Qué no cubre la garantía?", q_en: "What does the warranty not cover?",
      a_es: "El desgaste normal, el mal uso, los daños por impacto después de la entrega y el trabajo de terceros. Cada categoría detalla sus exclusiones.",
      a_en: "Normal wear, misuse, impact damage after handover, and third-party work. Each category lists its exclusions." },
    { q_es: "¿Cómo cuido mi garantía?", q_en: "How do I protect my warranty?",
      a_es: "Sigue los recordatorios de cuidado, reporta a tiempo y evita perforar superficies impermeabilizadas. Lo encuentras en Mantenimiento y cuidado.",
      a_en: "Follow the care reminders, report on time, and avoid drilling into waterproofed surfaces. You'll find this under Maintenance & care." },
  ];

  const SERVICES = [
    { id: "s1", icon: "door", name_es: "Ajuste de puerta", name_en: "Door adjustment" },
    { id: "s2", icon: "lock", name_es: "Reemplazo de cerradura", name_en: "Lock replacement" },
    { id: "s3", icon: "grid", name_es: "Reasentar baldosa", name_en: "Tile re-set" },
    { id: "s4", icon: "roller", name_es: "Repintado", name_en: "Repaint" },
    { id: "s5", icon: "droplets", name_es: "Sellado y resane", name_en: "Sealant & patch" },
  ];

  const CONTACT = { name: "Leticia — Postventa", role_es: "Atención al propietario", role_en: "Owner care", phone: "+507 6000-0000" };

  MU.UNITS = UNITS;
  MU.MILESTONES = MILESTONES;
  MU.CLAIMS = CLAIMS;
  MU.DOCUMENTS = DOCUMENTS;
  MU.NOTIFICATIONS = NOTIFICATIONS;
  MU.CARE_ITEMS = CARE_ITEMS;
  MU.PROTECT = PROTECT;
  MU.FAQ = FAQ;
  MU.SERVICES = SERVICES;
  MU.CONTACT = CONTACT;
})(window.MU);
