export type CampaignStatus = 'Sent' | 'Scheduled' | 'Draft' | 'Failed';

export type CampaignRow = {
  id: string;
  code: string;
  name: string;
  audience: string;
  audienceGroup: string;
  sent: string;
  opened: string;
  status: CampaignStatus;
  deliveryRate: number | null;
  dateLabel: string;
  timeLabel: string;
};

export const dashboardStats = [
  { label: 'Total Messages', value: '1.2M', delta: '+12%', tone: 'success' },
  { label: 'Delivered', value: '98.4%', delta: '+0.5%', tone: 'success' },
  { label: 'Read Rate', value: '76.2%', delta: '-2%', tone: 'warning' },
  { label: 'Failed', value: '1.6%', delta: 'Stable', tone: 'neutral' },
];

export const contacts = [
  { id: 'sarah-jenkins', name: 'Sarah Jenkins', phone: '+62 812-5551-8871', tag: 'VIP Customer', company: 'Northwind Retail', status: 'Active' },
  { id: 'dimas-pratama', name: 'Dimas Pratama', phone: '+62 821-9933-1182', tag: 'Lead', company: 'BizOne Labs', status: 'New' },
  { id: 'amelia-hart', name: 'Amelia Hart', phone: '+62 813-7122-4419', tag: 'Support', company: 'Aster Digital', status: 'Follow-up' },
  { id: 'yusuf-rizki', name: 'Yusuf Rizki', phone: '+62 811-6123-7740', tag: 'Wholesale', company: 'Mercury Supply', status: 'Inactive' },
];

export const campaigns: CampaignRow[] = [
  {
    id: 'summer-sale-2024',
    code: 'CAM-98231',
    name: 'Summer Sale 2024',
    audience: '45,200 recipients',
    audienceGroup: 'Retail subscribers',
    sent: '45,200',
    opened: '38,910',
    status: 'Sent',
    deliveryRate: 99.2,
    dateLabel: 'June 12, 2024',
    timeLabel: '09:15 AM',
  },
  {
    id: 'weekly-newsletter-42',
    code: 'CAM-98244',
    name: 'Weekly Newsletter #42',
    audience: 'VIP Customer List',
    audienceGroup: 'High-value segment',
    sent: '18,640',
    opened: '0',
    status: 'Scheduled',
    deliveryRate: null,
    dateLabel: 'In 2 hours',
    timeLabel: '14:00 PM',
  },
  {
    id: 'product-launch-promo',
    code: 'CAM-98255',
    name: 'Product Launch Promo',
    audience: 'New Leads Segment',
    audienceGroup: 'Cold outreach',
    sent: '0',
    opened: '0',
    status: 'Draft',
    deliveryRate: 0,
    dateLabel: 'Not set',
    timeLabel: '',
  },
  {
    id: 'loyalty-program-update',
    code: 'CAM-98201',
    name: 'Loyalty Program Update',
    audience: 'Dormant Users',
    audienceGroup: 'Reactivation list',
    sent: '60,700',
    opened: '27,315',
    status: 'Failed',
    deliveryRate: 45,
    dateLabel: 'June 10, 2024',
    timeLabel: '',
  },
];

export const templates = [
  {
    id: 'order-confirmation-v2',
    name: 'order_confirmation_v2',
    category: 'Utility',
    status: 'Approved',
    language: 'en_US',
    updatedLabel: 'Updated 2h ago',
    preview:
      "Hi {{1}}, thank you for your order #{{2}}! We've received your payment and will notify you when it ships...",
    note: 'Last approved variant for e-commerce notifications.',
    compact: false,
  },
  {
    id: 'holiday-sale-promo',
    name: 'holiday_sale_promo',
    category: 'Marketing',
    status: 'Pending',
    language: 'en_US',
    updatedLabel: 'Updated 1d ago',
    preview:
      'Exclusive Holiday Sale! Get 30% OFF on all items using code FESTIVE30. Shop now at {{1}}...',
    note: 'Awaiting Meta content review.',
    compact: false,
  },
  {
    id: 'account-recovery-otp',
    name: 'account_recovery_otp',
    category: 'Authentication',
    status: 'Rejected',
    language: 'en_US',
    updatedLabel: 'Needs Review',
    preview:
      'Your recovery code is {{1}}. Do not share this with anyone. This code expires in 5 minutes.',
    note: 'Rejected due to policy mismatch in footer copy.',
    compact: false,
  },
  {
    id: 'shipping-update-express',
    name: 'shipping_update_express',
    category: 'Utility',
    status: 'Approved',
    language: 'en_US',
    updatedLabel: 'Oct 24, 2023',
    preview: 'Good news! Your package is out for delivery and should arrive before 7 PM today.',
    note: 'High-delivery template used by logistics teams.',
    compact: true,
  },
  {
    id: 'welcome-onboarding-v4',
    name: 'welcome_onboarding_v4',
    category: 'Marketing',
    status: 'Approved',
    language: 'id_ID',
    updatedLabel: 'Updated 3d ago',
    preview:
      "Welcome to the community {{1}}! We're thrilled to have you here. To get started, please check out...",
    note: 'Localized onboarding template for Indonesia.',
    compact: false,
  },
  {
    id: 'appointment-remind-6h',
    name: 'appointment_remind_6h',
    category: 'Utility',
    status: 'Approved',
    language: 'en_US',
    updatedLabel: 'Updated 1w ago',
    preview:
      'Reminder: Your appointment at {{1}} starts in 6 hours. If you need to reschedule, please call...',
    note: 'Low drop-off reminder used by support and clinic verticals.',
    compact: false,
  },
] as const;

