import { PLAYER_REDUX_FIELD_NAME } from '@/modules/players/Editor/constants';

import { slice } from '../slices';
import createFormSelector from '@/modules/@common/Form/redux/selectors';

const nameSpace = slice.name;

export const activeTabIdSelector = (state) => state[nameSpace].activeTabId;

export const idSelector = (state) => state[nameSpace].id;

export const nameSelector = (state) => state[nameSpace].name;

export const statusSelector = (state) => state[nameSpace].status;

export const isLoadingSelector = (state) => state[nameSpace].isLoading;

export const abTestSelector = (state) => state[nameSpace].abTest;

export const typeSelector = (state) => state[nameSpace].type;

export const availableTemplatePlayersSelector = (state) => state[nameSpace].availableTemplatePlayers;

/// GENERAL TAB ///
export const playerTypeSelector = (state) => state[nameSpace].playerType;
export const publisherSelector = (state) => state[nameSpace].publisher;
export const publishersOptionsSelector = (state) => state[nameSpace].publishersOptions;
export const publisherDomainSelector = (state) => state[nameSpace].publisherDomain;
export const publisherDomainIdSelector = (state) => state[nameSpace].publisherDomainId;
export const publisherDomainsOptionsSelector = (state) => state[nameSpace].publisherDomainsOptions;
export const commentsSelector = (state) => state[nameSpace].comments;
export const aliasSelector = (state) => state[nameSpace].alias;

/// LOOK AND FEEL TAB ///

export const playerLreLogoSelector = (state) => state[nameSpace].playerLreLogo;

export const playerWidthUnitOptionsSelector = (state) => state[nameSpace].playerWidthUnitOptions;
export const playerWidthUnitSelector = (state) => state[nameSpace].playerWidthUnit;
export const playerWidthSelector = (state) => state[nameSpace].playerWidth;

export const playerWidthMobileUnitSelector = (state) => state[nameSpace].playerWidthMobileUnit;
export const playerWidthMobileSelector = (state) => state[nameSpace].playerWidthMobile;

export const playerAspectRatioOptionsSelector = (state) => state[nameSpace].playerAspectRatioOptions;
export const playerDynamicAspectRatioOptionsSelector = (state) => state[nameSpace].playerDynamicAspectRatioOptions;

export const playerAspectRatioSelector = (state) => state[nameSpace].playerAspectRatio;

export const brandingLeftSelector = (state) => state[nameSpace].brandingLeft;

export const carouselEnabledSelector = (state) => state[nameSpace].carouselEnabled;
export const carouselEnabledMobileSelector = (state) => state[nameSpace].carouselEnabledMobile;

export const carouselOrientationSelector = (state) => state[nameSpace].carouselOrientation;
export const carouselOrientationOptionsSelector = (state) => state[nameSpace].carouselOrientationOptions;

export const brandingRightSelector = (state) => state[nameSpace].brandingRight;
export const brandingRightDefaultSelector = (state) => state[nameSpace].brandingRightDefault;

export const closedCaptioningSelector = (state) => state[nameSpace].closedCaptioning;
export const verticalFullscreenTitleTimelineVisibilitySelector = (state) =>
  state[nameSpace].verticalFullscreenTitleTimelineVisibility;

export const swipeAnimationSelector = (state) => state[nameSpace].swipeAnimation;
export const swipeAnimationMaxVisitsSelector = (state) => state[nameSpace].swipeAnimationMaxVisits;
export const swipeAnimationDurationSelector = (state) => state[nameSpace].swipeAnimationDuration;

export const closedCaptioningOptionsSelector = (state) => state[nameSpace].closedCaptioningOptions;

export const videoResolutionControlSelector = (state) => state[nameSpace].videoResolutionControl;
export const playbackSpeedControlSelector = (state) => state[nameSpace].playbackSpeedControl;
export const fullScreenSelector = (state) => state[nameSpace].fullScreen;
export const chapteringMenuNavigationSelector = (state) => state[nameSpace].chapteringMenuNavigation;
export const theaterModeSelector = (state) => state[nameSpace].theaterMode;
export const ffRewindSelector = (state) => state[nameSpace].ffRewind;

export const socialViewButtonSelector = (state) => state[nameSpace].socialViewButton;
export const socialLikeButtonSelector = (state) => state[nameSpace].socialLikeButton;

export const xRayCampaignsEnabledSelector = (state) => state[nameSpace].xRayCampaignsEnabled;

export const leftBrandingColorSelector = (state) => state[nameSpace].leftBrandingColor;
export const leftBrandingSizeSelector = (state) => state[nameSpace].leftBrandingSize;
export const leftBrandingSizeOptionsSelector = (state) => state[nameSpace].leftBrandingSizeOptions;
export const progressBarColorSelector = (state) => state[nameSpace].progressBarColor;
export const timestampTooltipColorSelector = (state) => state[nameSpace].timestampTooltipColor;
export const volumeBarColorSelector = (state) => state[nameSpace].volumeBarColor;
export const settingsMenuHighlightColorSelector = (state) => state[nameSpace].settingsMenuHighlightColor;

