# --------------------------------------------------------------------------
# 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_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_delete
from .example_steps import step_resource_type_registration_show
from .example_steps import step_resource_type_registration_list
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, rg):
    pass


# Env cleanup_scenario
@try_manual
def cleanup_scenario(test, rg):
    pass


# Testcase: Scenario
@try_manual
def call_scenario(test, rg):
    setup_scenario(test, rg)
    step_custom_rollout_create(test, checks=[])
    step_custom_rollout_show(test, checks=[])
    step_custom_rollout_list(test, checks=[])
    step_default_rollout_create(test, checks=[])
    step_default_rollout_list(test, checks=[])
    step_default_rollout_show(test, checks=[])
    step_default_rollout_stop(test, checks=[])
    step_default_rollout_delete(test, checks=[])
    step_manifest_generate(test, checks=[])
    step_manifest_checkin(test, checks=[])
    step_provider_registration_create(test, checks=[])
    step_provider_registration_show(test, checks=[])
    step_provider_registration_list(test, checks=[])
    step_provider_registration_delete(test, checks=[])
    step_provider_registration_create(test, checks=[])
    step_provider_registration_generate_operation(test, checks=[])
    step_resource_type_registration_create(test, checks=[])
    step_resource_type_registration_show(test, checks=[])
    step_resource_type_registration_list(test, checks=[])
    step_resource_type_registration_delete(test, checks=[])
    step_resource_type_registration_create(test, checks=[])
    cleanup_scenario(test, rg)


# 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'
        })

    @ResourceGroupPreparer(name_prefix='clitestproviderhub_sampleResourceGroup'[:7], key='rg', parameter_name='rg')
    def test_providerhub_Scenario(self, rg):
        call_scenario(self, rg)
        calc_coverage(__file__)
        raise_if()
