import { VIDEO_ADMIN, VIDEO_FILTERS_ALL, VIDEO_FILTERS_INTERNAL_BUSINESS } from '@/modules/@common/acl/constants';

export const FILTER_COMPONENTS_NAMES = {
  FilterTimePicker: 'FilterTimePicker',
  FilterSelector: 'FilterSelector',
  FilterDatePicker: 'FilterDatePicker',
  FilterSuggester: 'FilterSuggester',
};

export const FILTERS_SHOULD_HIDE_IN_AI_BLOCK_FILTER = [
  'account',
  'verification',
  'feedType',
  'publishStatus',
  'publishPlatform',
  'uploadDate',
  'hubs',
  'sponsored',
];

export const ADDITIONAL_FILTER_NAMES = {
  [VIDEO_FILTERS_ALL]: {
    hubs: 'hubs',
    source: 'source',
    mediaType: 'mediaType',
    languages: 'languages',
    labels: 'labels',
    keywords: 'keywords',
    targetingStatus: 'targetingStatus',
    categories: 'categories',
    people: 'people',
    brands: 'brands',
    uploadDate: 'upload date',
    brandSafety: 'brand safety',
    publishStatus: 'publishStatus',
    publishPlatform: 'publishPlatform',
    evergreen: 'evergreen',
    sponsored: 'sponsored',
  },
  [VIDEO_FILTERS_INTERNAL_BUSINESS]: {
    hubs: 'hubs',
    source: 'source',
    mediaType: 'mediaType',
    languages: 'languages',
    people: 'people',
    labels: 'labels',
    keywords: 'keywords',
    targetingStatus: 'targetingStatus',
    uploadDate: 'upload date',
    evergreen: 'evergreen',
    sponsored: 'sponsored',
  },
  [VIDEO_ADMIN]: {
    account: 'account',
    status: 'status',
    hubs: 'hubs',
    source: 'source',
    verification: 'verification',
    feedType: 'feedType',
    people: 'people',
    brands: 'brands',
    languages: 'languages',
    labels: 'labels',
    publishStatus: 'publishStatus',
    publishPlatform: 'publishPlatform',
    targetingStatus: 'targetingStatus',
    categories: 'categories',
    uploadDate: 'upload date',
    brandSafety: 'brand safety',
    keywords: 'keywords',
    evergreen: 'evergreen',
    sponsored: 'sponsored',
  },
};

export const SEARCH_PARAMS_TO_NOT_EXCLUDE = ['time', 'duration', 'order', 'videoTabs'];

export const namesFilterSelectors = [
  ADDITIONAL_FILTER_NAMES[VIDEO_FILTERS_ALL].status,
  ADDITIONAL_FILTER_NAMES[VIDEO_FILTERS_ALL].feedType,
  ADDITIONAL_FILTER_NAMES[VIDEO_FILTERS_ALL].verification,
  ADDITIONAL_FILTER_NAMES[VIDEO_FILTERS_ALL].publishStatus,
  ADDITIONAL_FILTER_NAMES[VIDEO_FILTERS_ALL].publishPlatform,
  ADDITIONAL_FILTER_NAMES[VIDEO_FILTERS_ALL].evergreen,
  ADDITIONAL_FILTER_NAMES[VIDEO_FILTERS_ALL].targetingStatus,
  ADDITIONAL_FILTER_NAMES[VIDEO_FILTERS_ALL].mediaType,
];

const EVERGREEN_TYPE_ALL = 'ALL';
const EVERGREEN_TYPE_NO_EVERGREEN = 'NO_EVERGREEN';
const EVERGREEN_TYPE_EVERGREEN = 'EVERGREEN';

const PUBLISH_PLATFORM_TYPE_ANY = 'ANY';
const PUBLISH_PLATFORM_TYPE_FACEBOOK = 'FACEBOOK';
const PUBLISH_PLATFORM_TYPE_YOUTUBE = 'YOUTUBE';