/// FLOATING TAB ///

export const floatingDesktopEnabledSelector = (state) => state[nameSpace].floatingDesktopEnabled;
export const floatingDesktopEnabledOptionsSelector = (state) => state[nameSpace].floatingDesktopEnabledOptions;
export const floatingDesktopModeSelector = (state) => state[nameSpace].floatingDesktopMode;
export const floatingDesktopModeOptionsSelector = (state) => state[nameSpace].floatingDesktopModeOptions;
export const floatingDesktopPositionSelector = (state) => state[nameSpace].floatingDesktopPosition;
export const floatingDesktopPositionOptionsSelector = (state) => state[nameSpace].floatingDesktopPositionOptions;
export const floatingDesktopWidthSelector = (state) => state[nameSpace].floatingDesktopWidth;
export const floatingDesktopWidthVerticalSelector = (state) => state[nameSpace].floatingDesktopWidthVertical;
export const floatingDesktopDelaySelector = (state) => state[nameSpace].floatingDesktopDelay;

export const floatingMobileEnabledSelector = (state) => state[nameSpace].floatingMobileEnabled;
export const floatingMobileEnabledOptionsSelector = (state) => state[nameSpace].floatingMobileEnabledOptions;
export const floatingMobileModeSelector = (state) => state[nameSpace].floatingMobileMode;
export const floatingMobileModeOptionsSelector = (state) => state[nameSpace].floatingMobileModeOptions;
export const floatingMobilePositionSelector = (state) => state[nameSpace].floatingMobilePosition;
export const floatingMobilePositionOptionsSelector = (state) => state[nameSpace].floatingMobilePositionOptions;
export const floatingMobileWidthSelector = (state) => state[nameSpace].floatingMobileWidth;
export const floatingMobileWidthVerticalSelector = (state) => state[nameSpace].floatingMobileWidthVertical;
export const floatingMobileDelaySelector = (state) => state[nameSpace].floatingMobileDelay;

/// CONTENT FILTERS TAB ///

export const useDefaultContentOwnerSelector = (state) => state[nameSpace].useDefaultContentOwner;

export const playerContentOwnerFeedsSelector = (state) => state[nameSpace].playerContentOwnerFeeds;
export const playerContentOwnerFeedsOptionsSelector = (state) => state[nameSpace].playerContentOwnerFeedsOptions;
export const allFeedsSelector = (state) => state[nameSpace].allFeeds;

export const playerFeedLanguagesSelector = (state) => state[nameSpace].playerFeedLanguages;
export const feedLanguagesOptionsSelector = (state) => state[nameSpace].feedLanguagesOptions;

export const playerBrandSafetiesSelector = (state) => state[nameSpace].playerBrandSafeties;
export const playerBrandSafetiesOptionsSelector = (state) => state[nameSpace].brandSafetiesOptions;

export const boostsSelector = (state) => state[nameSpace].boosts;
export const boostsTypesOptionsSelector = (state) => state[nameSpace].boostsTypesOptions;

export const boostsListOptionsSelector = (state) => state[nameSpace].boostsListOptions;

export const enableVideoTargetingSelector = (state) => state[nameSpace].enableVideoTargeting;
export const videoFormatByDeviceSelector = (state) => state[nameSpace].videoFormatByDevice;

/// PLAYBACK TAB ///

export const autoplayOptionsSelector = (state) => state[nameSpace].autoplayOptions;
export const autoplayDesktopSelector = (state) => state[nameSpace].autoplayDesktop;
export const autoplayMobileSelector = (state) => state[nameSpace].autoplayMobile;

export const startWithSoundOptionsSelector = (state) => state[nameSpace].startWithSoundOptions;
export const startWithSoundSelector = (state) => state[nameSpace].startWithSound;
export const startWithSoundMobileSelector = (state) => state[nameSpace].startWithSoundMobile;

export const playlistLimitSelector = (state) => state[nameSpace].playlistLimit;

export const flowTermIdSelector = (state) => state[nameSpace].flowTermId;
export const flowTermsOptionsSelector = (state) => state[nameSpace].flowTermsOptions;

export const playInLoopSelector = (state) => state[nameSpace].playInLoop;
export const playInLoopOptionsSelector = (state) => state[nameSpace].playInLoopOptions;

export const loopPlaylistSelector = (state) => state[nameSpace].loopPlaylist;
export const adsOnLoopOffSelector = (state) => state[nameSpace].adsOnLoopOff;

