import { slice } from '../slices';

const nameSpace = slice.name;

export const videoSelector = (state) => state[nameSpace].video;
export const csvFileSelector = (state) => state[nameSpace].csvFile;
export const videoUrlSelector = (state) => state[nameSpace].videoUrl;
export const thumbnailSelector = (state) => state[nameSpace].thumbnail;
export const dateSelector = (state) => state[nameSpace].date;
export const titleSelector = (state) => state[nameSpace].title;
export const refIdSelector = (state) => state[nameSpace].refId;
export const descriptionSelector = (state) => state[nameSpace].description;
export const ownerSelector = (state) => state[nameSpace].owner;
export const feedSelector = (state) => state[nameSpace].feed;
export const feedListSelector = (state) => state[nameSpace].feedList;
export const languageSelector = (state) => state[nameSpace].language;
export const labelsSelector = (state) => state[nameSpace].labels;
export const keywordsSelector = (state) => state[nameSpace].keywords;
export const iabSelector = (state) => state[nameSpace].iab;
export const isNotifySelector = (state) => state[nameSpace].isNotify;
export const uploadVideoSelector = (state) => state[nameSpace].uploadVideo;
export const uploadCsvSelector = (state) => state[nameSpace].uploadCsv;
export const errorSelector = (state) => state[nameSpace].error;
export const loadingSelector = (state) => state[nameSpace].loading;
export const loadingProgressSelector = (state) => state[nameSpace].loadingProgress;
export const isOpenSelector = (state) => state[nameSpace].isOpen;
export const evergreenSelector = (state) => state[nameSpace].evergreen;
export const notesSelector = (state) => state[nameSpace].notes;
export const ccFilesSelector = (state) => state[nameSpace].ccFiles;
export const accessLevelSelector = (state) => state[nameSpace].accessLevel;
export const sitesSelector = (state) => state[nameSpace].sites;
export const sitesListSelector = (state) => state[nameSpace].sitesList;
export const activeTabSelector = (state) => state[nameSpace].activeTab;
export const queueSelector = (state) => state[nameSpace].queue;
export const uploadConfirmDialogSelector = (state) => state[nameSpace].uploadConfirmDialog;
export const sendHubsNotificationSelector = (state) => state[nameSpace].sendHubsNotification;
export const processedUploadQueueIdSelector = (state) => state[nameSpace].processedUploadQueueId;

export const isOpenVideoVersionUploadSelector = (state) => state[nameSpace].isOpenVideoVersionUpload;
export const isNotifyToAccessUsersSelector = (state) => state[nameSpace].isNotifyToAccessUsers;
export const videoVersionIdSelector = (state) => state[nameSpace].videoVersionId;
export const videoVersionNotesSelector = (state) => state[nameSpace].videoVersionNotes;

// sponsored content attribute
export const landingPageLinkSelector = (state) => state[nameSpace].landingPageLink;
export const primaryTextSelector = (state) => state[nameSpace].primaryText;
export const buttonLabelSelector = (state) => state[nameSpace].buttonLabel;
export const secondaryTextSelector = (state) => state[nameSpace].secondaryText;
export const timeToAppearSelector = (state) => state[nameSpace].timeToAppear;
export const advertiserIdSelector = (state) => state[nameSpace].advertiserId;
export const advertiserNameSelector = (state) => state[nameSpace].advertiserName;
export const advertiserLogoSelector = (state) => state[nameSpace].advertiserLogo;
export const advertiserOptionsSelector = (state) => state[nameSpace].advertiserOptions;
export const sponsoredSelector = (state) => state[nameSpace].sponsored;

export const getSelectors = (state) => ({
  date: dateSelector(state),
  description: descriptionSelector(state),
  error: errorSelector(state),
  feed: feedSelector(state),
  feedList: feedListSelector(state),
  isNotify: isNotifySelector(state),
  isOpen: isOpenSelector(state),
  labels: labelsSelector(state),
  keywords: keywordsSelector(state),
  iab: iabSelector(state),
  language: languageSelector(state),
  loading: loadingSelector(state),
  loadingProgress: loadingProgressSelector(state),
  owner: ownerSelector(state),
  refId: refIdSelector(state),
  thumbnail: thumbnailSelector(state),
  title: titleSelector(state),
  video: videoSelector(state),
  csvFile: csvFileSelector(state),
  videoUrl: videoUrlSelector(state),
  evergreen: evergreenSelector(state),
  notes: notesSelector(state),
  ccFiles: ccFilesSelector(state),
  accessLevel: accessLevelSelector(state),
  sites: sitesSelector(state),
  sitesList: sitesListSelector(state),
  activeTab: activeTabSelector(state),
  queue: queueSelector(state),
  uploadConfirmDialog: uploadConfirmDialogSelector(state),
  sendHubsNotification: sendHubsNotificationSelector(state),
  landingPageLink: landingPageLinkSelector(state),
  primaryText: primaryTextSelector(state),
  buttonLabel: buttonLabelSelector(state),
  secondaryText: secondaryTextSelector(state),
  timeToAppear: timeToAppearSelector(state),
  advertiserId: advertiserIdSelector(state),
  advertiserName: advertiserNameSelector(state),
  advertiserLogo: advertiserLogoSelector(state),
  advertiserOptions: advertiserOptionsSelector(state),
  sponsored: sponsoredSelector(state),
});

export const getCurrentUploadStateFromQueue = (state) => {
  const { queue: q, processedUploadQueueId } = state[nameSpace];
  return q[processedUploadQueueId] || {};
};
