/*
 * Copyright © 2016-2017 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 Onboard from './onboard/Onboard.js';
import VersionsPage from './versionsPage/VersionsPage.js';
import LicenseModel from './licenseModel/LicenseModel.js';
import LicenseModelOverview from './licenseModel/overview/LicenseModelOverview.js';
import ActivityLog from 'sdc-app/common/activity-log/ActivityLog.js';

import LicenseAgreementListEditor from './licenseModel/licenseAgreement/LicenseAgreementListEditor.js';
import FeatureGroupListEditor from './licenseModel/featureGroups/FeatureGroupListEditor.js';
import LicenseKeyGroupsListEditor from './licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js';
import EntitlementPoolsListEditor from './licenseModel/entitlementPools/EntitlementPoolsListEditor.js';
import SoftwareProduct from './softwareProduct/SoftwareProduct.js';
import SoftwareProductLandingPage from './softwareProduct/landingPage/SoftwareProductLandingPage.js';
import SoftwareProductDetails from './softwareProduct/details/SoftwareProductDetails.js';
import SoftwareProductAttachments from './softwareProduct/attachments/SoftwareProductAttachments.js';
import SoftwareProductProcesses from './softwareProduct/processes/SoftwareProductProcesses.js';
import SoftwareProductDeployment from './softwareProduct/deployment/SoftwareProductDeployment.js';
import SoftwareProductNetworks from './softwareProduct/networks/SoftwareProductNetworks.js';
import SoftwareProductDependencies from './softwareProduct/dependencies/SoftwareProductDependencies.js';

import SoftwareProductComponentsList from './softwareProduct/components/SoftwareProductComponents.js';
import SoftwareProductComponentProcessesList from './softwareProduct/components/processes/SoftwareProductComponentProcessesList.js';
import SoftwareProductComponentStorage from './softwareProduct/components/storage/SoftwareProductComponentStorage.js';
import SoftwareProductComponentsNetworkList from './softwareProduct/components/network/SoftwareProductComponentsNetworkList.js';
import SoftwareProductComponentsGeneral from './softwareProduct/components/general/SoftwareProductComponentsGeneral.js';
import SoftwareProductComponentsCompute from './softwareProduct/components/compute/SoftwareProductComponentCompute.js';
import SoftwareProductComponentLoadBalancing from './softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancing.js';
import SoftwareProductComponentsImageList from './softwareProduct/components/images/SoftwareProductComponentsImageList.js';
import SoftwareProductComponentsMonitoring from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoring.js';
import objectValues from 'lodash/values.js';
import PropTypes from 'prop-types';

import React from 'react';

import ReactDOM from 'react-dom';
import { enums } from './OnboardingConstants.js';

export default class OnboardingView extends React.Component {
    static propTypes = {
        currentScreen: PropTypes.shape({
            screen: PropTypes.oneOf(objectValues(enums.SCREEN)).isRequired,
            props: PropTypes.object.isRequired,
            itemPermission: PropTypes.object
        }).isRequired
    };

    componentDidMount() {
        let element = ReactDOM.findDOMNode(this);
        element.addEventListener('click', event => {
            if (event.target.tagName === 'A') {
                event.preventDefault();
            }
        });
        ['wheel', 'mousewheel', 'DOMMouseScroll'].forEach(eventType =>
            element.addEventListener(eventType, event =>
                event.stopPropagation()
            )
        );
    }

    render() {
        let { currentScreen } = this.props;
        let { screen, props } = currentScreen;

        return (
            <div className="dox-ui dox-ui-punch-out dox-ui-punch-out-full-page">
                {(() => {
                    switch (screen) {
                        case enums.SCREEN.ONBOARDING_CATALOG:
                            return <Onboard {...props} />;
                        case enums.SCREEN.VERSIONS_PAGE:
                            return <VersionsPage {...props} />;

                        case enums.SCREEN.LICENSE_AGREEMENTS:
                        case enums.SCREEN.FEATURE_GROUPS:
                        case enums.SCREEN.ENTITLEMENT_POOLS:
                        case enums.SCREEN.LICENSE_KEY_GROUPS:
                        case enums.SCREEN.LICENSE_MODEL_OVERVIEW:
                        case enums.SCREEN.ACTIVITY_LOG:
                            return (
                                <LicenseModel currentScreen={currentScreen}>
                                    {(() => {
                                        switch (screen) {
                                            case enums.SCREEN
                                                .LICENSE_MODEL_OVERVIEW:
                                                return (
                                                    <LicenseModelOverview
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .LICENSE_AGREEMENTS:
                                                return (
                                                    <LicenseAgreementListEditor
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN.FEATURE_GROUPS:
                                                return (
                                                    <FeatureGroupListEditor
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN.ENTITLEMENT_POOLS:
                                                return (
                                                    <EntitlementPoolsListEditor
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .LICENSE_KEY_GROUPS:
                                                return (
                                                    <LicenseKeyGroupsListEditor
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN.ACTIVITY_LOG:
                                                return (
                                                    <ActivityLog {...props} />
                                                );
                                        }
                                    })()}
                                </LicenseModel>
                            );

                        case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE:
                        case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS:
                        case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS:
                        case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES:
                        case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT:
                        case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS:
                        case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES:
                        case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS:
                        case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
                        case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE:
                        case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK:
                        case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL:
                        case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
                        case enums.SCREEN
                            .SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
                        case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES:
                        case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING:
                        case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG:
                            return (
                                <SoftwareProduct currentScreen={currentScreen}>
                                    {(() => {
                                        switch (screen) {
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_LANDING_PAGE:
                                                return (
                                                    <SoftwareProductLandingPage
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_DETAILS:
                                                return (
                                                    <SoftwareProductDetails
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_ATTACHMENTS:
                                                return (
                                                    <SoftwareProductAttachments
                                                        className="no-padding-content-area"
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_PROCESSES:
                                                return (
                                                    <SoftwareProductProcesses
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_DEPLOYMENT:
                                                return (
                                                    <SoftwareProductDeployment
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_NETWORKS:
                                                return (
                                                    <SoftwareProductNetworks
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_DEPENDENCIES:
                                                return (
                                                    <SoftwareProductDependencies
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENTS:
                                                return (
                                                    <SoftwareProductComponentsList
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
                                                return (
                                                    <SoftwareProductComponentProcessesList
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENT_STORAGE:
                                                return (
                                                    <SoftwareProductComponentStorage
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENT_NETWORK:
                                                return (
                                                    <SoftwareProductComponentsNetworkList
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENT_GENERAL:
                                                return (
                                                    <SoftwareProductComponentsGeneral
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
                                                return (
                                                    <SoftwareProductComponentsCompute
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
                                                return (
                                                    <SoftwareProductComponentLoadBalancing
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENT_IMAGES:
                                                return (
                                                    <SoftwareProductComponentsImageList
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_COMPONENT_MONITORING:
                                                return (
                                                    <SoftwareProductComponentsMonitoring
                                                        {...props}
                                                    />
                                                );
                                            case enums.SCREEN
                                                .SOFTWARE_PRODUCT_ACTIVITY_LOG:
                                                return (
                                                    <ActivityLog {...props} />
                                                );
                                        }
                                    })()}
                                </SoftwareProduct>
                            );
                    }
                })()}
            </div>
        );
    }
}
