// T2 Falcon Admin — Templates seed data

// Avatar palette for user chips
const AVATAR_BG = ['#0d3f44', '#15803d', '#a16207', '#7c3aed', '#0369a1', '#be185d', '#475569'];
const avatarColor = (s) => AVATAR_BG[Math.abs((s || '').split('').reduce((a, c) => a + c.charCodeAt(0), 0)) % AVATAR_BG.length];

// Templates list (matches reference exactly)
const seedTemplates = [
  {
    id: '12',
    name: 'Welcome Message',
    channel: 'WhatsApp',
    serviceType: 'Marketing',
    referenceId: '123',
    wabaAccount: 'Aramco WABA Main',
    checker1: { name: 'Taha', status: 'approved' },
    checker2: { name: 'Dina', status: 'approved' },
    creationDate: '27/03/2025',
    creationTime: '02:42 pm',
    sharedWith: ['Lian Ali', 'Sara Ahmad', 'Omar Hassan'],
    sharedWithCount: 2,
    createdBy: 'Samer',
    statusByMeta: 'Active Quality Pending',
    metaQuality: 'pending',
    status: 'approved',
    language: 'English',
    subCategory: 'Default',
    body: 'Welcome to our service! We are excited to have you on board.',
    title: 'Welcome',
    previewKind: 'feedback',
  },
  {
    id: '14',
    name: 'OTP Verification',
    channel: 'WhatsApp',
    serviceType: 'Utility',
    referenceId: '123',
    wabaAccount: 'Aramco WABA Secondary',
    checker1: { name: 'Osama', status: 'approved' },
    checker2: { name: 'Taha', status: 'approved' },
    creationDate: '27/03/2025',
    creationTime: '02:42 pm',
    sharedWith: ['Sara Ahmad'],
    sharedWithCount: 0,
    createdBy: 'Husam',
    statusByMeta: 'In-Review',
    status: 'pending',
    language: 'English',
    subCategory: 'OTP',
    body: '123456 is your verification code. For your security, do not share this code.',
    previewKind: 'otp',
  },
  {
    id: '65',
    name: 'Flash Sale Notification',
    channel: 'WhatsApp',
    serviceType: 'Authentication',
    referenceId: '123',
    wabaAccount: 'Falcon Demo WABA',
    checker1: { name: 'Faris', status: 'approved' },
    checker2: { name: 'Jawad', status: 'approved' },
    creationDate: '27/03/2025',
    creationTime: '02:42 pm',
    sharedWith: ['Salah', 'Omar', 'Lina'],
    sharedWithCount: 1,
    createdBy: 'Jameel',
    statusByMeta: 'Rejected',
    status: 'rejected',
    language: 'English',
    subCategory: 'Default',
    body: 'Hi {{1}}, our flash sale is live! 50% off on selected items. Hurry — offer ends today!',
    previewKind: 'shop',
    metaRejected: true,
  },
  {
    // Internally-rejected WhatsApp template (rejected by a Checker, never sent to Meta)
    // → the ONLY state where "Edit" is offered. Carries the full create payload so the
    // single-page Edit screen pre-fills every field.
    id: '30',
    name: 'Marketing Campaign',
    channel: 'WhatsApp',
    serviceType: 'Marketing',
    referenceId: '124',
    wabaAccount: 'Aramco WABA Main',
    checker1: { name: 'Faris', status: 'rejected', reason: 'Offer end date is missing from the message body.' },
    checker2: null,
    creationDate: '27/03/2025',
    creationTime: '11:48 am',
    sharedWith: ['Lian Ali', 'Sara Ahmad', 'Omar Hassan', 'Salah', 'Mona', 'Layla'],
    sharedWithCount: 9,
    createdBy: 'Taha',
    statusByMeta: 'NA',
    status: 'rejected',
    language: 'English',
    subCategory: 'Flows',
    variableType: 'Name',
    header: 'Marketing Campaign',
    body: "Hi {{FirstName}} {{LastName}},\nWe've got something special just for you! 🎁\nEnjoy {{OfferDetails}} on all cosmetic products for a limited time.\nHurry—offer ends on {{EndDate}}!",
    footer: '',
    samples: { '{{FirstName}}': 'Mohammad', '{{LastName}}': 'Taha', '{{OfferDetails}}': '50%', '{{EndDate}}': '' },
    flow: { type: 'existing', source: 'existing', name: 'Message templates-library123', buttonText: 'View Flow', icon: 'default', startsWith: 'predefined', startScreen: 'help' },
    buttons: [],
    title: 'Marketing Campaign',
    previewKind: 'flow',
  },
  {
    id: '11',
    name: 'Template Test',
    channel: 'WhatsApp',
    serviceType: 'Marketing',
    referenceId: '123',
    wabaAccount: 'Aramco WABA Main',
    checker1: { name: '---', status: 'pending' },
    checker2: { name: '---', status: 'pending' },
    creationDate: '27/03/2025',
    creationTime: '02:42 pm',
    sharedWith: ['Faris Ibrahim', 'Layla'],
    sharedWithCount: 1,
    createdBy: 'Dina',
    statusByMeta: '---',
    status: 'pending',
    language: 'Arabic',
    subCategory: 'Default',
    body: 'Hi {{FirstName}}, this is a marketing message tailored just for you.',
    previewKind: 'signup',
  },
  {
    id: '10',
    name: 'Template Test2',
    channel: 'IVR Voice',
    serviceType: 'Static',
    referenceId: '123',
    checker1: { name: 'Faris', status: 'rejected', reason: 'Voice recording is unclear — please re-record before resubmitting.' },
    checker2: null,
    creationDate: '27/03/2025',
    creationTime: '02:42 pm',
    sharedWith: ['Salah', 'Mona'],
    sharedWithCount: 1,
    createdBy: 'Ali',
    statusByMeta: 'NA',
    status: 'rejected',
    language: 'English',
    subCategory: 'Default',
    body: 'This is a voice message template for routine notifications.',
    previewKind: 'ivr',
    ivr: {
      type: 'static',
      nodes: [
        { id: 'n_root', parent: null, key: null, label: 'Routine Notification', segments: [{ kind: 'recording', name: 'routine-notification.wav', dur: 9 }], terminal: null },
        { id: 'n_repeat', parent: 'n_root', key: '1', label: 'Repeat Message', segments: [{ kind: 'recording', name: 'routine-notification.wav', dur: 9 }], terminal: { type: 'return_root' } },
      ],
      variables: [],
    },
  },
  {
    id: '13',
    name: 'Template Test3',
    channel: 'WhatsApp',
    serviceType: 'Marketing',
    referenceId: '1234',
    wabaAccount: 'Aramco WABA Secondary',
    checker1: { name: 'Faris', status: 'approved' },
    checker2: { name: 'Dian', status: 'approved' },
    creationDate: '27/03/2025',
    creationTime: '02:42 pm',
    sharedWith: ['Sara', 'Omar'],
    sharedWithCount: 1,
    createdBy: 'Taha',
    statusByMeta: 'Active Quality Pending',
    metaQuality: 'pending',
    status: 'deleted',
    language: 'English',
    subCategory: 'Default',
    body: 'Marketing message — Template Test3.',
    previewKind: 'feedback',
  },
  {
    id: '19',
    name: 'Template Test4',
    channel: 'WhatsApp',
    serviceType: 'Marketing',
    referenceId: '1234',
    wabaAccount: 'Falcon Demo WABA',
    checker1: null,
    checker2: null,
    creationDate: '27/03/2025',
    creationTime: '02:42 pm',
    sharedWith: ['Sara', 'Lina'],
    sharedWithCount: 1,
    createdBy: 'Ali',
    statusByMeta: 'In-Review',
    status: 'pending',
    language: 'English',
    subCategory: 'Default',
    body: 'Marketing message — Template Test4.',
    previewKind: 'feedback',
  },
  {
    id: '20',
    name: 'Template Test5',
    channel: 'WhatsApp',
    serviceType: 'Marketing',
    referenceId: '1234',
    wabaAccount: 'Aramco WABA Main',
    checker1: { name: 'Osama', status: 'approved' },
    checker2: { name: 'Dina', status: 'approved' },
    creationDate: '27/03/2025',
    creationTime: '02:42 pm',
    sharedWith: ['Sara', 'Mona'],
    sharedWithCount: 1,
    createdBy: 'Taha',
    statusByMeta: 'Active Quality Pending',
    metaQuality: 'pending',
    status: 'approved',
    language: 'English',
    subCategory: 'Default',
    body: 'Marketing message — Template Test5.',
    previewKind: 'feedback',
  },
  // ---- IVR Voice seed templates — KSA real-world scenarios (static + dynamic) ----
  {
    id: '21',
    name: 'Al-Rajhi Bank — Phone Banking',
    channel: 'IVR Voice',
    serviceType: 'Static',
    referenceId: 'IVR-RAJHI-01',
    wabaAccount: 'N/A',
    checker1: { name: 'Taha', status: 'approved' },
    checker2: { name: 'Dina', status: 'approved' },
    creationDate: '14/04/2026',
    creationTime: '10:18 am',
    sharedWith: ['Lian Ali', 'Sara Ahmad'],
    sharedWithCount: 1,
    createdBy: 'Samer',
    statusByMeta: 'NA',
    status: 'approved',
    language: 'Arabic',
    subCategory: 'Default',
    body: 'Al Rajhi Bank phone-banking main menu — accounts, cards, transfers and customer service.',
    previewKind: 'ivr',
    ivr: {
      type: 'static',
      nodes: [
        { id: 'n_root', parent: null, key: null, label: 'Welcome — Al Rajhi Bank', segments: [{ kind: 'recording', name: 'alrajhi-welcome-ar.wav', dur: 7 }], terminal: null },
        { id: 'n_acct', parent: 'n_root', key: '1', label: 'Account Services', segments: [{ kind: 'recording', name: 'accounts-menu-ar.wav', dur: 6 }], terminal: null },
        { id: 'n_bal', parent: 'n_acct', key: '1', label: 'Account Balance', segments: [{ kind: 'recording', name: 'balance-ar.wav', dur: 5 }], terminal: { type: 'return_parent' } },
        { id: 'n_stmt', parent: 'n_acct', key: '2', label: 'Mini Statement', segments: [{ kind: 'recording', name: 'statement-ar.wav', dur: 5 }], terminal: { type: 'return_parent' } },
        { id: 'n_cards', parent: 'n_root', key: '2', label: 'Card Services', segments: [{ kind: 'recording', name: 'cards-menu-ar.wav', dur: 6 }], terminal: null },
        { id: 'n_block', parent: 'n_cards', key: '1', label: 'Block / Report a Card', segments: [{ kind: 'recording', name: 'block-card-ar.wav', dur: 6 }], terminal: { type: 'return_root' } },
        { id: 'n_transfers', parent: 'n_root', key: '3', label: 'Transfers', segments: [{ kind: 'recording', name: 'transfers-ar.wav', dur: 5 }], terminal: { type: 'return_parent' } },
        { id: 'n_agent', parent: 'n_root', key: '0', label: 'Customer Service', segments: [{ kind: 'recording', name: 'agent-ar.wav', dur: 4 }], terminal: { type: 'transfer' } },
      ],
      variables: [],
    },
  },
  {
    id: '22',
    name: 'STC — Outstanding Bill Read-back',
    channel: 'IVR Voice',
    serviceType: 'Dynamic',
    referenceId: 'IVR-STC-02',
    wabaAccount: 'N/A',
    checker1: { name: 'Faris', status: 'pending' },
    checker2: { name: '---', status: 'pending' },
    creationDate: '02/05/2026',
    creationTime: '01:05 pm',
    sharedWith: ['Omar Hassan'],
    sharedWithCount: 0,
    createdBy: 'Ali',
    statusByMeta: 'NA',
    status: 'pending',
    language: 'Arabic',
    subCategory: 'Default',
    body: 'Dynamic IVR — reads back the customer’s outstanding STC bill amount and due date.',
    previewKind: 'ivr',
    ivr: {
      type: 'dynamic',
      nodes: [
        { id: 'n_root', parent: null, key: null, label: 'STC Billing', segments: [
          { kind: 'recording', name: 'stc-bill-intro-ar.wav', dur: 4 },
          { kind: 'variable', key: 'bill_amount' },
          { kind: 'recording', name: 'stc-riyals-ar.wav', dur: 2 },
          { kind: 'recording', name: 'stc-due-on-ar.wav', dur: 3 },
          { kind: 'variable', key: 'due_date' },
        ], terminal: null },
        { id: 'n_pay', parent: 'n_root', key: '1', label: 'Pay Now', segments: [{ kind: 'recording', name: 'stc-pay-ar.wav', dur: 5 }], terminal: { type: 'transfer' } },
        { id: 'n_repeat', parent: 'n_root', key: '9', label: 'Repeat', segments: [{ kind: 'recording', name: 'stc-repeat-ar.wav', dur: 2 }], terminal: { type: 'return_root' } },
      ],
      variables: [
        { key: 'bill_amount', type: 'number', sample: '248.50' },
        { key: 'due_date', type: 'date', sample: '2026-06-15' },
      ],
    },
  },
  {
    id: '23',
    name: 'Saudia — Flight Information',
    channel: 'IVR Voice',
    serviceType: 'Static',
    referenceId: 'IVR-SV-03',
    wabaAccount: 'N/A',
    checker1: { name: 'Osama', status: 'approved' },
    checker2: { name: 'Jawad', status: 'approved' },
    creationDate: '21/04/2026',
    creationTime: '09:40 am',
    sharedWith: ['Sara Ahmad', 'Faris Ibrahim'],
    sharedWithCount: 1,
    createdBy: 'Husam',
    statusByMeta: 'NA',
    status: 'approved',
    language: 'English',
    subCategory: 'Default',
    body: 'Saudia (Saudi Arabian Airlines) flight-information IVR — bookings, status, baggage and Alfursan.',
    previewKind: 'ivr',
    ivr: {
      type: 'static',
      nodes: [
        { id: 'n_root', parent: null, key: null, label: 'Welcome — Saudia', segments: [{ kind: 'recording', name: 'saudia-welcome.wav', dur: 6 }], terminal: null },
        { id: 'n_book', parent: 'n_root', key: '1', label: 'New Booking', segments: [{ kind: 'recording', name: 'saudia-booking.wav', dur: 5 }], terminal: { type: 'transfer' } },
        { id: 'n_status', parent: 'n_root', key: '2', label: 'Flight Status', segments: [{ kind: 'recording', name: 'saudia-status.wav', dur: 5 }], terminal: { type: 'return_parent' } },
        { id: 'n_bag', parent: 'n_root', key: '3', label: 'Baggage Services', segments: [{ kind: 'recording', name: 'saudia-baggage.wav', dur: 5 }], terminal: { type: 'return_parent' } },
        { id: 'n_alf', parent: 'n_root', key: '4', label: 'Alfursan Miles', segments: [{ kind: 'recording', name: 'saudia-alfursan.wav', dur: 5 }], terminal: { type: 'return_parent' } },
      ],
      variables: [],
    },
  },
  {
    id: '24',
    name: 'Absher — Appointment Reminder',
    channel: 'IVR Voice',
    serviceType: 'Dynamic',
    referenceId: 'IVR-ABSHER-04',
    wabaAccount: 'N/A',
    checker1: { name: '---', status: 'pending' },
    checker2: { name: '---', status: 'pending' },
    creationDate: '05/05/2026',
    creationTime: '11:22 am',
    sharedWith: ['Lian Ali'],
    sharedWithCount: 0,
    createdBy: 'Dina',
    statusByMeta: 'NA',
    status: 'pending',
    language: 'Arabic',
    subCategory: 'Default',
    body: 'Dynamic IVR — reminds the citizen of their Absher government-services appointment date and time.',
    previewKind: 'ivr',
    ivr: {
      type: 'dynamic',
      nodes: [
        { id: 'n_root', parent: null, key: null, label: 'Appointment Reminder', segments: [
          { kind: 'recording', name: 'absher-greeting-ar.wav', dur: 4 },
          { kind: 'variable', key: 'citizen_name' },
          { kind: 'recording', name: 'absher-appt-ar.wav', dur: 3 },
          { kind: 'variable', key: 'appt_datetime' },
        ], terminal: null },
        { id: 'n_confirm', parent: 'n_root', key: '1', label: 'Confirm Attendance', segments: [{ kind: 'recording', name: 'absher-confirm-ar.wav', dur: 3 }], terminal: { type: 'hangup' } },
        { id: 'n_resched', parent: 'n_root', key: '2', label: 'Reschedule', segments: [{ kind: 'recording', name: 'absher-resched-ar.wav', dur: 4 }], terminal: { type: 'transfer' } },
      ],
      variables: [
        { key: 'citizen_name', type: 'string', sample: 'Mohammed Al-Otaibi' },
        { key: 'appt_datetime', type: 'date', sample: '2026-06-20 09:30' },
      ],
    },
  },
  {
    id: '25',
    name: 'Riyad Bank — Phone Banking (12 levels)',
    channel: 'IVR Voice',
    serviceType: 'Dynamic',
    referenceId: 'IVR-RIYAD-05',
    wabaAccount: 'N/A',
    checker1: { name: '---', status: 'pending' },
    checker2: { name: '---', status: 'pending' },
    creationDate: '06/06/2026',
    creationTime: '03:18 pm',
    sharedWith: [],
    sharedWithCount: 0,
    createdBy: 'Sami',
    statusByMeta: 'NA',
    status: 'pending',
    language: 'English',
    subCategory: 'Default',
    body: 'Deep dynamic phone-banking IVR (12 levels) — balance read-back, recent activity drill-down and a full transaction-dispute path, plus cards and operator branches.',
    previewKind: 'ivr',
    ivr: {
      type: 'dynamic',
      nodes: [
        { id: 'n_main', parent: null, key: null, label: 'Main Menu', segments: [
          { kind: 'recording', name: 'riyad-welcome.wav', dur: 5 },
          { kind: 'variable', key: 'customer_name' },
          { kind: 'recording', name: 'riyad-main-menu.wav', dur: 4 },
        ], terminal: null },
        { id: 'n_acc', parent: 'n_main', key: '1', label: 'Accounts', segments: [{ kind: 'recording', name: 'accounts-menu.wav', dur: 4 }], terminal: null },
        { id: 'n_cards', parent: 'n_main', key: '2', label: 'Cards', segments: [{ kind: 'recording', name: 'cards-menu.wav', dur: 4 }], terminal: null },
        { id: 'n_op', parent: 'n_main', key: '9', label: 'Operator', segments: [{ kind: 'recording', name: 'operator-connect.wav', dur: 3 }], terminal: { type: 'transfer' } },
        { id: 'n_bal', parent: 'n_acc', key: '1', label: 'Balance & Statements', segments: [{ kind: 'recording', name: 'balance-menu.wav', dur: 3 }], terminal: null },
        { id: 'n_trans', parent: 'n_acc', key: '2', label: 'Transactions', segments: [{ kind: 'recording', name: 'transactions-info.wav', dur: 4 }, { kind: 'goto', target: 'n_acc' }], terminal: null },
        { id: 'n_activate', parent: 'n_cards', key: '1', label: 'Activate Card', segments: [{ kind: 'recording', name: 'activate-intro.wav', dur: 3 }, { kind: 'variable', key: 'card_last4' }], terminal: { type: 'transfer' } },
        { id: 'n_block', parent: 'n_cards', key: '2', label: 'Block Card', segments: [{ kind: 'recording', name: 'block-card.wav', dur: 4 }, { kind: 'variable', key: 'card_last4' }], terminal: { type: 'hangup' } },
        { id: 'n_cur', parent: 'n_bal', key: '1', label: 'Current Balance', segments: [
          { kind: 'recording', name: 'current-balance-intro.wav', dur: 3 },
          { kind: 'variable', key: 'account_balance' },
          { kind: 'recording', name: 'current-balance-outro.wav', dur: 2 },
        ], terminal: null },
        { id: 'n_mini', parent: 'n_bal', key: '2', label: 'Mini Statement', segments: [{ kind: 'recording', name: 'mini-statement.wav', dur: 5 }], terminal: { type: 'return_parent' } },
        { id: 'n_recent', parent: 'n_cur', key: '1', label: 'Recent Activity', segments: [{ kind: 'recording', name: 'recent-activity.wav', dur: 3 }], terminal: null },
        { id: 'n_last', parent: 'n_recent', key: '1', label: 'Last Transaction', segments: [
          { kind: 'recording', name: 'last-txn-intro.wav', dur: 3 },
          { kind: 'variable', key: 'last_txn' },
          { kind: 'recording', name: 'last-txn-on.wav', dur: 2 },
          { kind: 'variable', key: 'last_txn_date' },
        ], terminal: null },
        { id: 'n_det', parent: 'n_last', key: '1', label: 'Transaction Details', segments: [{ kind: 'recording', name: 'txn-details.wav', dur: 4 }], terminal: null },
        { id: 'n_disp', parent: 'n_det', key: '1', label: 'Dispute Transaction', segments: [{ kind: 'recording', name: 'dispute-intro.wav', dur: 4 }], terminal: null },
        { id: 'n_conf', parent: 'n_disp', key: '1', label: 'Confirm Dispute', segments: [{ kind: 'recording', name: 'confirm-dispute.wav', dur: 3 }], terminal: null },
        { id: 'n_reason', parent: 'n_conf', key: '1', label: 'Dispute Reason', segments: [{ kind: 'recording', name: 'dispute-reason-menu.wav', dur: 4 }], terminal: null },
        { id: 'n_unauth', parent: 'n_reason', key: '1', label: 'Unauthorized Charge', segments: [{ kind: 'recording', name: 'unauthorized-intro.wav', dur: 3 }, { kind: 'variable', key: 'otp_code' }], terminal: null },
        { id: 'n_dup', parent: 'n_reason', key: '2', label: 'Duplicate Charge', segments: [{ kind: 'recording', name: 'duplicate-charge.wav', dur: 3 }, { kind: 'goto', target: 'n_main' }], terminal: null },
        { id: 'n_submit', parent: 'n_unauth', key: '1', label: 'Submit Dispute', segments: [
          { kind: 'recording', name: 'submit-intro.wav', dur: 3 },
          { kind: 'variable', key: 'ticket_ref' },
          { kind: 'recording', name: 'submit-outro.wav', dur: 3 },
        ], terminal: { type: 'hangup' } },
      ],
      variables: [
        { key: 'customer_name', type: 'string', sample: 'Mohammed Al-Otaibi' },
        { key: 'account_balance', type: 'number', sample: '12,480.75' },
        { key: 'card_last4', type: 'digit', sample: '4417' },
        { key: 'last_txn', type: 'number', sample: '320.00' },
        { key: 'last_txn_date', type: 'date', sample: '2026-06-07 14:32' },
        { key: 'otp_code', type: 'digit', sample: '583920' },
        { key: 'ticket_ref', type: 'digit', sample: '778145' },
      ],
    },
  },
];

