import { REDUX_FIELD_NAME } from '../../constants';

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

import type { RootState } from '@/modules/@common/store/store';

const nameSpace = slice.name;
const formSelectors = createFormSelector(REDUX_FIELD_NAME, nameSpace);

export const idSelector = (state: RootState) => state[nameSpace].id;
export const nameSelector = (state: RootState) => state[nameSpace].name;
export const typeSelector = (state: RootState) => state[nameSpace].type;
export const descriptionSelector = (state: RootState) => state[nameSpace].description;
export const isConnectedSelector = (state: RootState) => state[nameSpace].source.isConnected;
export const sourceSelector = (state: RootState) => state[nameSpace].source;
export const accountSelector = (state: RootState) => state[nameSpace].account;
export const langSelector = (state: RootState) => state[nameSpace].lang;
export const accessLevelSelector = (state: RootState) => state[nameSpace].accessLevel;
export const accessAllPublishersSelector = (state: RootState) => state[nameSpace].accessAllPublishers;
export const accessPublishersSelector = (state: RootState) => state[nameSpace].accessPublishers;
export const accessVideoOwnerSelector = (state: RootState) => state[nameSpace].accessVideoOwner;

export const metadataLanguagesSelector = (state: RootState) => state[nameSpace].metadata.languages;
export const metadataTimezonesSelector = (state: RootState) => state[nameSpace].metadata.timezones;
export const metadataPlatformModelsSelector = (state: RootState) => state[nameSpace].metadata.platformModels;
export const metadataSpeechToTextLanguagesSelector = (state: RootState) =>
  state[nameSpace].metadata.speechToTextLanguages;
export const platformModelsSelector = (state: RootState) => state[nameSpace].platformModels;
export const accountOptionsSelector = (state: RootState) => state[nameSpace].accountOptions;
export const activeTabIdSelector = (state: RootState) => state[nameSpace].activeTabId;
export const hubsOptionsSelector = (state: RootState) => state[nameSpace].hubsOptions;
export const ownersOptionsSelector = (state: RootState) => state[nameSpace].ownersOptions;
export const urlSelector = (state: RootState) => state[nameSpace].url;
export const userSelector = (state: RootState) => state[nameSpace].user;
export const passwordSelector = (state: RootState) => state[nameSpace].password;
export const isUseForDownloadSelector = (state: RootState) => state[nameSpace].isUseForDownload;
export const authMethodSelector = (state: RootState) => state[nameSpace].authMethod;
export const scheduleStatusSelector = (state: RootState) => state[nameSpace].scheduleStatus;
export const scheduleTypeSelector = (state: RootState) => state[nameSpace].scheduleType;
export const scheduleValueSelector = (state: RootState) => state[nameSpace].scheduleValue;
export const scheduleFrequencySelector = (state: RootState) => state[nameSpace].scheduleFrequency;
export const feedPrioritySelector = (state: RootState) => state[nameSpace].feedPriority;
export const priorityVerificationSelector = (state: RootState) => state[nameSpace].priorityVerification;
export const iabCategoriesSelector = (state: RootState) => state[nameSpace].iabCategories;
export const defaultTimezoneSelector = (state: RootState) => state[nameSpace].defaultTimezone;
export const defaultTimezoneEnabledSelector = (state: RootState) => state[nameSpace].defaultTimezoneEnabled;
export const isEvergreenFeedSelector = (state: RootState) => state[nameSpace].isEvergreenFeed;
export const isRestrictedSelector = (state: RootState) => state[nameSpace].isRestricted;
export const keywordsSelector = (state: RootState) => state[nameSpace].keywords;
export const parseKeywordsToLabelsSelector = (state: RootState) => state[nameSpace].parseKeywordsToLabels;
export const maxDurationSelector = (state: RootState) => state[nameSpace].maxDuration;
export const importPlotSelector = (state: RootState) => state[nameSpace].importPlot;
export const fileSelectionSelector = (state: RootState) => state[nameSpace].fileSelection;
export const resolutionSelector = (state: RootState) => state[nameSpace].resolution;
export const resolutionValueSelector = (state: RootState) => state[nameSpace].resolutionValue;
export const minResolutionValueSelector = (state: RootState) => state[nameSpace].minResolutionValue;
export const bitrateSelector = (state: RootState) => state[nameSpace].bitrate;
export const minBitrateSelector = (state: RootState) => state[nameSpace].minBitrate;
export const videoFileTypeSelector = (state: RootState) => state[nameSpace].videoFileType;
export const maxStoriesSelector = (state: RootState) => state[nameSpace].maxStories;
export const videoDurationSelector = (state: RootState) => state[nameSpace].videoDuration;
export const aspectRatioSelector = (state: RootState) => state[nameSpace].aspectRatio;
export const fitSelector = (state: RootState) => state[nameSpace].fit;
export const videoMaxZoomSelector = (state: RootState) => state[nameSpace].videoMaxZoom;

export const importCCFromMrssFileSelector = (state: RootState) => state[nameSpace].importCCFromMrssFile;
export const createClipSelector = (state: RootState) => state[nameSpace].createClip;
export const skipTaggingForLongClipsSelector = (state: RootState) => state[nameSpace].skipTaggingForLongClips;
export const maxDurationForTaggingSelector = (state: RootState) => state[nameSpace].maxDurationForTagging;
export const immediateAvailabilitySelector = (state: RootState) => state[nameSpace].immediateAvailability;
export const processVideoVersionsSelector = (state: RootState) => state[nameSpace].processVideoVersions;
export const versionAttributeNameSelector = (state: RootState) => state[nameSpace].versionAttributeName;
export const automationScriptSelector = (state: RootState) => state[nameSpace].automationScript;
export const speechToTextProviderSelector = (state: RootState) => state[nameSpace].speechToTextProvider;
export const jsRenderingSelector = (state: RootState) => state[nameSpace].jsRendering;
export const loadFromLastDaysSelector = (state: RootState) => state[nameSpace].loadFromLastDays;
export const discardLongClipsSelector = (state: RootState) => state[nameSpace].discardLongClips;
export const fillLandingPageSelector = (state: RootState) => state[nameSpace].fillLandingPage;
export const youtubeContentTypeSelector = (state: RootState) => state[nameSpace].youtubeContentType;
export const youTubeChannelIdSelector = (state: RootState) => state[nameSpace].youTubeChannelId;
export const youTubeLoadFromDateSelector = (state: RootState) => state[nameSpace].youTubeLoadFromDate;
export const contentTypeSelector = (state: RootState) => state[nameSpace].contentType;
export const importShortsThumbnailSelector = (state: RootState) => state[nameSpace].importShortsThumbnail;

export const oAuthClientIdSelector = (state: RootState) => state[nameSpace].oAuthClientId;
export const oAuthTokenSelector = (state: RootState) => state[nameSpace].oAuthToken;

export const isSelfServeUserSelector = (state: RootState) => state[nameSpace].isSelfServeUser;
export const statusSelector = (state: RootState) => state[nameSpace].status;
export const contentOwnerIsPublicSelector = (state: RootState) => state[nameSpace].contentOwnerIsPublic;

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