export const clipAutomaticSkipOptionsSelector = (state) => state[nameSpace].clipAutomaticSkipOptions;
export const clipAutomaticSkipEnabledSelector = (state) => state[nameSpace].clipAutomaticSkipEnabled;
export const clipAutomaticSkipTimeToPresentSelector = (state) => state[nameSpace].clipAutomaticSkipTimeToPresent;
export const clipAutomaticSkipTimeToSkipSelector = (state) => state[nameSpace].clipAutomaticSkipTimeToSkip;

export const shufflePlaylistSelector = (state) => state[nameSpace].shufflePlaylist;

export const playerEditorialPlaylistSelector = (state) => state[nameSpace].editorialPlaylist;
export const playerEditorialPlaylistsOptionsSelector = (state) => state[nameSpace].playerEditorialPlaylistsOptions;

/// VIDEO ADS TAB ///

export const adManagerDesktopSelector = (state) => state[nameSpace].adManagerDesktop;
export const fallbackDisplayMonetizationDesktopSelector = (state) =>
  state[nameSpace].fallbackDisplayMonetizationDesktop;
export const adManagerMobileSelector = (state) => state[nameSpace].adManagerMobile;
export const fallbackDisplayMonetizationMobileSelector = (state) => state[nameSpace].fallbackDisplayMonetizationMobile;

export const clipNotInViewPlayAdsDesktopSelector = (state) => state[nameSpace].clipNotInViewPlayAdsDesktop;
export const clipNotInViewPlayAdsMobileSelector = (state) => state[nameSpace].clipNotInViewPlayAdsMobile;

export const maxAdsPerClipCheckedSelector = (state) => state[nameSpace].maxAdsPerClipChecked;

export const maxAdsPerClipSelector = (state) => state[nameSpace].maxAdsPerClip;
export const maxAdsPerClipOptionsSelector = (state) => state[nameSpace].maxAdsPerClipOptions;

export const firstAdRequestDelaySelector = (state) => state[nameSpace].firstAdRequestDelay;

export const preRollOptionsSelector = (state) => state[nameSpace].preRollOptions;
export const preRollSelector = (state) => state[nameSpace].preRoll;
export const preRollWaitMsSelector = (state) => state[nameSpace].preRollWaitMs;

export const prerollOnlySelector = (state) => state[nameSpace].prerollOnly;
export const prerollOnlyClipsCountSelector = (state) => state[nameSpace].prerollOnlyClipsCount;

export const adIndicatorSelector = (state) => state[nameSpace].adIndicator;
export const adIndicatorTextSelector = (state) => state[nameSpace].adIndicatorText;

export const skipAdButtonSelector = (state) => state[nameSpace].skipAdButton;
export const skipAdAppearAfterSelector = (state) => state[nameSpace].skipAdAppearAfter;
export const skipAdAppearAfterDefaultSelector = (state) => state[nameSpace].skipAdAppearAfterDefault;

export const inviewAdIntervalSelector = (state) => state[nameSpace].inviewAdInterval;
export const notInviewAdIntervalSelector = (state) => state[nameSpace].notInviewAdInterval;
export const inviewAdIntervalMobileSelector = (state) => state[nameSpace].inviewAdIntervalMobile;
export const notInviewAdIntervalMobileSelector = (state) => state[nameSpace].notInviewAdIntervalMobile;

/// DISPLAY ADS TAB ///

export const displayMonetizationDesktopSelector = (state) => state[nameSpace].displayMonetizationDesktop;
export const displayMonetizationMobileSelector = (state) => state[nameSpace].displayMonetizationMobile;

export const displayClipNotInViewPlayAdsDesktopSelector = (state) =>
  state[nameSpace].displayClipNotInViewPlayAdsDesktop;
export const displayClipNotInViewPlayAdsMobileSelector = (state) => state[nameSpace].displayClipNotInViewPlayAdsMobile;

export const displayInviewAdIntervalSelector = (state) => state[nameSpace].displayInviewAdInterval;
export const displayNotInviewAdIntervalSelector = (state) => state[nameSpace].displayNotInviewAdInterval;
export const displayInviewAdIntervalMobileSelector = (state) => state[nameSpace].displayInviewAdIntervalMobile;
export const displayNotInviewAdIntervalMobileSelector = (state) => state[nameSpace].displayNotInviewAdIntervalMobile;

export const playerStateSelector = (state) => state[nameSpace];

const formSelectors = createFormSelector(PLAYER_REDUX_FIELD_NAME, nameSpace);

export const scrollFieldSelector = (state) => formSelectors.getScrollField(state);
export const schemeSelector = (state) => formSelectors.schemeSelector(state);
export const fullAccessToStoreFieldsForValidation = (state) => state[nameSpace];

/// CUSTOM PLACEHOLDER TAB ///
export const customPlaceholderEnableSelector = (state) => state[nameSpace].customPlaceholderEnable;
export const selectorsSelector = (state) => state[nameSpace].selectors;