// Pending Review tab — only the original 5 client-flow templates that need
// checker action. Checker2 is always "---" pending. Checker1 is "Taha" for
// the Marketing/Template Test row and "---" pending for Voice/Test2.
const PENDING_C1_NAME = { '12': 'Taha', '14': 'Osama', '65': 'Faris', '11': 'Taha', '10': '---' };
const pendingTemplates = seedTemplates
  .filter(t => ['12', '14', '65', '11', '10'].includes(t.id))
  .map(t => ({
    ...t,
    status: 'pending',
    checker1: { name: PENDING_C1_NAME[t.id], status: PENDING_C1_NAME[t.id] === '---' ? 'pending' : 'approved' },
    checker2: { name: '---', status: 'pending' },
  }));

// Shared Templates — all approved at all levels including Meta quality flags.
// Limited to the original 5 client-flow templates; checker names are filled in
// (no "---" placeholders) and statusByMeta varies per template.
const SHARED_CHECKERS = {
  '12': { c1: 'Taha',  c2: 'Dina'  },
  '14': { c1: 'Osama', c2: 'Taha'  },
  '65': { c1: 'Faris', c2: 'Jawad' },
  '11': { c1: 'Taha',  c2: 'Jawad' },
  '10': { c1: 'Faris', c2: 'Dina'  },
};
const sharedTemplates = seedTemplates
  .filter(t => ['12', '14', '65', '11', '10'].includes(t.id))
  .map(t => ({
    ...t,
    status: 'approved',
    statusByMeta: t.id === '12' ? 'Active Quality Pending'
                : t.id === '14' ? 'Active - High Quality'
                : t.id === '65' ? 'Active - Medium Quality'
                : t.id === '11' ? 'Active - Low Quality'
                : 'NA',
    metaQuality: t.id === '12' ? 'pending'
              : t.id === '14' ? 'high'
              : t.id === '65' ? 'medium'
              : t.id === '11' ? 'low'
              : null,
    checker1: { name: SHARED_CHECKERS[t.id].c1, status: 'approved' },
    checker2: { name: SHARED_CHECKERS[t.id].c2, status: 'approved' },
  }));

