/* global window */
// Mock data for Ruticomidas frontend prototype.

const MEAL_SLOTS = [
  { id: 'desayuno', label: 'Desayuno' },
  { id: 'comida', label: 'Comida' },
  { id: 'merienda', label: 'Merienda' },
  { id: 'cena', label: 'Cena' },
];

const DAYS = [
  { dow: 'Lun', dom: 12, today: false },
  { dow: 'Mar', dom: 13, today: false },
  { dow: 'Mié', dom: 14, today: true },
  { dow: 'Jue', dom: 15, today: false },
  { dow: 'Vie', dom: 16, today: false },
  { dow: 'Sáb', dom: 17, today: false },
  { dow: 'Dom', dom: 18, today: false },
];

// 7 days × 5 slots. null = empty.
// Filled cell: { title, raciones, loose?: [{name, qty, unit}], notConsumed? }
const PLANNING = [
  // Lun
  [
    { title: 'Avena + plátano', raciones: 2 },
    { title: 'Lentejas con verdura', raciones: 2, loose: [{ name: 'Pan', qty: 1, unit: 'ud' }] },
    { title: 'Yogur + nueces', raciones: 2 },
    { title: 'Tortilla francesa', raciones: 1 },
    { title: 'Ensalada césar', raciones: 1 },
  ],
  // Mar
  [
    { title: 'Tostada aguacate', raciones: 2 },
    { title: 'Pasta al pesto', raciones: 2 },
    null,
    { title: 'Sándwich pavo', raciones: 1 },
    { title: 'Sopa miso + arroz', raciones: 1 },
  ],
  // Mié (today)
  [
    { title: 'Café + tostada', raciones: 2, notConsumed: true },
    { title: 'Arroz con pollo', raciones: 2, loose: [{ name: 'Aguacate', qty: 1, unit: 'ud' }] },
    { title: 'Manzana + queso', raciones: 2 },
    { title: 'Crema calabaza', raciones: 1 },
    { title: 'Pizza margarita', raciones: 1 },
  ],
  // Jue
  [
    { title: 'Smoothie verde', raciones: 2 },
    { title: 'Garbanzos curry', raciones: 2 },
    null,
    null,
    { title: 'Wok verduras tofu', raciones: 1 },
  ],
  // Vie
  [
    { title: 'Tortitas avena', raciones: 2 },
    { title: 'Hamburguesa caseras', raciones: 2 },
    { title: 'Hummus + crudités', raciones: 2, loose: [{ name: 'Yogur griego', qty: 2, unit: 'ud' }] },
    { title: 'Quesadilla', raciones: 1 },
    { title: 'Pad thai', raciones: 1 },
  ],
  // Sáb
  [
    null,
    { title: 'Paella mixta', raciones: 4 },
    { title: 'Café + bizcocho', raciones: 2, loose: [{ name: 'Pan rústico', qty: 1, unit: '400 g' }] },
    { title: 'Tabla quesos', raciones: 2 },
    null,
  ],
  // Dom
  [
    { title: 'Brunch huevos', raciones: 2 },
    { title: 'Asado de domingo', raciones: 4 },
    null,
    { title: 'Sobras + ensalada', raciones: 2 },
    { title: 'Sobras + ensalada', raciones: 2 },
  ],
];

const RECIPES = [
  { id: 1, name: 'Lentejas con verdura de la abuela', kinds: ['Comida'], cost: 4.20, costReal: 4.05, public: true, tone: 'mint', feature: true },
  { id: 2, name: 'Pasta al pesto rápida', kinds: ['Comida', 'Cena'], cost: 3.80, costReal: 3.62, public: false, tone: 'yellow' },
  { id: 3, name: 'Arroz con pollo', kinds: ['Comida'], cost: 5.10, costReal: 4.95, public: false, tone: 'pink' },
  { id: 4, name: 'Wok de verduras y tofu', kinds: ['Cena'], cost: 4.40, costReal: 4.30, public: false, tone: 'purple' },
  { id: 5, name: 'Pizza margarita casera', kinds: ['Cena'], cost: 3.20, costReal: 2.98, public: true, tone: 'orange' },
  { id: 6, name: 'Crema de calabaza asada', kinds: ['Comida', 'Cena'], cost: 2.60, costReal: 2.45, public: false, tone: 'orange' },
  { id: 7, name: 'Garbanzos al curry', kinds: ['Comida'], cost: 3.10, costReal: 2.94, public: false, tone: 'yellow' },
  { id: 8, name: 'Tortitas de avena con plátano', kinds: ['Desayuno'], cost: 1.80, costReal: 1.65, public: true, tone: 'mint' },
  { id: 9, name: 'Hamburguesas caseras', kinds: ['Cena'], cost: 6.40, costReal: 6.10, public: false, tone: 'orange' },
  { id: 10, name: 'Pad thai vegetariano', kinds: ['Cena'], cost: 5.20, costReal: 5.02, public: false, tone: 'pink' },
];

