import parseMetadataToState from '@/modules/forms/editor/helpers/metadata/v1/parseFormMetadataToState';

const parseTemplateResponseState = (res) => {
  const fromMetadata = parseMetadataToState(res.metadata);
  const [logo, banner] = res.logo;
  const initialState = {
    name: res.name,
    title: res.title,
    image: [logo, banner],
    // data gets from metadata
    description: fromMetadata.description,
    dynamicFields: fromMetadata.dynamicFields,
    privacyPolicy: fromMetadata.privacyPolicy,
    termsConditions: fromMetadata.termsConditions,
    submitButton: fromMetadata.submitButton,
    skipButton: fromMetadata.skipButton,
    style: fromMetadata.style,
  };

  return initialState;
};

export default parseTemplateResponseState;