// Available users for "Shared With" multi-select on step 3
const sharedWithCandidates = [
  { id: 'ahmadali', name: 'Ahmad Ali',  username: 'ahmad@93' },
  { id: 'saraahmad', name: 'Sara Ahmad', username: 'sara/111' },
  { id: 'omarhassan', name: 'Omar Hassan', username: 'omar/123' },
  { id: 'lianali', name: 'Lian Ali', username: 'lian/111' },
  { id: 'farisibrahim', name: 'Faris Ibrahim', username: 'faris/111' },
  { id: 'salahabd', name: 'Salah Abdullah', username: 'salah/22' },
  { id: 'monaghazi', name: 'Mona Ghazi', username: 'mona/55' },
  { id: 'lailam', name: 'Layla Mansour', username: 'layla/77' },
];

// Media samples available for the Header field (Step 2)
const mediaSamples = [
  { id: 'm-promo-banner',  name: 'Promo Banner — Hero',     kind: 'image', size: '1280×640' },
  { id: 'm-product-shot',  name: 'Product Showcase',         kind: 'image', size: '1080×1080' },
  { id: 'm-flash-sale',    name: 'Flash Sale Backdrop',      kind: 'image', size: '1280×640' },
  { id: 'm-welcome-card',  name: 'Welcome Greeting Card',    kind: 'image', size: '1080×720' },
  { id: 'm-receipt',       name: 'Order Receipt PDF',        kind: 'document', size: '— PDF' },
  { id: 'm-tutorial',      name: 'Quick Tutorial — 30s',     kind: 'video', size: '— 1080p' },
];