const SHOPPING = [
  {
    market: 'Mercadona',
    color: 'mint',
    items: [
      { name: 'Lentejas pardinas 500g', qty: '1 envase', price: 1.45, last: '03 may', checked: false },
      { name: 'Cebolla', qty: '2 ud · variable', price: 0.86, last: '11 may', checked: false },
      { name: 'Zanahoria', qty: '1 bolsa', price: 1.20, last: '11 may', checked: true },
      { name: 'Aceite de oliva virgen', qty: '1 L', price: 7.85, last: '28 abr', checked: false },
      { name: 'Huevos camperos', qty: '1 docena', price: 2.95, last: '11 may', checked: false },
      { name: 'Yogur natural pack 4', qty: '1 pack', price: 1.50, last: '11 may', checked: true },
    ],
  },
  {
    market: 'Lidl',
    color: 'yellow',
    items: [
      { name: 'Tomate triturado', qty: '2 botes', price: 0.79, last: '06 may', checked: false },
      { name: 'Pasta penne', qty: '1 paquete', price: 0.95, last: '06 may', checked: false },
      { name: 'Tofu firme', qty: '1 ud', price: 1.65, last: '06 may', checked: false },
    ],
  },
  {
    market: 'Carrefour',
    color: 'orange',
    items: [
      { name: 'Atún en lata pack 3', qty: '1 pack', price: 2.20, last: '24 abr', checked: false },
      { name: 'Salsa soja kikkoman', qty: '1 botella', price: 3.45, last: '12 abr', checked: false },
    ],
  },
];

const SUGGESTIONS_READY = [
  { name: 'Lentejas con verdura', missing: 0, ingredients: 9, cost: 4.20, tone: 'mint' },
  { name: 'Tortilla francesa', missing: 0, ingredients: 4, cost: 1.10, tone: 'yellow' },
  { name: 'Pasta al pesto rápida', missing: 0, ingredients: 6, cost: 3.80, tone: 'pink' },
  { name: 'Crema de calabaza asada', missing: 0, ingredients: 7, cost: 2.60, tone: 'orange' },
];

const SUGGESTIONS_ALMOST = [
  { name: 'Pad thai vegetariano', missing: 2, missingItems: ['Cacahuetes', 'Tamarindo'], ingredients: 11, cost: 5.20, tone: 'purple' },
  { name: 'Hummus de remolacha', missing: 1, missingItems: ['Tahini'], ingredients: 6, cost: 2.40, tone: 'mint' },
  { name: 'Pizza margarita', missing: 1, missingItems: ['Mozzarella fresca'], ingredients: 7, cost: 3.20, tone: 'yellow' },
];

const EXPENSE_KPIS = {
  totalMonth: 1248.55,
  budget: 1400,
  vsLast: -8.2,
  topCategory: 'Supermercado',
  topCategoryAmount: 482.10,
  topPlace: 'Mercadona',
  ticketAvg: 38.45,
  ticketsCount: 23,
};

const BUDGETS = [
  { cat: 'Supermercado', icon: '⌗', color: '#3cffd0', spent: 482.10, limit: 550, badge: 'A', pct: 87 },
  { cat: 'Restauración', icon: '◆', color: '#5200ff', spent: 218.40, limit: 220, badge: 'B', pct: 99 },
  { cat: 'Transporte', icon: '▶', color: '#f3e600', spent: 96.30, limit: 150, badge: 'C', pct: 64 },
  { cat: 'Hogar', icon: '◧', color: '#ff7ad9', spent: 312.50, limit: 280, badge: 'D', pct: 112, over: true },
  { cat: 'Ocio', icon: '✦', color: '#ff6a1a', spent: 88.25, limit: 120, badge: 'E', pct: 73 },
  { cat: 'Salud', icon: '+', color: '#2864ff', spent: 51.00, limit: 80, badge: 'F', pct: 64 },
];

