/*
 * Copyright © 2016-2018 European Support Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import keyMirror from 'nfvo-utils/KeyMirror.js';

export const DATE_FORMAT = 'MM/DD/YYYY';

export const actionTypes = keyMirror({
    SET_CURRENT_SCREEN: null,
    SET_CURRENT_LICENSE_MODEL: null,
    SET_CURRENT_SCREEN_VERSION: null,
    UPDATE_CURRENT_SCREEN_PROPS: null,
    UPDATE_ITEM_STATUS: null
});

export const screenTypes = keyMirror({
    LICENSE_MODEL: null,
    SOFTWARE_PRODUCT: null,
    SOFTWARE_PRODUCT_COMPONENT_DEFAULT_GENERAL: null
});

const breadcrumbsEnum = {
    LICENSE_MODEL: 'LICENSE_MODEL',
    VERSIONS_PAGE: 'VERSIONS_PAGE',
    LICENSE_MODEL_OVERVIEW: 'LICENSE_MODEL_OVERVIEW',
    LICENSE_AGREEMENTS: 'LICENSE_AGREEMENTS',
    FEATURE_GROUPS: 'FEATURE_GROUPS',
    ENTITLEMENT_POOLS: 'ENTITLEMENT_POOLS',
    LICENSE_KEY_GROUPS: 'LICENSE_KEY_GROUPS',
    ACTIVITY_LOG: 'ACTIVITY_LOG',

    SOFTWARE_PRODUCT: 'SOFTWARE_PRODUCT',
    SOFTWARE_PRODUCT_VERSIONS_PAGE: 'SOFTWARE_PRODUCT_VERSIONS_PAGE',
    SOFTWARE_PRODUCT_LANDING_PAGE: 'SOFTWARE_PRODUCT_LANDING_PAGE',
    SOFTWARE_PRODUCT_DETAILS: 'SOFTWARE_PRODUCT_DETAILS',
    SOFTWARE_PRODUCT_ATTACHMENTS: 'SOFTWARE_PRODUCT_ATTACHMENTS',
    SOFTWARE_PRODUCT_PROCESSES: 'SOFTWARE_PRODUCT_PROCESSES',
    SOFTWARE_PRODUCT_DEPLOYMENT: 'SOFTWARE_PRODUCT_DEPLOYMENT',
    SOFTWARE_PRODUCT_NETWORKS: 'SOFTWARE_PRODUCT_NETWORKS',
    SOFTWARE_PRODUCT_DEPENDENCIES: 'SOFTWARE_PRODUCT_DEPENDENCIES',
    SOFTWARE_PRODUCT_ACTIVITY_LOG: 'SOFTWARE_PRODUCT_ACTIVITY_LOG',
    SOFTWARE_PRODUCT_COMPONENTS: 'SOFTWARE_PRODUCT_COMPONENTS',
    SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
        'SOFTWARE_PRODUCT_COMPONENT_PROCESSES',
    SOFTWARE_PRODUCT_COMPONENT_NETWORK: 'SOFTWARE_PRODUCT_COMPONENT_NETWORK',
    SOFTWARE_PRODUCT_COMPONENT_STORAGE: 'SOFTWARE_PRODUCT_COMPONENT_STORAGE',
    SOFTWARE_PRODUCT_COMPONENT_GENERAL: 'SOFTWARE_PRODUCT_COMPONENT_GENERAL',
    SOFTWARE_PRODUCT_COMPONENT_COMPUTE: 'SOFTWARE_PRODUCT_COMPONENT_COMPUTE',
    SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
        'SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING',
    SOFTWARE_PRODUCT_COMPONENT_MONITORING:
        'SOFTWARE_PRODUCT_COMPONENT_MONITORING',
    SOFTWARE_PRODUCT_COMPONENT_IMAGES: 'SOFTWARE_PRODUCT_COMPONENT_IMAGES'
};

export const enums = keyMirror({
    BREADCRUMS: { ...breadcrumbsEnum },

    SCREEN: {
        ONBOARDING_CATALOG: 'ONBOARDING_CATALOG',
        VERSIONS_PAGE: breadcrumbsEnum.VERSIONS_PAGE,
        LICENSE_MODEL_OVERVIEW: breadcrumbsEnum.LICENSE_MODEL_OVERVIEW,
        LICENSE_AGREEMENTS: breadcrumbsEnum.LICENSE_AGREEMENTS,
        FEATURE_GROUPS: breadcrumbsEnum.FEATURE_GROUPS,
        ENTITLEMENT_POOLS: breadcrumbsEnum.ENTITLEMENT_POOLS,
        LICENSE_KEY_GROUPS: breadcrumbsEnum.LICENSE_KEY_GROUPS,
        ACTIVITY_LOG: breadcrumbsEnum.ACTIVITY_LOG,

        SOFTWARE_PRODUCT_VERSIONS_PAGE:
            breadcrumbsEnum.SOFTWARE_PRODUCT_VERSIONS_PAGE,
        SOFTWARE_PRODUCT_LANDING_PAGE:
            breadcrumbsEnum.SOFTWARE_PRODUCT_LANDING_PAGE,
        SOFTWARE_PRODUCT_DETAILS: breadcrumbsEnum.SOFTWARE_PRODUCT_DETAILS,
        SOFTWARE_PRODUCT_ATTACHMENTS:
            breadcrumbsEnum.SOFTWARE_PRODUCT_ATTACHMENTS,
        SOFTWARE_PRODUCT_ATTACHMENTS_SETUP:
            'SOFTWARE_PRODUCT_ATTACHMENTS_SETUP',
        SOFTWARE_PRODUCT_ATTACHMENTS_VALIDATION:
            'SOFTWARE_PRODUCT_ATTACHMENTS_VALIDATION',
        SOFTWARE_PRODUCT_PROCESSES: breadcrumbsEnum.SOFTWARE_PRODUCT_PROCESSES,
        SOFTWARE_PRODUCT_DEPLOYMENT:
            breadcrumbsEnum.SOFTWARE_PRODUCT_DEPLOYMENT,
        SOFTWARE_PRODUCT_NETWORKS: breadcrumbsEnum.SOFTWARE_PRODUCT_NETWORKS,
        SOFTWARE_PRODUCT_DEPENDENCIES:
            breadcrumbsEnum.SOFTWARE_PRODUCT_DEPENDENCIES,
        SOFTWARE_PRODUCT_ACTIVITY_LOG:
            breadcrumbsEnum.SOFTWARE_PRODUCT_ACTIVITY_LOG,
        SOFTWARE_PRODUCT_COMPONENTS:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENTS,
        SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENT_PROCESSES,
        SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENT_COMPUTE,
        SOFTWARE_PRODUCT_COMPONENT_STORAGE:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENT_STORAGE,
        SOFTWARE_PRODUCT_COMPONENT_NETWORK:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENT_NETWORK,
        SOFTWARE_PRODUCT_COMPONENT_GENERAL:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENT_GENERAL,
        SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING,
        SOFTWARE_PRODUCT_COMPONENT_MONITORING:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENT_MONITORING,
        SOFTWARE_PRODUCT_COMPONENT_IMAGES:
            breadcrumbsEnum.SOFTWARE_PRODUCT_COMPONENT_IMAGES
    }
});