// Contact groups available on Step 2 / Step 3
const contactGroups = [
  { id: 'cg-vip',         name: 'VIP Customers',             count: 348 },
  { id: 'cg-active',      name: 'Active subscribers',        count: 12480 },
  { id: 'cg-new-signups', name: 'New sign-ups (30 days)',    count: 1024 },
  { id: 'cg-loyalty',     name: 'Loyalty programme members', count: 5612 },
  { id: 'cg-cart-aband',  name: 'Cart abandoners',           count: 743 },
  { id: 'cg-employees',   name: 'Internal employees',        count: 219 },
];

// Existing flows pool (for "Use existing" picker)
const existingFlows = [
  { id: 'fl1', name: 'Message templates-library123', published: 'Apr 26.2026' },
  { id: 'fl2', name: 'Message templates-987', published: 'Apr 26.2026' },
];

// Flow type options for the modal
const flowTypeOptions = [
  { id: 'survey',   title: 'flowTypeSurvey',   desc: 'flowTypeSurveyDesc',   enabled: true },
  { id: 'register', title: 'flowTypeRegister', desc: 'flowTypeRegisterDesc', enabled: false },
  { id: 'signup',   title: 'flowTypeSignup',   desc: 'flowTypeSignupDesc',   enabled: false },
  { id: 'custom',   title: 'flowTypeCustom',   desc: 'flowTypeCustomDesc',   enabled: false },
];

