import PropTypes from 'prop-types';

export const logoShape = {
    src: PropTypes.string,
    alt: PropTypes.string
};
export const marketplaceNamePropTypes = PropTypes.string;

export const localeShape = {
    current: PropTypes.string,
    code: PropTypes.string,
    available: PropTypes.arrayOf(PropTypes.shape({
        value: PropTypes.string,
        label: PropTypes.string
    }))
};

const segmentShape = {
    items: PropTypes.arrayOf(PropTypes.any)
};

const hermesShape = {
    enhancedEcommerceAnalyticsEnabled: PropTypes.bool,
    hermesOnInstance: PropTypes.bool,
    hermesOnPartner: PropTypes.bool
};

const channelSupportShape = {
    contactUrl: PropTypes.string,
    email: PropTypes.string,
    phone: PropTypes.string,
    url: PropTypes.string
};

const channelSettingsShape = {
    partner: PropTypes.string,
    capabilities: PropTypes.arrayOf(PropTypes.string),
    channelCanonicalBaseUrl: PropTypes.string,
    customLogo: PropTypes.string,
    customFavicon: PropTypes.string,
    marketplaceName: PropTypes.string,
    privacyPolicyUrl: PropTypes.string,
    support: PropTypes.shape(channelSupportShape),
    reviewRequirePurchase: PropTypes.bool,
    termsUrl: PropTypes.string,
    ownerBaseUrlMap: PropTypes.string,
    importAppsEnabled: PropTypes.bool,
    isCheckoutV2Enabled: PropTypes.bool,
    isAddToCartCTAEnabled: PropTypes.bool
};

export const userShape = {
    isLoggedIn: PropTypes.bool,
    roles: PropTypes.arrayOf(PropTypes.string),
    customUserAttributes: PropTypes.shape(),
    customerContractEditionUuids: PropTypes.arrayOf(PropTypes.any),
    ownedPartners: PropTypes.arrayOf(PropTypes.any),
    segments: PropTypes.shape(segmentShape)
};

export const configShape = {
    currency: PropTypes.string,
    hermes: PropTypes.shape(hermesShape),
    locale: PropTypes.shape(localeShape),
    user: PropTypes.shape(userShape),
    marketplaceName: marketplaceNamePropTypes,
    logo: PropTypes.shape(logoShape),
    googleAnalyticsId: PropTypes.string,
    channelSettings: PropTypes.shape(channelSettingsShape),
    listingEndpoint: PropTypes.string,
    query: PropTypes.shape(PropTypes.any),
    pageId: PropTypes.string,
    canRouteToV2: PropTypes.bool
};
