import { createSelector } from 'reselect';

/**
 * Direct selector to the create state domain
 */
const selectCreateDomain = () => (state) => state.get('weChatRichmediaCreate');
const selectTemplatesDomain = (state) => state.get('templates');
/**
 * Other specific selectors
 */
const makeSelectTemplates = () => createSelector(
  selectTemplatesDomain,
  (globalState) => globalState.toJS()
);
const getAssetDetails = () => createSelector(
  makeSelectCreate(),
  (substate) => substate.uploadedAssetData || null,
);
const getContentAssetDetails = () => createSelector(
  makeSelectCreate(),
  (substate) => substate.uploadedContentAssetData || null,
);
/**
 * Default selector used by Create
 */

const makeSelectCreate = () => createSelector(
  selectCreateDomain(),
  (substate) => substate.toJS()
);

export default makeSelectCreate;
export {
  makeSelectTemplates,
  getAssetDetails,
  getContentAssetDetails,
};