export const webhookLogs = [
  { id: 'evt_1001', provider: 'meta', event: 'message.delivered', status: 'processed', time: '2026-05-09 09:32' },
  { id: 'evt_1002', provider: 'meta', event: 'message.read', status: 'processed', time: '2026-05-09 09:31' },
  { id: 'evt_1003', provider: 'qontak', event: 'message.failed', status: 'retrying', time: '2026-05-09 09:28' },
  { id: 'evt_1004', provider: 'meta', event: 'template.updated', status: 'received', time: '2026-05-09 09:22' },
];

export const users = [
  { name: 'Admin User', role: 'Super Admin', email: 'admin@example.com', status: 'Active', lastSeen: '2 min ago' },
  { name: 'Nadia Putri', role: 'Operator', email: 'nadia@bizone.id', status: 'Active', lastSeen: '16 min ago' },
  { name: 'Reza Hidayat', role: 'Viewer', email: 'reza@bizone.id', status: 'Invited', lastSeen: 'Never' },
];

export const activityLogs = [
  { actor: 'Admin User', action: 'Updated API token', target: 'WhatsApp Integration', time: '09:40' },
  { actor: 'Nadia Putri', action: 'Created draft message', target: 'Order Recovery Flow', time: '09:18' },
  { actor: 'System', action: 'Retried failed webhook', target: 'evt_1003', time: '08:59' },
];

export const analyticsQueueStats = [
  { label: 'Pending Jobs', value: '1,284', tone: 'info', icon: 'schedule' },
  { label: 'Processing', value: '42', tone: 'primary', icon: 'autorenew' },
  { label: 'Failed (24H)', value: '7', tone: 'error', icon: 'error_outline' },
] as const;

export const analyticsWorkerHealth = [
  { name: 'node-worker-01', load: 98, tone: 'success' },
  { name: 'node-worker-02', load: 12, tone: 'warning' },
] as const;

export const analyticsLogs = [
  {
    timestamp: '2026-05-09 14:22:01',
    action: 'BROADCAST_START',
    detail: 'Marketing Campaign v2',
    actor: 'admin_jane',
    actorKind: 'user',
    actorBadge: 'AD',
    status: 'Success',
    statusTone: 'success',
    payloadTone: 'primary',
  },
  {
    timestamp: '2026-05-09 14:21:55',
    action: 'WEBHOOK_RETRY',
    detail: 'Endpoint: /api/v1/update',
    actor: 'QueueWorker_02',
    actorKind: 'service',
    actorIcon: 'robot_2',
    status: 'Pending',
    statusTone: 'warning',
    payloadTone: 'neutral',
  },
  {
    timestamp: '2026-05-09 14:21:48',
    action: 'AUTH_FAILURE',
    detail: 'Invalid Token Attempt',
    actor: 'IP: 192.168.1.1',
    actorKind: 'network',
    actorIcon: 'public',
    status: 'Rejected',
    statusTone: 'error',
    payloadTone: 'error',
  },
  {
    timestamp: '2026-05-09 14:20:12',
    action: 'TEMPLATE_CREATE',
    detail: 'New template: Welcome_V2',
    actor: 'mike_dev',
    actorKind: 'user',
    actorBadge: 'MK',
    status: 'Approved',
    statusTone: 'success',
    payloadTone: 'success',
  },
  {
    timestamp: '2026-05-09 14:19:44',
    action: 'EXPORT_COMPLETE',
    detail: 'User_Database_Daily.csv',
    actor: 'SystemScheduler',
    actorKind: 'service',
    actorIcon: 'settings_suggest',
    status: 'Success',
    statusTone: 'success',
    payloadTone: 'neutral',
  },
] as const;