const PUBLISH_STATUS_TYPE_ANY = 'ANY';
const PUBLISH_STATUS_PUBLISHED = 'PUBLISHED';
const PUBLISH_STATUS_NOT_PUBLISHED = 'UNPUBLISHED';
const PUBLISH_STATUS_PUBLISHED_PUBLISHED = 'PUBLISH_ERROR';

export const FEED_TYPE_ALL = 'ALL';
export const FEED_TYPE_VIDEO = 'VIDEO';
export const FEED_TYPE_AUDIO = 'AUDIO';
export const FEED_TYPE_VIDEO_AUDIO = 'VIDEO_AUDIO';
export const FEED_TYPE_TRENDING = 'TRENDING';

const VERIFICATION_TYPE_ALL = 'ALL';
const VERIFICATION_TYPE_APPROVED = 'APPROVED';
const VERIFICATION_TYPE_NOT_APPROVED = 'NOT_APPROVED';

const VIDEO_STATUS_ALL = 'ALL';
const VIDEO_STATUS_ACTIVE = 'ACTIVE';
const VIDEO_STATUS_DISABLED = 'DISABLED';
const VIDEO_STATUS_PROCESSING = 'PROCESSING';
const VIDEO_STATUS_FAILED = 'FAILED';

export const DEFAULT_EVERGREEN_TYPE_VALUE = EVERGREEN_TYPE_ALL;
export const DEFAULT_PUBLISH_PLATFORM_TYPE_VALUE = PUBLISH_PLATFORM_TYPE_ANY;
export const DEFAULT_PUBLISH_STATUS_TYPE_VALUE = PUBLISH_STATUS_TYPE_ANY;
export const DEFAULT_FEED_TYPE_VALUE = FEED_TYPE_VIDEO;
export const DEFAULT_MEDIA_TYPE_VALUE = FEED_TYPE_VIDEO_AUDIO;
export const DEFAULT_VERIFICATION_TYPE_VALUE = VERIFICATION_TYPE_ALL;
export const DEFAULT_VIDEO_STATUS_VALUE = VIDEO_STATUS_ALL;

export const SPONSORED_ALL = 'ALL';
export const SPONSORED_ONLY = 'SPONSORED';
export const SPONSORED_NONE = 'NONE';

export const evergreenOptions = [
  {
    label: 'All',
    value: EVERGREEN_TYPE_ALL,
  },
  {
    label: 'Non Evergreen',
    value: EVERGREEN_TYPE_NO_EVERGREEN,
  },
  {
    label: 'Evergreen',
    value: EVERGREEN_TYPE_EVERGREEN,
  },
];

export const filterPublishPlatformOptions = [
  {
    label: 'Any',
    value: PUBLISH_PLATFORM_TYPE_ANY,
  },
  {
    label: 'Facebook',
    value: PUBLISH_PLATFORM_TYPE_FACEBOOK,
  },
  {
    label: 'YouTube',
    value: PUBLISH_PLATFORM_TYPE_YOUTUBE,
  },
];

export const filterPublishStatusOptions = [
  {
    label: 'Any',
    value: PUBLISH_STATUS_TYPE_ANY,
  },
  {
    label: 'Published',
    value: PUBLISH_STATUS_PUBLISHED,
  },
  {
    label: 'Not Published',
    value: PUBLISH_STATUS_NOT_PUBLISHED,
  },
  {
    label: 'Publish Error',
    value: PUBLISH_STATUS_PUBLISHED_PUBLISHED,
  },
];

export const feedTypeOptions = [
  {
    label: 'Any',
    value: FEED_TYPE_ALL,
  },
  {
    label: 'Video',
    value: FEED_TYPE_VIDEO,
  },
  {
    label: 'Trending',
    value: FEED_TYPE_TRENDING,
  },
  {
    label: 'Audio',
    value: FEED_TYPE_AUDIO,
  },
  {
    label: 'Video+Audio',
    value: FEED_TYPE_VIDEO_AUDIO,
  },
];

