// Sample seed data for ระบบจัดการ Order
// 3 platforms × หลายวัน

const PLATFORMS = {
  shopee: {
    id: 'shopee',
    name: 'Shopee',
    short: 'SP',
    dot: 'oklch(0.72 0.16 45)',     // muted orange
    tint: 'oklch(0.97 0.025 55)',
    prefix: 'SP'
  },
  tiktok: {
    id: 'tiktok',
    name: 'TikTok Shop',
    short: 'TT',
    dot: 'oklch(0.55 0.06 280)',    // muted ink-violet
    tint: 'oklch(0.96 0.012 280)',
    prefix: 'TT'
  },
  lazada: {
    id: 'lazada',
    name: 'Lazada',
    short: 'LZ',
    dot: 'oklch(0.58 0.12 250)',    // muted blue
    tint: 'oklch(0.96 0.018 250)',
    prefix: 'LZ'
  }
};

const NOTE_TAGS = [
  { id: 'taxinvoice', label: 'ขอใบกำกับภาษี', icon: '🧾', color: 'oklch(0.52 0.12 250)' },
];

// status: 'pending' | 'packed' | 'shipped'
const STATUSES = {
  pending:   { id: 'pending',   label: 'รอแพ็ค',     short: 'รอ',   color: 'oklch(0.55 0.02 70)' },
  packed:    { id: 'packed',    label: 'แพ็คเสร็จ',  short: 'แพ็ค', color: 'oklch(0.55 0.12 200)' },
  shipped:   { id: 'shipped',   label: 'ส่งออกแล้ว', short: 'ส่ง',  color: 'oklch(0.58 0.13 160)' },
  cancelled: { id: 'cancelled', label: 'ยกเลิก',     short: 'ยกเลิก', color: 'oklch(0.52 0.22 18)' },
};

const STATUS_FLOW = ['pending', 'packed', 'shipped'];

// helper
const d = (offset) => {
  const dt = new Date();
  dt.setDate(dt.getDate() + offset);
  return dt.toISOString().slice(0, 10);
};

const SEED_ORDERS = [
  // วันนี้
  { id: 'o1',  platform: 'shopee', code: '2405121001', date: d(0),  qty: 2, customer: 'คุณ ก.', status: 'pending', tags: [], note: 'ระวังจาน 6 ใบ ห่อบับเบิ้ลเยอะ ๆ', updated: Date.now() - 1000*60*12 },
  { id: 'o2',  platform: 'shopee', code: '2405121002', date: d(0),  qty: 1, customer: 'คุณ ข.', status: 'pending', tags: [], note: '', updated: Date.now() - 1000*60*30 },
  { id: 'o3',  platform: 'tiktok', code: '2405129931', date: d(0),  qty: 3, customer: 'คุณ ค.', status: 'pending', tags: ['taxinvoice'], note: 'ลูกค้าขอใบกำกับภาษี', updated: Date.now() - 1000*60*5 },
  { id: 'o4',  platform: 'tiktok', code: '2405129932', date: d(0),  qty: 1, customer: 'คุณ ง.', status: 'packed', tags: [], note: '', updated: Date.now() - 1000*60*60 },
  { id: 'o5',  platform: 'lazada', code: '2405120555', date: d(0),  qty: 2, customer: 'คุณ จ.', status: 'pending', tags: [], note: 'จัดเซ็ต A + ของแถมตัวอย่างน้ำหอม 2 ml', updated: Date.now() - 1000*60*20 },
  { id: 'o6',  platform: 'lazada', code: '2405120556', date: d(0),  qty: 4, customer: 'คุณ ฉ.', status: 'pending', tags: [], note: 'เช็คสีให้ตรงรูป (ลูกค้าทักมาย้ำ)', updated: Date.now() - 1000*60*45 },
  { id: 'o7',  platform: 'shopee', code: '2405121003', date: d(0),  qty: 1, customer: 'คุณ ช.', status: 'packed', tags: [], note: '', updated: Date.now() - 1000*60*90 },

  // เมื่อวาน — ส่วนใหญ่ส่งแล้ว แต่มีค้าง
  { id: 'o8',  platform: 'shopee', code: '2405111091', date: d(-1), qty: 1, customer: 'คุณ ซ.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*18 },
  { id: 'o9',  platform: 'shopee', code: '2405111092', date: d(-1), qty: 2, customer: 'คุณ ฌ.', status: 'packed', tags: [], note: 'ยังไม่ทันได้ยิงเลขพัสดุ — รอเช้าค่อยส่ง', updated: Date.now() - 1000*60*60*14 },
  { id: 'o10', platform: 'tiktok', code: '2405119921', date: d(-1), qty: 1, customer: 'คุณ ญ.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*20 },
  { id: 'o11', platform: 'tiktok', code: '2405119922', date: d(-1), qty: 5, customer: 'คุณ ฎ.', status: 'pending', tags: [], note: 'ค้างจากเมื่อวาน! ลูกค้าทักมาถามแล้ว', updated: Date.now() - 1000*60*60*22 },
  { id: 'o12', platform: 'lazada', code: '2405110541', date: d(-1), qty: 1, customer: 'คุณ ฏ.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*16 },
  { id: 'o13', platform: 'lazada', code: '2405110542', date: d(-1), qty: 2, customer: 'คุณ ฐ.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*15 },

  // 2 วันก่อน
  { id: 'o14', platform: 'shopee', code: '2405101071', date: d(-2), qty: 1, customer: 'คุณ ฑ.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*40 },
  { id: 'o15', platform: 'tiktok', code: '2405109912', date: d(-2), qty: 2, customer: 'คุณ ฒ.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*42 },
  { id: 'o16', platform: 'lazada', code: '2405100531', date: d(-2), qty: 3, customer: 'คุณ ณ.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*44 },
  { id: 'o17', platform: 'lazada', code: '2405100532', date: d(-2), qty: 1, customer: 'คุณ ด.', status: 'packed', tags: [], note: 'แช่เย็นไว้ ลูกค้าเลื่อนรับ → ส่งพรุ่งนี้', updated: Date.now() - 1000*60*60*36 },

  // 3 วันก่อน
  { id: 'o18', platform: 'shopee', code: '2405091051', date: d(-3), qty: 2, customer: 'คุณ ต.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*70 },
  { id: 'o19', platform: 'shopee', code: '2405091052', date: d(-3), qty: 1, customer: 'คุณ ถ.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*68 },
  { id: 'o20', platform: 'tiktok', code: '2405099902', date: d(-3), qty: 4, customer: 'คุณ ท.', status: 'shipped', tags: [], note: '', updated: Date.now() - 1000*60*60*72 },
];

Object.assign(window, { PLATFORMS, NOTE_TAGS, STATUSES, STATUS_FLOW, SEED_ORDERS });
