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

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

const nameSpace = slice.name;

export const idSelector = (state) => state[nameSpace].id;
export const accountOptionsSelector = (state) => state[nameSpace].accountOptions;
// tab general
export const accountSelector = (state) => state[nameSpace].account;
export const nameSelector = (state) => state[nameSpace].name;
export const domainsSelector = (state) => state[nameSpace].domains;
export const publishSelector = (state) => state[nameSpace].publish;
// syndicate content tab
export const includePublicContentSelector = (state) => state[nameSpace].includePublicContent;
export const accountsSelector = (state) => state[nameSpace].accounts;
// player self service tab
export const selfServiceSelector = (state) => state[nameSpace].selfService;
export const templatePlayerLumXSelector = (state) => state[nameSpace].templatePlayerLumX;
export const templatePlayerLumXAmpSelector = (state) => state[nameSpace].templatePlayerLumXAmp;
export const templatePlayerLumNSelector = (state) => state[nameSpace].templatePlayerLumN;
export const templatePlayerLumNAmpSelector = (state) => state[nameSpace].templatePlayerLumNAmp;
export const templatePlayerVerticalSelector = (state) => state[nameSpace].templatePlayerVertical;
export const templatePlayerOutstreamSelector = (state) => state[nameSpace].templatePlayerOutstream;
export const templatePlayerOptionsSelector = (state) => state[nameSpace].templatePlayerOptions;
export const monetizationSelector = (state) => state[nameSpace].monetization;
export const firstLookSelector = (state) => state[nameSpace].firstLook;
export const cpmSelector = (state) => state[nameSpace].cpm;
// marketplace self-service
export const mpSelfServiceSelector = (state) => state[nameSpace].mpSelfService;
export const demandAccountSelector = (state) => state[nameSpace].demandAccount;
export const demandAccountIdSelector = (state) => state[nameSpace].demandAccountId;
export const demandAccountsOptionsSelector = (state) => state[nameSpace].demandAccountsOptions;
// advanced tab
export const pageRefreshSelector = (state) => state[nameSpace].pageRefresh;
export const refreshIntervalMinutesSelector = (state) => state[nameSpace].refreshIntervalMinutes;
export const refreshTimesLimitSelector = (state) => state[nameSpace].refreshTimesLimit;
export const ddSpecificPublisherSelector = (state) => state[nameSpace].ddSpecificPublisher;
export const defaultRuleSelector = (state) => state[nameSpace].defaultRule;
export const cleanUrlSelector = (state) => state[nameSpace].cleanUrl;

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

const formSelectors = createFormSelector(REDUX_FIELD_NAME, nameSpace);

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