/**
 * CommunicationFlow Constants
 */
import React from 'react';
import { FormattedMessage } from 'react-intl';
import messages from './messages';

// Step identifiers
export const STEPS = {
  MESSAGE_TYPE: 'messageType',
  COMMUNICATION_STRATEGY: 'communicationStrategy',
  CHANNEL_SELECTION: 'channelSelection',
  INCENTIVES: 'incentives',
  DELIVERY_SETTINGS: 'deliverySettings',
  DYNAMIC_CONTROLS: 'dynamicControls',
};

// Message Type values
export const MESSAGE_TYPES_OPTIONS = [
  { value: 'promotional', label: <FormattedMessage {...messages.promotional} />, disabled: false },
  { value: 'transactional', label: <FormattedMessage {...messages.transactional} />, disabled: false },
];

// Communication Strategy values
export const COMMUNICATION_STRATEGIES_OPTIONS = [
  {
    value: 'SINGLE_TEMPLATE', label: <FormattedMessage {...messages.singleTemplate} />, disabled: false, isMultiChannel: false,
  },
  {
    value: 'CHANNEL_PRIORITY', label: <FormattedMessage {...messages.channelPriority} />, disabled: false, isMultiChannel: true,
  },
  {
    value: 'AB_TEST', label: <FormattedMessage {...messages.abTest} />, disabled: false, isMultiChannel: true,
  },
];

export const CHANNEL_PRIORITY = 'CHANNEL_PRIORITY';
export const AB_TEST = 'AB_TEST';
export const SINGLE_TEMPLATE = 'SINGLE_TEMPLATE';

// Channel config - single source of truth for CreativesContainer and TemplatesV2
// paneKey: TemplatesV2 defaultPanes object key (for channelsToHide)
// channelProp: CreativesContainer channel prop (must match pane.key for tab to be active)
export const CHANNELS = [
  {
    value: 'SMS',
    label: <FormattedMessage {...messages.sms} />,
    iconType: 'sms',
    isActive: true,
    paneKey: 'sms',
    channelProp: 'sms',
  },
  {
    value: 'EMAIL',
    label: <FormattedMessage {...messages.email} />,
    iconType: 'email',
    isActive: true,
    paneKey: 'email',
    channelProp: 'email',
  },
  {
    value: 'MOBILEPUSH',
    label: <FormattedMessage {...messages.mobilePush} />,
    iconType: 'mpush',
    isActive: true,
    paneKey: 'mPush',
    channelProp: 'mobilepush',
  },
  {
    value: 'INAPP',
    label: <FormattedMessage {...messages.inApp} />,
    iconType: 'mpush',
    isActive: true,
    paneKey: 'inApp',
    channelProp: 'inapp',
    requiresEnableNewChannels: true,
  },
  {
    value: 'WHATSAPP',
    label: <FormattedMessage {...messages.whatsApp} />,
    iconType: 'whatsapp',
    isActive: true,
    paneKey: 'whatsapp',
    channelProp: 'whatsapp',
    requiresEnableNewChannels: true,
  },
  {
    value: 'WECHAT',
    label: <FormattedMessage {...messages.weChat} />,
    iconType: 'wechat',
    isActive: false,
    paneKey: 'weChat',
    channelProp: 'wechat',
  },
  {
    value: 'LINE',
    label: <FormattedMessage {...messages.line} />,
    iconType: 'line',
    isActive: true,
    paneKey: 'line',
    channelProp: 'line',
  },
  {
    value: 'VIBER',
    label: <FormattedMessage {...messages.viber} />,
    iconType: 'viber',
    isActive: true,
    paneKey: 'viber',
    channelProp: 'viber',
  },
  {
    value: 'FACEBOOK',
    label: <FormattedMessage {...messages.facebook} />,
    iconType: 'facebook',
    isActive: true,
    paneKey: 'facebook',
    channelProp: 'facebook',
  },
  {
    value: 'RCS',
    label: <FormattedMessage {...messages.rcs} />,
    iconType: 'rcs',
    isActive: true,
    paneKey: 'rcs',
    channelProp: 'rcs',
    requiresEnableNewChannels: true,
  },
  {
    value: 'ZALO',
    label: <FormattedMessage {...messages.zalo} />,
    iconType: 'zalo',
    isActive: true,
    paneKey: 'zalo',
    channelProp: 'zalo',
    requiresEnableNewChannels: true,
  },
  {
    value: 'WEBPUSH',
    label: <FormattedMessage {...messages.webPush} />,
    iconType: 'webpush',
    isActive: true,
    paneKey: 'webpush',
    channelProp: 'webpush',
  },
  {
    value: 'CALLTASK',
    label: <FormattedMessage {...messages.callTask} />,
    iconType: 'call',
    isActive: true,
    paneKey: 'callTask',
    channelProp: 'call_task', // Must match TemplatesV2 pane.key
  },
];

// Delivery settings - channels that show/hide sender details
export const CHANNELS_WITHOUT_DELIVERY = ['MPUSH', 'MOBILEPUSH', 'INAPP', 'WEBPUSH'];
export const SENDER_ID_CHANNELS = ['SMS', 'EMAIL', 'VIBER', 'ZALO', 'LINE'];
export const SENDER_NUMBER_CHANNELS = ['WHATSAPP', 'RCS'];

// Dynamic Controls — default config for the Other Controls section.
// label and description are resolved via FormattedMessage so consumers
// get translated strings without needing to hardcode copy in their config.
export const DYNAMIC_CONTROLS_CONFIG = [
  {
    key: 'sendToControlCustomers',
    label: <FormattedMessage {...messages.sendToControlCustomers} />,
  },
  {
    key: 'sendToBrandPocs',
    label: <FormattedMessage {...messages.sendToBrandPocs} />,
  },
  {
    key: 'useTinyUrl',
    label: <FormattedMessage {...messages.useTinyUrl} />,
  },
  {
    key: 'overrideDailyLimit',
    label: <FormattedMessage {...messages.overrideDailyLimit} />,
    description: <FormattedMessage {...messages.overrideDailyLimitDesc} />,
  },
];

// Incentive types
export const INCENTIVE_TYPES = [
  {
    value: 'coupons', label: <FormattedMessage {...messages.coupons} />, isActive: true, disabled: false,
  },
  {
    value: 'points', label: <FormattedMessage {...messages.points} />, isActive: true, disabled: false,
  },
  {
    value: 'promotions', label: <FormattedMessage {...messages.promotions} />, isActive: true, disabled: false,
  },
  {
    value: 'giftVouchers', label: <FormattedMessage {...messages.giftVouchers} />, isActive: false, disabled: false,
  },
  {
    value: 'badges', label: <FormattedMessage {...messages.badges} />, isActive: false, disabled: false,
  },
];