export const mediaTypeOptions = [
  {
    label: 'Video+Audio',
    value: FEED_TYPE_VIDEO_AUDIO,
  },
  {
    label: 'Video',
    value: FEED_TYPE_VIDEO,
  },
  {
    label: 'Audio',
    value: FEED_TYPE_AUDIO,
  },
];

export const verificationOptions = [
  {
    label: 'Any',
    value: VERIFICATION_TYPE_ALL,
  },
  {
    label: 'Verified',
    value: VERIFICATION_TYPE_APPROVED,
  },
  {
    label: 'Un-Verified',
    value: VERIFICATION_TYPE_NOT_APPROVED,
  },
];

export const videoStatusOptions = [
  {
    label: 'Any',
    value: VIDEO_STATUS_ALL,
  },
  {
    label: 'Active',
    value: VIDEO_STATUS_ACTIVE,
  },
  {
    label: 'Archived',
    value: VIDEO_STATUS_DISABLED,
  },
  {
    label: 'Processing',
    value: VIDEO_STATUS_PROCESSING,
  },
  {
    label: 'Failed',
    value: VIDEO_STATUS_FAILED,
  },
];

export const VIDEO_TABS_ENUM = {
  all: 'ALL',
  own: 'OWN',
  shared: 'SHARED',
};

// Targeting filters
export const VIDEO_TARGETING_ANY = 'ANY';
export const VIDEO_TARGETING_NONE = 'NONE';
export const VIDEO_TARGETING_PLANNED = 'PLANNED';
export const VIDEO_TARGETING_RUNNING = 'RUNNING';
export const VIDEO_TARGETING_PAUSED = 'PAUSED';
export const VIDEO_TARGETING_STOPPED = 'STOPPED';

export const VIDEO_TARGETING_OPTIONS = [
  {
    label: 'Any',
    value: VIDEO_TARGETING_ANY,
  },
  {
    label: 'None',
    value: VIDEO_TARGETING_NONE,
  },
  {
    label: 'Planned',
    value: VIDEO_TARGETING_PLANNED,
  },
  {
    label: 'Running',
    value: VIDEO_TARGETING_RUNNING,
  },
  {
    label: 'Paused',
    value: VIDEO_TARGETING_PAUSED,
  },
  {
    label: 'Stopped',
    value: VIDEO_TARGETING_STOPPED,
  },
];

export const VIDEO_DURATION_ALL = 'ALL';
export const VIDEO_DURATION_UNDER_4_MIN = 'UNDER_4_MIN';
export const VIDEO_DURATION_4_TO_20_MIN = '4_TO_20_MIN';
export const VIDEO_DURATION_OVER_20_MIN = 'OVER_20_MIN';

export const VIDEO_DURATION_VALUES = {
  [VIDEO_DURATION_UNDER_4_MIN]: {
    from: 0,
    to: 4 * 60 * 1000 - 1,
  },
  [VIDEO_DURATION_4_TO_20_MIN]: {
    from: 4 * 60 * 1000,
    to: 20 * 60 * 1000,
  },
  [VIDEO_DURATION_OVER_20_MIN]: {
    from: 20 * 60 * 1000 + 1,
  },
};

export const VIDEO_DURATION_LABELS = {
  [VIDEO_DURATION_ALL]: 'Any Duration',
  [VIDEO_DURATION_UNDER_4_MIN]: 'Under 4 minutes',
  [VIDEO_DURATION_4_TO_20_MIN]: '4 - 20 minutes',
  [VIDEO_DURATION_OVER_20_MIN]: 'Over 20 minutes',
};

export const sponsoredOptions = [
  {
    label: 'All',
    value: SPONSORED_ALL,
  },
  {
    label: 'Sponsored Content Only',
    value: SPONSORED_ONLY,
  },
  {
    label: 'Not Sponsored Content',
    value: SPONSORED_NONE,
  },
];