export const analyticsMetrics = [
  {
    label: 'API Latency',
    value: '124ms',
    meta: '↓ 12%',
    metaTone: 'success',
    icon: 'bar_chart',
    chartHeights: ['40%', '60%', '45%', '80%', '35%', '20%', '30%'],
    chartTone: 'bars',
  },
  {
    label: 'DB Connections',
    value: '84',
    meta: 'Active',
    metaTone: 'warning',
    icon: 'database',
    progress: '42%',
    chartTone: 'progress',
  },
  {
    label: 'Memory Usage',
    value: '4.2GB',
    meta: 'of 16GB',
    metaTone: 'muted',
    icon: 'memory',
    chartHeights: ['60%', '65%', '70%', '62%', '68%', '72%', '75%'],
    chartTone: 'memory',
  },
] as const;

export const conversations = [
  {
    id: 'elena-rodriguez',
    name: 'Elena Rodriguez',
    initials: 'ER',
    time: '2m ago',
    status: 'NEW',
    tone: 'info',
    topic: 'INQUIRY',
    snippet: 'Hey, I wanted to check the status of my shipment...',
    online: true,
    location: 'San Francisco, CA',
    email: 'elena.rod@example.com',
    phone: '+1 (555) 0123-4567',
    customerSince: 'Customer since Jan 2024',
    tags: ['PREMIUM', 'ACTIVE_TRIAL'],
    activity: [
      { title: 'Order #WH-98234-X', meta: 'Completed • 24 hours ago', tone: 'primary' },
      { title: 'Webinar Registered', meta: 'Organic • 3 days ago', tone: 'muted' },
    ],
    messages: [
      {
        direction: 'incoming',
        body: "Hello! I purchased a subscription yesterday but I haven't received the activation code yet. Could you help me with that?",
        time: '10:42 AM',
      },
      {
        direction: 'outgoing',
        body: "Hi Elena! I'm sorry for the delay. Let me check that for you right away. Could you please provide your order ID?",
        time: '10:44 AM',
      },
      {
        direction: 'incoming',
        body: "Sure, the order ID is #WH-98234-X. I checked my spam folder too but it's not there.",
        time: '10:45 AM',
      },
      {
        direction: 'system',
        body: 'System: Order Verified',
        time: '',
      },
      {
        direction: 'outgoing-rich',
        title: 'Verification Successful!',
        body: "I've resent the activation email to your registered address. You should see it in the next few minutes. Would you like me to send a PDF copy here as well?",
        time: '10:48 AM',
      },
    ],
  },
  {
    id: 'marcus-chen',
    name: 'Marcus Chen',
    initials: 'MC',
    time: '45m ago',
    status: 'ACTIVE',
    tone: 'success',
    topic: '',
    snippet: "Thank you for the help! I'll wait for the email.",
    online: false,
    location: 'Singapore',
    email: 'marcus.chen@example.com',
    phone: '+65 8123 4411',
    customerSince: 'Customer since Nov 2023',
    tags: ['LOYAL', 'B2B'],
    activity: [
      { title: 'Invoice Request', meta: 'Resolved • Today', tone: 'primary' },
      { title: 'Campaign Clickthrough', meta: 'Marketing • 1 week ago', tone: 'muted' },
    ],
    messages: [],
  },
  {
    id: 'sarah-jenkins',
    name: 'Sarah Jenkins',
    initials: 'SJ',
    time: '2h ago',
    status: 'PENDING',
    tone: 'warning',
    topic: '',
    snippet: 'Is the 20% discount still valid for enterprise?',
    online: false,
    location: 'Austin, TX',
    email: 'sarah.jenkins@example.com',
    phone: '+1 (555) 0199-2201',
    customerSince: 'Customer since Mar 2024',
    tags: ['LEAD'],
    activity: [
      { title: 'Pricing Inquiry', meta: 'Pending • 2 hours ago', tone: 'primary' },
    ],
    messages: [],
  },
] as const;

export const messageRows = [
  { contact: 'Sarah Jenkins', template: 'order_update_v2', status: 'Delivered', sentAt: '09:12', channel: 'Template' },
  { contact: 'Dimas Pratama', template: 'welcome_lead_id', status: 'Queued', sentAt: '09:10', channel: 'Draft' },
  { contact: 'Amelia Hart', template: 'post_purchase_followup', status: 'Read', sentAt: '08:55', channel: 'Campaign' },
];
