// ────────────────────────────────────────────────────────────────────
// AW-018 · Monthly Settlement Summary — data
// ────────────────────────────────────────────────────────────────────

// B2C rows (partner-level monthly aggregates)
const B2C_ROWS = [
  { partner: 'Seoul Premier Medical Center', cat: 'Medical',  fuCount: 142, fuAmount: 184600,  exCount: 12, exAmount: 14400, rvCount: 2, rvAmount: -640,  pct: 100, payout: 184600 - 640, rvDetails: [
      { id: 'IVH-2026-A0481209', status: 'GRACE_PERIOD', amount: -320, dday: 4, note: '소비자 환불 요청 — 미사용 잔액' },
      { id: 'IVH-2026-A0481344', status: 'CONFIRMED',    amount: -320, dday: -2, note: '유예 만료 후 정산 차감' },
    ]},
  { partner: 'Tokyo Aesthetic Clinic',       cat: 'Aesthetic', fuCount: 118, fuAmount: 156400, exCount:  8, exAmount:  9600, rvCount: 0, rvAmount:    0,  pct: 100, payout: 156400, rvDetails: [] },
  { partner: 'Osaka Stay Collection',        cat: 'Accommodation', fuCount: 96, fuAmount: 122400, exCount: 22, exAmount: 17600, rvCount: 4, rvAmount: -1280, pct: 100, payout: 122400 + 17600 * 0.30 - 1280, rvDetails: [
      { id: 'IVH-2026-A0480112', status: 'DISPUTED',     amount: -640, dday: null, note: '소비자 이의 제기 — DSP-2026-0048' },
      { id: 'IVH-2026-A0480245', status: 'GRACE_PERIOD', amount: -320, dday: 6, note: '체크인 무산 — 환불 요청' },
      { id: 'IVH-2026-A0480398', status: 'WITHDRAWN',    amount: -320, dday: null, note: '소비자 철회 — 정상 사용 처리' },
      { id: 'IVH-2026-A0480501', status: 'GRACE_PERIOD', amount: -320, dday: 2, note: '시설 이용 불가 — 부분 환불' },
    ], expirePct: 30 },
  { partner: 'Kyoto Heritage Spa',           cat: 'Aesthetic', fuCount:  72, fuAmount:  93600, exCount:  6, exAmount:  4200, rvCount: 0, rvAmount:    0,  pct: 100, payout: 93600 + 4200 * 0.50, rvDetails: [], expirePct: 50 },
  { partner: 'Jeju Healing Resort',          cat: 'Accommodation', fuCount: 54, fuAmount:  72900, exCount: 14, exAmount:  9800, rvCount: 1, rvAmount:  -180,  pct: 100, payout: 72900 + 9800 * 0.30 - 180, rvDetails: [
      { id: 'IVH-2026-A0480789', status: 'CONFIRMED', amount: -180, dday: -5, note: '예약 노쇼 — 환불 확정' },
    ], expirePct: 30 },
  { partner: 'ICN Transfer Co.',             cat: 'Mobility',  fuCount:  44, fuAmount:  17600, exCount:  3, exAmount:   900, rvCount: 0, rvAmount:    0,  pct: 100, payout: 17600, rvDetails: [] },
  { partner: 'Seoul Gourmet Giftbox',        cat: 'Giftbox',   fuCount:  38, fuAmount:  14820, exCount:  2, exAmount:   780, rvCount: 0, rvAmount:    0,  pct: 100, payout: 14820, rvDetails: [] },
];

const B2B_ROWS = [
  { company: 'Hyundai Welfare Inc.',     contract: 'CTR-2025-HD-0014', issued: 320, fuCount: 286, fuAmount: 71500, exCount: 18, exAmount: 4500, rvCount: 0, rvAmount: 0,    pct: 100, payout: 71500, notified: true,  rvDetails: [] },
  { company: 'Samsung Travel Card',      contract: 'CTR-2025-SS-0007', issued: 280, fuCount: 244, fuAmount: 61000, exCount: 24, exAmount: 6000, rvCount: 2, rvAmount: -500, pct: 100, payout: 61000 - 500, notified: false, rvDetails: [
      { id: 'IVH-2026-A0470012', status: 'GRACE_PERIOD', amount: -250, dday: 3, note: '직원 퇴사 — 미사용 환수' },
      { id: 'IVH-2026-A0470088', status: 'CONFIRMED',    amount: -250, dday: -1, note: '계약 해지 사유' },
    ]},
  { company: 'LG U+ Employee Benefits',  contract: 'CTR-2025-LG-0021', issued: 180, fuCount: 162, fuAmount: 40500, exCount: 12, exAmount: 3000, rvCount: 0, rvAmount: 0,    pct: 100, payout: 40500, notified: true,  rvDetails: [] },
  { company: 'Kakao Inc. HR Voucher',    contract: 'CTR-2025-KK-0033', issued: 140, fuCount: 122, fuAmount: 30500, exCount:  8, exAmount: 2000, rvCount: 1, rvAmount: -250, pct: 100, payout: 30500 - 250, notified: false, rvDetails: [
      { id: 'IVH-2026-A0470301', status: 'DISPUTED', amount: -250, dday: null, note: '기업 이의 제기 — DSP-2026-0051' },
    ]},
  { company: 'Naver D2 Welfare Pool',    contract: 'CTR-2025-NV-0019', issued: 120, fuCount: 108, fuAmount: 27000, exCount:  6, exAmount: 1500, rvCount: 0, rvAmount: 0,    pct: 100, payout: 27000, notified: true,  rvDetails: [] },
];

const fmtUsd = v => {
  const sign = v < 0 ? '-' : '';
  const abs = Math.abs(v);
  return `${sign}USD ${abs.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
};

const RV_STATUS = {
  GRACE_PERIOD: { label: '유예 중',     color: '#D97706', bg: '#FFFBEB', border: '#FDE68A' },
  CONFIRMED:    { label: '확정',        color: '#DC2626', bg: '#FEF2F2', border: '#FCA5A5' },
  DISPUTED:     { label: '이의 제기',   color: '#7C3AED', bg: '#F5F3FF', border: '#DDD6FE' },
  WITHDRAWN:    { label: '철회',        color: '#6B7280', bg: '#F3F4F6', border: '#D1D5DB' },
};

Object.assign(window, { B2C_ROWS, B2B_ROWS, fmtUsd, RV_STATUS });
