/*
 * 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,
        UPDATE_ITEM_ARCHIVE_STATUS: null
    },
    'onboardingMain'
);

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
    }
});

export const onboardingActions = {
    updateItemArchivedStatus: isArchived => ({
        type: actionTypes.UPDATE_ITEM_ARCHIVE_STATUS,
        isArchived
    })
};