// Utility-category flow types: "Get feedback" is the live option; the rest are upcoming.
const flowTypeOptionsFeedback = [
  { id: 'feedback', title: 'flowTypeFeedback', desc: 'flowTypeFeedbackDesc', enabled: true },
  { id: 'support',  title: 'flowTypeSupport',  desc: 'flowTypeSupportDesc',  enabled: false },
  { id: 'custom',   title: 'flowTypeCustom',   desc: 'flowTypeCustomDesc',   enabled: false },
];

// Default survey flow (for the editor preview — matches the ref)
const defaultSurveyFlow = {
  type: 'survey',
  screens: [
    {
      id: 's1',
      title: 'Question 1 of 3',
      content: [
        { id: 'h1', kind: 'heading-large', text: "You've found the perfect deal, what do you next?" },
        { id: 'sel1', kind: 'multiple', label: 'Choose all that apply', required: false, options: [
          'Buy it right away',
          'Check reviews before buying',
          'Share it with friends and family',
          'Buy multiple, while it’s cheap',
          'None of the above',
        ] },
      ],
    },
    {
      id: 's2',
      title: 'Question 2 of 3',
      content: [
        { id: 'h2', kind: 'heading-large', text: "It's your birthday in two weeks, how might you prepare?" },
        { id: 'sel2', kind: 'multiple', label: 'Choose one', required: false, options: [
          'Buy something new',
          'wear the same, as usual',
          'Look for a deal online',
        ] },
      ],
    },
    {
      id: 's3',
      title: 'Question 3 of 3',
      content: [
        { id: 'h3', kind: 'heading-large', text: "What's the best gift for a friend?" },
        { id: 'sel3', kind: 'multiple', label: 'Choose all that apply', required: false, options: [
          'A gift voucher',
          'A new outfit',
          'A bouquet of flowers',
          'A meal out together',
        ] },
      ],
    },
  ],
};

