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

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

const nameSpace = slice.name;

export const typeSelector = (state) => state[nameSpace].type;
export const idSelector = (state) => state[nameSpace].id;
export const publisherIdSelector = (state) => state[nameSpace].publisherId;
export const publisherSelector = (state) => state[nameSpace].publisher;
export const nameSelector = (state) => state[nameSpace].name;
export const statusSelector = (state) => state[nameSpace].status;
export const visibilitySelector = (state) => state[nameSpace].visibility;
export const viewabilityConfigSelector = (state) => state[nameSpace].viewabilityConfig;
export const channelsSelector = (state) => state[nameSpace].channels;
export const defaultChannelSelector = (state) => state[nameSpace].defaultChannel;
export const playlistsSelector = (state) => state[nameSpace].playlists;
export const defaultPlaylistSelector = (state) => state[nameSpace].defaultPlaylist;
export const defaultChannelNameSelector = (state) => state[nameSpace].defaultChannelName;
export const defaultPlaylistNameSelector = (state) => state[nameSpace].defaultPlaylistName;
export const userNameSelector = (state) => state[nameSpace].userName;
export const pageAccessTokenSelector = (state) => state[nameSpace].pageAccessToken;
export const titleSelector = (state) => state[nameSpace].title;
export const categorySelector = (state) => state[nameSpace].category;
export const thumbnailSelector = (state) => state[nameSpace].thumbnail;
export const descriptionSelector = (state) => state[nameSpace].description;
export const languageSelector = (state) => state[nameSpace].language;
export const manualTagsSelector = (state) => state[nameSpace].manualTags;
export const autoTagsSelector = (state) => state[nameSpace].autoTags;
export const closedCaptionsSelector = (state) => state[nameSpace].closedCaptions;
export const expiryDateSelector = (state) => state[nameSpace].expiryDate;
export const accessTokenSelector = (state) => state[nameSpace].accessToken;
export const refreshTokenSelector = (state) => state[nameSpace].refreshToken;
export const isLoadingSelector = (state) => state[nameSpace].isLoading;
export const activeTabIdSelector = (state) => state[nameSpace].activeTabId;

const formSelectors = createFormSelector(DESTINATION_REDUX_FIELD_NAME, nameSpace);

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