# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

import os
from azure.cli.testsdk import ScenarioTest
from azure.cli.testsdk import ResourceGroupPreparer
from .example_steps import step_custom_rollout_create
from .example_steps import step_custom_rollout_show
from .example_steps import step_custom_rollout_list
from .example_steps import step_default_rollout_create
from .example_steps import step_default_rollout_show
from .example_steps import step_default_rollout_list
from .example_steps import step_default_rollout_stop
from .example_steps import step_default_rollout_delete
from .example_steps import step_notification_registration_create
from .example_steps import step_notification_registration_show
from .example_steps import step_notification_registration_list
from .example_steps import step_notification_registration_delete
from .example_steps import step_operation_create
from .example_steps import step_operation_list
from .example_steps import step_operation_delete
from .example_steps import step_manifest_checkin
from .example_steps import step_manifest_generate
from .example_steps import step_provider_registration_create
from .example_steps import step_provider_registration_show
from .example_steps import step_provider_registration_list
from .example_steps import step_provider_registration_generate_operation
from .example_steps import step_provider_registration_delete
from .example_steps import step_resource_type_registration_create
from .example_steps import step_resource_type_registration_show
from .example_steps import step_resource_type_registration_list
from .example_steps import step_nested_resource_type_registration_create
from .example_steps import step_nested_resource_type_registration_extensions_create
from .example_steps import step_nested_resource_type_registration_show
from .example_steps import step_nested_resource_type_registration_delete
from .example_steps import step_sku_create
from .example_steps import step_sku_create2
from .example_steps import step_sku_create3
from .example_steps import step_sku_create4
from .example_steps import step_sku_show
from .example_steps import step_sku_show_nested_resource_type_first
from .example_steps import step_sku_show_nested_resource_type_second
from .example_steps import step_sku_show_nested_resource_type_third
from .example_steps import step_sku_list
from .example_steps import step_sku_list2
from .example_steps import step_sku_list3
from .example_steps import step_sku_list4
from .example_steps import step_sku_delete
from .example_steps import step_sku_delete2
from .example_steps import step_sku_delete3
from .example_steps import step_sku_delete4
from .. import (
    try_manual,
    raise_if,
    calc_coverage
)


TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))


# Env setup_scenario
@try_manual
def setup_scenario(test_2):
    pass


# Env cleanup_scenario
@try_manual
def cleanup_scenario(test_2):
    pass


# Testcase: Scenario
@try_manual
def call_scenario(test_2):
    setup_scenario(test_2)
    step_manifest_generate(test_2, checks=[])
    step_manifest_checkin(test_2, checks=[])
    step_custom_rollout_create(test_2, checks=[])
    step_custom_rollout_show(test_2, checks=[])
    step_custom_rollout_list(test_2, checks=[])
    step_default_rollout_create(test_2, checks=[])
    step_default_rollout_show(test_2, checks=[])
    step_default_rollout_list(test_2, checks=[])
    step_default_rollout_stop(test_2, checks=[])
    step_resource_type_registration_create(test_2, checks=[])
    step_resource_type_registration_show(test_2, checks=[])
    step_resource_type_registration_list(test_2, checks=[])
    step_nested_resource_type_registration_create(test_2, checks=[])
    step_nested_resource_type_registration_extensions_create(test_2, checks=[])
    step_nested_resource_type_registration_show(test_2, checks=[])
    step_nested_resource_type_registration_delete(test_2, checks=[])
    step_default_rollout_delete(test_2, checks=[])
    step_provider_registration_create(test_2, checks=[])
    step_provider_registration_show(test_2, checks=[])
    step_provider_registration_list(test_2, checks=[])
    step_provider_registration_delete(test_2, checks=[])
    step_provider_registration_create(test_2, checks=[])
    step_provider_registration_generate_operation(test_2, checks=[])
    step_notification_registration_create(test_2, checks=[])
    step_notification_registration_show(test_2, checks=[])
    step_notification_registration_list(test_2, checks=[])
    step_notification_registration_delete(test_2, checks=[])
    step_operation_list(test_2, checks=[])
    step_operation_create(test_2, checks=[])
    step_operation_delete(test_2, checks=[])
    step_sku_create(test_2, checks=[])
    step_sku_show(test_2, checks=[])
    step_sku_list(test_2, checks=[])
    step_sku_delete(test_2, checks=[])
    cleanup_scenario(test_2)


# Test class for Scenario
@try_manual
class ProviderhubScenarioTest(ScenarioTest):

    def __init__(self, *args, **kwargs):
        super(ProviderhubScenarioTest, self).__init__(*args, **kwargs)
        self.kwargs.update({
            'subscription_id': self.get_subscription_id()
        })

        self.kwargs.update({
            'providerNamespace': 'Microsoft.Contoso',
            'resourceType': 'employees',
            'customRolloutName': 'canaryTesting01',
            'defaultRolloutName': 'cliDefaultRollout',
            'region': 'eastus2euap',
            'notificationRegistration': 'testNotificationRegistration',
            'nestedResourceType': 'nestedResourceType',
            'skuName': 'default'
        })


    @ResourceGroupPreparer(name_prefix='clitestproviderhub_mgmtexp-eastus'[:7], key='rg', parameter_name='rg')
    @ResourceGroupPreparer(name_prefix='clitestproviderhub_mgmtexp-northeurope'[:7], key='rg_2',
                           parameter_name='rg_2')
    def test_providerhub_Scenario(self_2):
        call_scenario(self_2)
        calc_coverage(__file__)
        raise_if()