const WEEK_BARS = [
  { lbl: 'S1', v: 240, max: 400, c: 'mint' },
  { lbl: 'S2', v: 312, max: 400, c: 'mint' },
  { lbl: 'S3', v: 388, max: 400, c: 'ultra' },
  { lbl: 'S4', v: 308, max: 400, c: 'mint' },
];

const PAYMENT_SPLIT = [
  { lbl: 'Tarjeta', v: 68, c: '#3cffd0' },
  { lbl: 'Efectivo', v: 32, c: '#5200ff' },
];

const TOP_PLACES = [
  { name: 'Mercadona', v: 312.40 },
  { name: 'Lidl', v: 142.80 },
  { name: 'Bar Pepe', v: 98.20 },
  { name: 'Carrefour', v: 86.50 },
  { name: 'Farmacia', v: 51.00 },
];

const QUEUE = [
  { id: 'q-031', supermarket: 'Mercadona', date: '12 may · 19:42', total: 47.85, status: 'pending', items: 14, tone: 'mint' },
  { id: 'q-030', supermarket: 'Lidl', date: '11 may · 11:08', total: 23.40, status: 'pending', items: 8, tone: 'yellow' },
  { id: 'q-029', supermarket: 'Mercadona', date: '06 may · 20:11', total: 62.10, status: 'processing', items: 18, tone: 'pink' },
  { id: 'q-028', supermarket: 'Carrefour', date: '03 may · 18:34', total: 41.20, status: 'done', items: 12, tone: 'orange' },
  { id: 'q-027', supermarket: 'Mercadona', date: '28 abr · 13:02', total: 58.95, status: 'error', items: 0, tone: 'purple' },
];

const TOP_PRODUCTS = [
  { name: 'Plátano canario', freq: 18, avg: 1.85, unit: '€/kg' },
  { name: 'Aceite oliva virgen extra', freq: 12, avg: 7.40, unit: '€/L' },
  { name: 'Huevos camperos M', freq: 11, avg: 2.95, unit: '€/doc' },
  { name: 'Pan integral 500g', freq: 10, avg: 1.65, unit: '€/ud' },
  { name: 'Tomate pera', freq: 9, avg: 2.10, unit: '€/kg' },
];

const NAV = [
  {
    group: 'Comidas',
    items: [
      { id: 'planning', label: 'Planning' },
      { id: 'recetas', label: 'Recetas' },
      { id: 'compra', label: 'Compra' },
      { id: 'sugerencias', label: 'Sugerencias' },
      { id: 'plantilla', label: 'Plantilla' },
      { id: 'articulos', label: 'Artículos' },
    ],
  },
  {
    group: 'Gastos',
    items: [
      { id: 'gastos', label: 'Resumen' },
      { id: 'entradas', label: 'Entradas' },
      { id: 'meses', label: 'Meses' },
      { id: 'tickets', label: 'Tickets' },
    ],
  },
  {
    group: 'Config',
    items: [
      { id: 'aliases', label: 'Aliases' },
      { id: 'categorias', label: 'Categorías' },
      { id: 'lugares', label: 'Lugares' },
      { id: 'cuentaspago', label: 'Cuentas de pago' },
      { id: 'unidades', label: 'Unidades' },
    ],
  },
  {
    group: 'Admin',
    admin: true,
    items: [
      { id: 'dashboard', label: 'Dashboard' },
      { id: 'invites',   label: 'Invitaciones' },
    ],
  },
];

window.RC_DATA = {
  MEAL_SLOTS, DAYS, PLANNING, RECIPES, SHOPPING,
  SUGGESTIONS_READY, SUGGESTIONS_ALMOST,
  EXPENSE_KPIS, BUDGETS, WEEK_BARS, PAYMENT_SPLIT, TOP_PLACES,
  QUEUE, TOP_PRODUCTS, NAV,
};