// Default "Get feedback" flow (Utility) — a 2-screen feedback survey matching the ref:
// screen 1 = recommend (Yes/No) + free-text comment; screen 2 = rate three areas.
const FEEDBACK_RATINGS = ['Excellent (5/5)', 'Good (4/5)', 'Average (3/5)', 'Poor (2/5)', 'Very poor (1/5)'];
const defaultFeedbackFlow = {
  type: 'feedback',
  name: 'Get-Feedback',
  screens: [
    {
      id: 'fb1', title: 'Feedback 1 of 2', cta: 'Continue',
      content: [
        { id: 'fb-h1', kind: 'heading-small', text: 'Would you recommend us to a friend?' },
        { id: 'fb-c1', kind: 'single', label: 'Choose one', required: true, options: ['Yes', 'No'] },
        { id: 'fb-h2', kind: 'heading-small', text: 'How could we do better?' },
        { id: 'fb-t1', kind: 'short-text', label: '', placeholder: 'Leave a comment (optional)', max: 600 },
      ],
    },
    {
      id: 'fb2', title: 'Feedback 2 of 2', cta: 'Done',
      content: [
        { id: 'fb-h3', kind: 'heading-small', text: 'Rate the following:' },
        { id: 'fb-d1', kind: 'dropdown', label: 'Purchase experience', required: true, options: [...FEEDBACK_RATINGS] },
        { id: 'fb-d2', kind: 'dropdown', label: 'Delivery and setup',  required: true, options: [...FEEDBACK_RATINGS] },
        { id: 'fb-d3', kind: 'dropdown', label: 'Customer Service',     required: true, options: [...FEEDBACK_RATINGS] },
      ],
    },
  ],
};

