import { FormattedMessage } from "react-intl";
import React from 'react';
import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
import messages from "./messages";
import { createAsyncAssetUploadConstants } from '../../utils/asyncAssetUpload';

export const DEFAULT_ACTION = 'app/v2Containers/Viber/DEFAULT_ACTION';
export const ALLOWED_EXTENSIONS_REGEX = (/\.(jpe?g|png)$/i);
export const VIBER_IMG_HEIGHT = 400;
export const VIBER_IMG_WIDTH = 400;
export const VIBER_IMG_SIZE = 10000000;
export const VIBER_VIDEO_SIZE = 209715200;
export const charLimit = 1000;

export const UPLOAD_VIBER_ASSET_REQUEST = 'app/v2Containers/Viber/UPLOAD_ASSET_REQUEST';
export const UPLOAD_VIBER_ASSET_SUCCESS = 'app/v2Containers/Viber/UPLOAD_ASSET_SUCCESS';
export const UPLOAD_VIBER_ASSET_FAILURE = 'app/v2Containers/Viber/UPLOAD_ASSET_FAILURE';

const viberAsyncPrefix = 'app/v2Containers/Viber';
const asyncUploadConstants = createAsyncAssetUploadConstants('VIBER', viberAsyncPrefix);
export const UPLOAD_VIBER_ASSET_PROCESSING = asyncUploadConstants.UPLOAD_VIBER_ASSET_PROCESSING;
export const UPLOAD_VIBER_ASSET_COMPLETED = asyncUploadConstants.UPLOAD_VIBER_ASSET_COMPLETED;
export const UPLOAD_VIBER_ASSET_FAILED = asyncUploadConstants.UPLOAD_VIBER_ASSET_FAILED;
export const UPLOAD_VIBER_ASSET_TIMEOUT = asyncUploadConstants.UPLOAD_VIBER_ASSET_TIMEOUT;


export const CREATE_VIBER_TEMPLATE_REQUEST = 'app/v2Containers/Viber/CREATE_VIBER_TEMPLATE_REQUEST';
export const CREATE_VIBER_TEMPLATE_SUCCESS = 'app/v2Containers/Viber/CREATE_VIBER_TEMPLATE_SUCCESS';
export const CREATE_VIBER_TEMPLATE_FAILURE = 'app/v2Containers/Viber/CREATE_VIBER_TEMPLATE_FAILURE';


export const GET_VIBER_TEMPLATE_DETAILS_REQUEST = 'app/v2Containers/Viber/EDIT/CREATE_VIBER_TEMPLATE_DETAILS_REQUEST';
export const GET_VIBER_TEMPLATE_DETAILS_SUCCESS = 'app/v2Containers/Viber/EDIT/CREATE_VIBER_TEMPLATE_DETAILS_SUCCESS';
export const GET_VIBER_TEMPLATE_DETAILS_FAILURE = 'app/v2Containers/Viber/EDIT/CREATE_VIBER_TEMPLATE_DETAILS_FAILURE';

export const EDIT_VIBER_TEMPLATE_REQUEST = 'app/v2Containers/VIBER/Edit/EDIT_VIBER_TEMPLATE_REQUEST';
export const EDIT_VIBER_TEMPLATE_SUCCESS = 'app/v2Containers/VIBER/Edit/EDIT_VIBER_TEMPLATE_SUCCESS';
export const EDIT_VIBER_TEMPLATE_FAILURE = 'app/v2Containers/VIBER/Edit/EDIT_VIBER_TEMPLATE_FAILURE';

export const CLEAR_VIBER_EDIT_RESPONSE_REQUEST = 'app/v2Containers/VIBER/Edit/CLEAR_EDIT_RESPONSE_REQUEST';
export const CLEAR_VIBER_DATA = 'app/v2Containers/VIBER/Edit/CLEAR_DATA';
export const CLEAR_VIBER_CREATE_RESPONSE_REQUEST = 'app/v2Containers/VIBER/Create/CLEAR_EDIT_RESPONSE_REQUEST';
export const CLEAR_VIBER_ASSET = 'app/v2Containers/Viber/CLEAR_ASSET';

export const VIBER_MEDIA_TYPES = {
  TEXT: 'TEXT',
  IMAGE: 'IMAGE',
  VIDEO: 'VIDEO',
};
export const ALLOWED_IMAGE_EXTENSIONS_REGEX_VIBER = /\.(jpe?g|png)$/i;
export const ALLOWED_EXTENSIONS_VIDEO_REGEX_VIBER = /\.(mp4|3gp|m4v|mov)$/i;
export const NONE = 'NONE';
export const CTA = 'CTA';
export const VIBER_BUTTON_TYPES = {
  NONE,
  CTA,
};
export const mediaRadioOptions = [
  {
    value: VIBER_MEDIA_TYPES.TEXT,
    label: <FormattedMessage {...messages.mediaText} />,
  },
  {
    value: VIBER_MEDIA_TYPES.IMAGE,
    label: <FormattedMessage {...messages.mediaImage} />,
  },
  {
    value: VIBER_MEDIA_TYPES.VIDEO,
    label: <FormattedMessage {...messages.mediaVideo} />,
  },
];

export const buttonRadioOptions = [
  {
    value: VIBER_BUTTON_TYPES.NONE,
    label: (
      <CapHeading type="h4" className="viber-button-none">
        {<FormattedMessage {...messages.btnTypeNone} />}
      </CapHeading>
    ),
  },
  {
    value: VIBER_BUTTON_TYPES.CTA,
    label: (
      <>
        <div className="viber-button-cta">
          <CapHeading type="h4">
            {<FormattedMessage {...messages.btnTypeCTA} />}
          </CapHeading>
          <CapLabel>{<FormattedMessage {...messages.ctaDesc} />}</CapLabel>
        </div>
      </>
    ),
  },
];

export const AI_CONTENT_BOT_DISABLED = "AI_CONTENT_BOT_DISABLED";