// NOTE: the maker–checker "Action history" is no longer a shared mock. It is derived
// per-template from each template's own checker1 / checker2 data (see buildTplActionHistory
// in templates-details.jsx) so the history can never contradict the Status pill.
// Only the Meta-review history below remains as static mock data.
const actionHistoryByMeta = [
  { date: '27/03/2025', time: '02:42 PM', status: 'Rejected', reason: 'metaRejectedReason' },
];
const actionHistoryByMetaApproved = [
  { date: '27/03/2025', time: '02:42 PM', status: 'Approved', reason: '---' },
];

window.seedTemplates = seedTemplates;
window.pendingTemplates = pendingTemplates;
window.sharedTemplates = sharedTemplates;
window.sharedWithCandidates = sharedWithCandidates;
window.mediaSamples = mediaSamples;
window.contactGroups = contactGroups;
window.existingFlows = existingFlows;
window.flowTypeOptions = flowTypeOptions;
window.flowTypeOptionsFeedback = flowTypeOptionsFeedback;
window.defaultSurveyFlow = defaultSurveyFlow;
window.defaultFeedbackFlow = defaultFeedbackFlow;
window.actionHistoryByMeta = actionHistoryByMeta;
window.actionHistoryByMetaApproved = actionHistoryByMetaApproved;
window.avatarColor = avatarColor;
