# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command(
    "workloads sap-virtual-instance wait",
)
class Wait(AAZWaitCommand):
    """Place the CLI in a waiting state until a condition is met.
    """

    _aaz_info = {
        "resources": [
            ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.workloads/sapvirtualinstances/{}", "2023-04-01"],
        ]
    }

    def _handler(self, command_args):
        super()._handler(command_args)
        self._execute_operations()
        return self._output()

    _args_schema = None

    @classmethod
    def _build_arguments_schema(cls, *args, **kwargs):
        if cls._args_schema is not None:
            return cls._args_schema
        cls._args_schema = super()._build_arguments_schema(*args, **kwargs)

        # define Arg Group ""

        _args_schema = cls._args_schema
        _args_schema.resource_group = AAZResourceGroupNameArg(
            required=True,
        )
        _args_schema.sap_virtual_instance_name = AAZStrArg(
            options=["-n", "--name", "--sap-virtual-instance-name"],
            help="The name of the Virtual Instances for SAP solutions resource",
            required=True,
            id_part="name",
        )
        return cls._args_schema

    def _execute_operations(self):
        self.pre_operations()
        self.SAPVirtualInstancesGet(ctx=self.ctx)()
        self.post_operations()

    @register_callback
    def pre_operations(self):
        pass

    @register_callback
    def post_operations(self):
        pass

    def _output(self, *args, **kwargs):
        result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False)
        return result

    class SAPVirtualInstancesGet(AAZHttpOperation):
        CLIENT_TYPE = "MgmtClient"

        def __call__(self, *args, **kwargs):
            request = self.make_request()
            session = self.client.send_request(request=request, stream=False, **kwargs)
            if session.http_response.status_code in [200]:
                return self.on_200(session)

            return self.on_error(session.http_response)

        @property
        def url(self):
            return self.client.format_url(
                "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}",
                **self.url_parameters
            )

        @property
        def method(self):
            return "GET"

        @property
        def error_format(self):
            return "MgmtErrorFormat"

        @property
        def url_parameters(self):
            parameters = {
                **self.serialize_url_param(
                    "resourceGroupName", self.ctx.args.resource_group,
                    required=True,
                ),
                **self.serialize_url_param(
                    "sapVirtualInstanceName", self.ctx.args.sap_virtual_instance_name,
                    required=True,
                ),
                **self.serialize_url_param(
                    "subscriptionId", self.ctx.subscription_id,
                    required=True,
                ),
            }
            return parameters

        @property
        def query_parameters(self):
            parameters = {
                **self.serialize_query_param(
                    "api-version", "2023-04-01",
                    required=True,
                ),
            }
            return parameters

        @property
        def header_parameters(self):
            parameters = {
                **self.serialize_header_param(
                    "Accept", "application/json",
                ),
            }
            return parameters

        def on_200(self, session):
            data = self.deserialize_http_content(session)
            self.ctx.set_var(
                "instance",
                data,
                schema_builder=self._build_schema_on_200
            )

        _schema_on_200 = None

        @classmethod
        def _build_schema_on_200(cls):
            if cls._schema_on_200 is not None:
                return cls._schema_on_200

            cls._schema_on_200 = AAZObjectType()

            _schema_on_200 = cls._schema_on_200
            _schema_on_200.id = AAZStrType(
                flags={"read_only": True},
            )
            _schema_on_200.identity = AAZObjectType()
            _schema_on_200.location = AAZStrType(
                flags={"required": True},
            )
            _schema_on_200.name = AAZStrType(
                flags={"read_only": True},
            )
            _schema_on_200.properties = AAZObjectType(
                flags={"required": True, "client_flatten": True},
            )
            _schema_on_200.system_data = AAZObjectType(
                serialized_name="systemData",
                flags={"read_only": True},
            )
            _schema_on_200.tags = AAZDictType()
            _schema_on_200.type = AAZStrType(
                flags={"read_only": True},
            )

            identity = cls._schema_on_200.identity
            identity.type = AAZStrType(
                flags={"required": True},
            )
            identity.user_assigned_identities = AAZDictType(
                serialized_name="userAssignedIdentities",
            )

            user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities
            user_assigned_identities.Element = AAZObjectType()

            _element = cls._schema_on_200.identity.user_assigned_identities.Element
            _element.client_id = AAZStrType(
                serialized_name="clientId",
                flags={"read_only": True},
            )
            _element.principal_id = AAZStrType(
                serialized_name="principalId",
                flags={"read_only": True},
            )

            properties = cls._schema_on_200.properties
            properties.configuration = AAZObjectType(
                flags={"required": True},
            )
            properties.environment = AAZStrType(
                flags={"required": True},
            )
            properties.errors = AAZObjectType()
            properties.health = AAZStrType()
            properties.managed_resource_group_configuration = AAZObjectType(
                serialized_name="managedResourceGroupConfiguration",
            )
            properties.provisioning_state = AAZStrType(
                serialized_name="provisioningState",
                flags={"read_only": True},
            )
            properties.sap_product = AAZStrType(
                serialized_name="sapProduct",
                flags={"required": True},
            )
            properties.state = AAZStrType()
            properties.status = AAZStrType()

            configuration = cls._schema_on_200.properties.configuration
            configuration.configuration_type = AAZStrType(
                serialized_name="configurationType",
                flags={"required": True},
            )

            disc_deployment = cls._schema_on_200.properties.configuration.discriminate_by("configuration_type", "Deployment")
            disc_deployment.app_location = AAZStrType(
                serialized_name="appLocation",
            )
            disc_deployment.infrastructure_configuration = AAZObjectType(
                serialized_name="infrastructureConfiguration",
            )
            _WaitHelper._build_schema_infrastructure_configuration_read(disc_deployment.infrastructure_configuration)
            disc_deployment.software_configuration = AAZObjectType(
                serialized_name="softwareConfiguration",
            )
            _WaitHelper._build_schema_software_configuration_read(disc_deployment.software_configuration)

            disc_deployment_with_os_config = cls._schema_on_200.properties.configuration.discriminate_by("configuration_type", "DeploymentWithOSConfig")
            disc_deployment_with_os_config.app_location = AAZStrType(
                serialized_name="appLocation",
            )
            disc_deployment_with_os_config.infrastructure_configuration = AAZObjectType(
                serialized_name="infrastructureConfiguration",
            )
            _WaitHelper._build_schema_infrastructure_configuration_read(disc_deployment_with_os_config.infrastructure_configuration)
            disc_deployment_with_os_config.os_sap_configuration = AAZObjectType(
                serialized_name="osSapConfiguration",
            )
            disc_deployment_with_os_config.software_configuration = AAZObjectType(
                serialized_name="softwareConfiguration",
            )
            _WaitHelper._build_schema_software_configuration_read(disc_deployment_with_os_config.software_configuration)

            os_sap_configuration = cls._schema_on_200.properties.configuration.discriminate_by("configuration_type", "DeploymentWithOSConfig").os_sap_configuration
            os_sap_configuration.deployer_vm_packages = AAZObjectType(
                serialized_name="deployerVmPackages",
            )
            os_sap_configuration.sap_fqdn = AAZStrType(
                serialized_name="sapFqdn",
            )

            deployer_vm_packages = cls._schema_on_200.properties.configuration.discriminate_by("configuration_type", "DeploymentWithOSConfig").os_sap_configuration.deployer_vm_packages
            deployer_vm_packages.storage_account_id = AAZStrType(
                serialized_name="storageAccountId",
            )
            deployer_vm_packages.url = AAZStrType()

            disc_discovery = cls._schema_on_200.properties.configuration.discriminate_by("configuration_type", "Discovery")
            disc_discovery.app_location = AAZStrType(
                serialized_name="appLocation",
                flags={"read_only": True},
            )
            disc_discovery.central_server_vm_id = AAZStrType(
                serialized_name="centralServerVmId",
            )
            disc_discovery.managed_rg_storage_account_name = AAZStrType(
                serialized_name="managedRgStorageAccountName",
            )

            errors = cls._schema_on_200.properties.errors
            errors.properties = AAZObjectType()
            _WaitHelper._build_schema_error_definition_read(errors.properties)

            managed_resource_group_configuration = cls._schema_on_200.properties.managed_resource_group_configuration
            managed_resource_group_configuration.name = AAZStrType()

            system_data = cls._schema_on_200.system_data
            system_data.created_at = AAZStrType(
                serialized_name="createdAt",
            )
            system_data.created_by = AAZStrType(
                serialized_name="createdBy",
            )
            system_data.created_by_type = AAZStrType(
                serialized_name="createdByType",
            )
            system_data.last_modified_at = AAZStrType(
                serialized_name="lastModifiedAt",
            )
            system_data.last_modified_by = AAZStrType(
                serialized_name="lastModifiedBy",
            )
            system_data.last_modified_by_type = AAZStrType(
                serialized_name="lastModifiedByType",
            )

            tags = cls._schema_on_200.tags
            tags.Element = AAZStrType()

            return cls._schema_on_200


class _WaitHelper:
    """Helper class for Wait"""

    _schema_disk_configuration_read = None

    @classmethod
    def _build_schema_disk_configuration_read(cls, _schema):
        if cls._schema_disk_configuration_read is not None:
            _schema.disk_volume_configurations = cls._schema_disk_configuration_read.disk_volume_configurations
            return

        cls._schema_disk_configuration_read = _schema_disk_configuration_read = AAZObjectType()

        disk_configuration_read = _schema_disk_configuration_read
        disk_configuration_read.disk_volume_configurations = AAZDictType(
            serialized_name="diskVolumeConfigurations",
        )

        disk_volume_configurations = _schema_disk_configuration_read.disk_volume_configurations
        disk_volume_configurations.Element = AAZObjectType()

        _element = _schema_disk_configuration_read.disk_volume_configurations.Element
        _element.count = AAZIntType()
        _element.size_gb = AAZIntType(
            serialized_name="sizeGB",
        )
        _element.sku = AAZObjectType()

        sku = _schema_disk_configuration_read.disk_volume_configurations.Element.sku
        sku.name = AAZStrType()

        _schema.disk_volume_configurations = cls._schema_disk_configuration_read.disk_volume_configurations

    _schema_error_definition_read = None

    @classmethod
    def _build_schema_error_definition_read(cls, _schema):
        if cls._schema_error_definition_read is not None:
            _schema.code = cls._schema_error_definition_read.code
            _schema.details = cls._schema_error_definition_read.details
            _schema.message = cls._schema_error_definition_read.message
            return

        cls._schema_error_definition_read = _schema_error_definition_read = AAZObjectType()

        error_definition_read = _schema_error_definition_read
        error_definition_read.code = AAZStrType(
            flags={"read_only": True},
        )
        error_definition_read.details = AAZListType(
            flags={"read_only": True},
        )
        error_definition_read.message = AAZStrType(
            flags={"read_only": True},
        )

        details = _schema_error_definition_read.details
        details.Element = AAZObjectType()
        cls._build_schema_error_definition_read(details.Element)

        _schema.code = cls._schema_error_definition_read.code
        _schema.details = cls._schema_error_definition_read.details
        _schema.message = cls._schema_error_definition_read.message

    _schema_high_availability_software_configuration_read = None

    @classmethod
    def _build_schema_high_availability_software_configuration_read(cls, _schema):
        if cls._schema_high_availability_software_configuration_read is not None:
            _schema.fencing_client_id = cls._schema_high_availability_software_configuration_read.fencing_client_id
            _schema.fencing_client_password = cls._schema_high_availability_software_configuration_read.fencing_client_password
            return

        cls._schema_high_availability_software_configuration_read = _schema_high_availability_software_configuration_read = AAZObjectType()

        high_availability_software_configuration_read = _schema_high_availability_software_configuration_read
        high_availability_software_configuration_read.fencing_client_id = AAZStrType(
            serialized_name="fencingClientId",
            flags={"required": True},
        )
        high_availability_software_configuration_read.fencing_client_password = AAZStrType(
            serialized_name="fencingClientPassword",
            flags={"required": True},
        )

        _schema.fencing_client_id = cls._schema_high_availability_software_configuration_read.fencing_client_id
        _schema.fencing_client_password = cls._schema_high_availability_software_configuration_read.fencing_client_password

    _schema_infrastructure_configuration_read = None

    @classmethod
    def _build_schema_infrastructure_configuration_read(cls, _schema):
        if cls._schema_infrastructure_configuration_read is not None:
            _schema.app_resource_group = cls._schema_infrastructure_configuration_read.app_resource_group
            _schema.deployment_type = cls._schema_infrastructure_configuration_read.deployment_type
            _schema.discriminate_by(
                "deployment_type",
                "SingleServer",
                cls._schema_infrastructure_configuration_read.discriminate_by(
                    "deployment_type",
                    "SingleServer",
                )
            )
            _schema.discriminate_by(
                "deployment_type",
                "ThreeTier",
                cls._schema_infrastructure_configuration_read.discriminate_by(
                    "deployment_type",
                    "ThreeTier",
                )
            )
            return

        cls._schema_infrastructure_configuration_read = _schema_infrastructure_configuration_read = AAZObjectType()

        infrastructure_configuration_read = _schema_infrastructure_configuration_read
        infrastructure_configuration_read.app_resource_group = AAZStrType(
            serialized_name="appResourceGroup",
            flags={"required": True},
        )
        infrastructure_configuration_read.deployment_type = AAZStrType(
            serialized_name="deploymentType",
            flags={"required": True},
        )

        disc_single_server = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "SingleServer")
        disc_single_server.custom_resource_names = AAZObjectType(
            serialized_name="customResourceNames",
        )
        disc_single_server.database_type = AAZStrType(
            serialized_name="databaseType",
        )
        disc_single_server.db_disk_configuration = AAZObjectType(
            serialized_name="dbDiskConfiguration",
        )
        cls._build_schema_disk_configuration_read(disc_single_server.db_disk_configuration)
        disc_single_server.network_configuration = AAZObjectType(
            serialized_name="networkConfiguration",
        )
        cls._build_schema_network_configuration_read(disc_single_server.network_configuration)
        disc_single_server.subnet_id = AAZStrType(
            serialized_name="subnetId",
            flags={"required": True},
        )
        disc_single_server.virtual_machine_configuration = AAZObjectType(
            serialized_name="virtualMachineConfiguration",
            flags={"required": True},
        )
        cls._build_schema_virtual_machine_configuration_read(disc_single_server.virtual_machine_configuration)

        custom_resource_names = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "SingleServer").custom_resource_names
        custom_resource_names.naming_pattern_type = AAZStrType(
            serialized_name="namingPatternType",
            flags={"required": True},
        )

        disc_full_resource_name = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "SingleServer").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName")
        disc_full_resource_name.virtual_machine = AAZObjectType(
            serialized_name="virtualMachine",
        )
        cls._build_schema_virtual_machine_resource_names_read(disc_full_resource_name.virtual_machine)

        disc_three_tier = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier")
        disc_three_tier.application_server = AAZObjectType(
            serialized_name="applicationServer",
            flags={"required": True},
        )
        disc_three_tier.central_server = AAZObjectType(
            serialized_name="centralServer",
            flags={"required": True},
        )
        disc_three_tier.custom_resource_names = AAZObjectType(
            serialized_name="customResourceNames",
        )
        disc_three_tier.database_server = AAZObjectType(
            serialized_name="databaseServer",
            flags={"required": True},
        )
        disc_three_tier.high_availability_config = AAZObjectType(
            serialized_name="highAvailabilityConfig",
        )
        disc_three_tier.network_configuration = AAZObjectType(
            serialized_name="networkConfiguration",
        )
        cls._build_schema_network_configuration_read(disc_three_tier.network_configuration)
        disc_three_tier.storage_configuration = AAZObjectType(
            serialized_name="storageConfiguration",
        )

        application_server = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").application_server
        application_server.instance_count = AAZIntType(
            serialized_name="instanceCount",
            flags={"required": True},
        )
        application_server.subnet_id = AAZStrType(
            serialized_name="subnetId",
            flags={"required": True},
        )
        application_server.virtual_machine_configuration = AAZObjectType(
            serialized_name="virtualMachineConfiguration",
            flags={"required": True},
        )
        cls._build_schema_virtual_machine_configuration_read(application_server.virtual_machine_configuration)

        central_server = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").central_server
        central_server.instance_count = AAZIntType(
            serialized_name="instanceCount",
            flags={"required": True},
        )
        central_server.subnet_id = AAZStrType(
            serialized_name="subnetId",
            flags={"required": True},
        )
        central_server.virtual_machine_configuration = AAZObjectType(
            serialized_name="virtualMachineConfiguration",
            flags={"required": True},
        )
        cls._build_schema_virtual_machine_configuration_read(central_server.virtual_machine_configuration)

        custom_resource_names = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names
        custom_resource_names.naming_pattern_type = AAZStrType(
            serialized_name="namingPatternType",
            flags={"required": True},
        )

        disc_full_resource_name = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName")
        disc_full_resource_name.application_server = AAZObjectType(
            serialized_name="applicationServer",
        )
        disc_full_resource_name.central_server = AAZObjectType(
            serialized_name="centralServer",
        )
        disc_full_resource_name.database_server = AAZObjectType(
            serialized_name="databaseServer",
        )
        disc_full_resource_name.shared_storage = AAZObjectType(
            serialized_name="sharedStorage",
        )

        application_server = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName").application_server
        application_server.availability_set_name = AAZStrType(
            serialized_name="availabilitySetName",
        )
        application_server.virtual_machines = AAZListType(
            serialized_name="virtualMachines",
        )

        virtual_machines = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName").application_server.virtual_machines
        virtual_machines.Element = AAZObjectType()
        cls._build_schema_virtual_machine_resource_names_read(virtual_machines.Element)

        central_server = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName").central_server
        central_server.availability_set_name = AAZStrType(
            serialized_name="availabilitySetName",
        )
        central_server.load_balancer = AAZObjectType(
            serialized_name="loadBalancer",
        )
        cls._build_schema_load_balancer_resource_names_read(central_server.load_balancer)
        central_server.virtual_machines = AAZListType(
            serialized_name="virtualMachines",
        )

        virtual_machines = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName").central_server.virtual_machines
        virtual_machines.Element = AAZObjectType()
        cls._build_schema_virtual_machine_resource_names_read(virtual_machines.Element)

        database_server = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName").database_server
        database_server.availability_set_name = AAZStrType(
            serialized_name="availabilitySetName",
        )
        database_server.load_balancer = AAZObjectType(
            serialized_name="loadBalancer",
        )
        cls._build_schema_load_balancer_resource_names_read(database_server.load_balancer)
        database_server.virtual_machines = AAZListType(
            serialized_name="virtualMachines",
        )

        virtual_machines = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName").database_server.virtual_machines
        virtual_machines.Element = AAZObjectType()
        cls._build_schema_virtual_machine_resource_names_read(virtual_machines.Element)

        shared_storage = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").custom_resource_names.discriminate_by("naming_pattern_type", "FullResourceName").shared_storage
        shared_storage.shared_storage_account_name = AAZStrType(
            serialized_name="sharedStorageAccountName",
        )
        shared_storage.shared_storage_account_private_end_point_name = AAZStrType(
            serialized_name="sharedStorageAccountPrivateEndPointName",
        )

        database_server = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").database_server
        database_server.database_type = AAZStrType(
            serialized_name="databaseType",
        )
        database_server.disk_configuration = AAZObjectType(
            serialized_name="diskConfiguration",
        )
        cls._build_schema_disk_configuration_read(database_server.disk_configuration)
        database_server.instance_count = AAZIntType(
            serialized_name="instanceCount",
            flags={"required": True},
        )
        database_server.subnet_id = AAZStrType(
            serialized_name="subnetId",
            flags={"required": True},
        )
        database_server.virtual_machine_configuration = AAZObjectType(
            serialized_name="virtualMachineConfiguration",
            flags={"required": True},
        )
        cls._build_schema_virtual_machine_configuration_read(database_server.virtual_machine_configuration)

        high_availability_config = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").high_availability_config
        high_availability_config.high_availability_type = AAZStrType(
            serialized_name="highAvailabilityType",
            flags={"required": True},
        )

        storage_configuration = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").storage_configuration
        storage_configuration.transport_file_share_configuration = AAZObjectType(
            serialized_name="transportFileShareConfiguration",
        )

        transport_file_share_configuration = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").storage_configuration.transport_file_share_configuration
        transport_file_share_configuration.configuration_type = AAZStrType(
            serialized_name="configurationType",
            flags={"required": True},
        )

        disc_create_and_mount = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").storage_configuration.transport_file_share_configuration.discriminate_by("configuration_type", "CreateAndMount")
        disc_create_and_mount.resource_group = AAZStrType(
            serialized_name="resourceGroup",
        )
        disc_create_and_mount.storage_account_name = AAZStrType(
            serialized_name="storageAccountName",
        )

        disc_mount = _schema_infrastructure_configuration_read.discriminate_by("deployment_type", "ThreeTier").storage_configuration.transport_file_share_configuration.discriminate_by("configuration_type", "Mount")
        disc_mount.id = AAZStrType(
            flags={"required": True},
        )
        disc_mount.private_endpoint_id = AAZStrType(
            serialized_name="privateEndpointId",
            flags={"required": True},
        )

        _schema.app_resource_group = cls._schema_infrastructure_configuration_read.app_resource_group
        _schema.deployment_type = cls._schema_infrastructure_configuration_read.deployment_type
        _schema.discriminate_by(
                "deployment_type",
                "SingleServer",
                cls._schema_infrastructure_configuration_read.discriminate_by(
                    "deployment_type",
                    "SingleServer",
                )
            )
        _schema.discriminate_by(
                "deployment_type",
                "ThreeTier",
                cls._schema_infrastructure_configuration_read.discriminate_by(
                    "deployment_type",
                    "ThreeTier",
                )
            )

    _schema_load_balancer_resource_names_read = None

    @classmethod
    def _build_schema_load_balancer_resource_names_read(cls, _schema):
        if cls._schema_load_balancer_resource_names_read is not None:
            _schema.backend_pool_names = cls._schema_load_balancer_resource_names_read.backend_pool_names
            _schema.frontend_ip_configuration_names = cls._schema_load_balancer_resource_names_read.frontend_ip_configuration_names
            _schema.health_probe_names = cls._schema_load_balancer_resource_names_read.health_probe_names
            _schema.load_balancer_name = cls._schema_load_balancer_resource_names_read.load_balancer_name
            return

        cls._schema_load_balancer_resource_names_read = _schema_load_balancer_resource_names_read = AAZObjectType()

        load_balancer_resource_names_read = _schema_load_balancer_resource_names_read
        load_balancer_resource_names_read.backend_pool_names = AAZListType(
            serialized_name="backendPoolNames",
        )
        load_balancer_resource_names_read.frontend_ip_configuration_names = AAZListType(
            serialized_name="frontendIpConfigurationNames",
        )
        load_balancer_resource_names_read.health_probe_names = AAZListType(
            serialized_name="healthProbeNames",
        )
        load_balancer_resource_names_read.load_balancer_name = AAZStrType(
            serialized_name="loadBalancerName",
        )

        backend_pool_names = _schema_load_balancer_resource_names_read.backend_pool_names
        backend_pool_names.Element = AAZStrType()

        frontend_ip_configuration_names = _schema_load_balancer_resource_names_read.frontend_ip_configuration_names
        frontend_ip_configuration_names.Element = AAZStrType()

        health_probe_names = _schema_load_balancer_resource_names_read.health_probe_names
        health_probe_names.Element = AAZStrType()

        _schema.backend_pool_names = cls._schema_load_balancer_resource_names_read.backend_pool_names
        _schema.frontend_ip_configuration_names = cls._schema_load_balancer_resource_names_read.frontend_ip_configuration_names
        _schema.health_probe_names = cls._schema_load_balancer_resource_names_read.health_probe_names
        _schema.load_balancer_name = cls._schema_load_balancer_resource_names_read.load_balancer_name

    _schema_network_configuration_read = None

    @classmethod
    def _build_schema_network_configuration_read(cls, _schema):
        if cls._schema_network_configuration_read is not None:
            _schema.is_secondary_ip_enabled = cls._schema_network_configuration_read.is_secondary_ip_enabled
            return

        cls._schema_network_configuration_read = _schema_network_configuration_read = AAZObjectType()

        network_configuration_read = _schema_network_configuration_read
        network_configuration_read.is_secondary_ip_enabled = AAZBoolType(
            serialized_name="isSecondaryIpEnabled",
        )

        _schema.is_secondary_ip_enabled = cls._schema_network_configuration_read.is_secondary_ip_enabled

    _schema_software_configuration_read = None

    @classmethod
    def _build_schema_software_configuration_read(cls, _schema):
        if cls._schema_software_configuration_read is not None:
            _schema.software_installation_type = cls._schema_software_configuration_read.software_installation_type
            _schema.discriminate_by(
                "software_installation_type",
                "External",
                cls._schema_software_configuration_read.discriminate_by(
                    "software_installation_type",
                    "External",
                )
            )
            _schema.discriminate_by(
                "software_installation_type",
                "SAPInstallWithoutOSConfig",
                cls._schema_software_configuration_read.discriminate_by(
                    "software_installation_type",
                    "SAPInstallWithoutOSConfig",
                )
            )
            _schema.discriminate_by(
                "software_installation_type",
                "ServiceInitiated",
                cls._schema_software_configuration_read.discriminate_by(
                    "software_installation_type",
                    "ServiceInitiated",
                )
            )
            return

        cls._schema_software_configuration_read = _schema_software_configuration_read = AAZObjectType()

        software_configuration_read = _schema_software_configuration_read
        software_configuration_read.software_installation_type = AAZStrType(
            serialized_name="softwareInstallationType",
            flags={"required": True},
        )

        disc_external = _schema_software_configuration_read.discriminate_by("software_installation_type", "External")
        disc_external.central_server_vm_id = AAZStrType(
            serialized_name="centralServerVmId",
        )

        disc_sap_install_without_os_config = _schema_software_configuration_read.discriminate_by("software_installation_type", "SAPInstallWithoutOSConfig")
        disc_sap_install_without_os_config.bom_url = AAZStrType(
            serialized_name="bomUrl",
            flags={"required": True},
        )
        disc_sap_install_without_os_config.high_availability_software_configuration = AAZObjectType(
            serialized_name="highAvailabilitySoftwareConfiguration",
        )
        cls._build_schema_high_availability_software_configuration_read(disc_sap_install_without_os_config.high_availability_software_configuration)
        disc_sap_install_without_os_config.sap_bits_storage_account_id = AAZStrType(
            serialized_name="sapBitsStorageAccountId",
            flags={"required": True},
        )
        disc_sap_install_without_os_config.software_version = AAZStrType(
            serialized_name="softwareVersion",
            flags={"required": True},
        )

        disc_service_initiated = _schema_software_configuration_read.discriminate_by("software_installation_type", "ServiceInitiated")
        disc_service_initiated.bom_url = AAZStrType(
            serialized_name="bomUrl",
            flags={"required": True},
        )
        disc_service_initiated.high_availability_software_configuration = AAZObjectType(
            serialized_name="highAvailabilitySoftwareConfiguration",
        )
        cls._build_schema_high_availability_software_configuration_read(disc_service_initiated.high_availability_software_configuration)
        disc_service_initiated.sap_bits_storage_account_id = AAZStrType(
            serialized_name="sapBitsStorageAccountId",
            flags={"required": True},
        )
        disc_service_initiated.sap_fqdn = AAZStrType(
            serialized_name="sapFqdn",
            flags={"required": True},
        )
        disc_service_initiated.software_version = AAZStrType(
            serialized_name="softwareVersion",
            flags={"required": True},
        )
        disc_service_initiated.ssh_private_key = AAZStrType(
            serialized_name="sshPrivateKey",
            flags={"required": True},
        )

        _schema.software_installation_type = cls._schema_software_configuration_read.software_installation_type
        _schema.discriminate_by(
                "software_installation_type",
                "External",
                cls._schema_software_configuration_read.discriminate_by(
                    "software_installation_type",
                    "External",
                )
            )
        _schema.discriminate_by(
                "software_installation_type",
                "SAPInstallWithoutOSConfig",
                cls._schema_software_configuration_read.discriminate_by(
                    "software_installation_type",
                    "SAPInstallWithoutOSConfig",
                )
            )
        _schema.discriminate_by(
                "software_installation_type",
                "ServiceInitiated",
                cls._schema_software_configuration_read.discriminate_by(
                    "software_installation_type",
                    "ServiceInitiated",
                )
            )

    _schema_virtual_machine_configuration_read = None

    @classmethod
    def _build_schema_virtual_machine_configuration_read(cls, _schema):
        if cls._schema_virtual_machine_configuration_read is not None:
            _schema.image_reference = cls._schema_virtual_machine_configuration_read.image_reference
            _schema.os_profile = cls._schema_virtual_machine_configuration_read.os_profile
            _schema.vm_size = cls._schema_virtual_machine_configuration_read.vm_size
            return

        cls._schema_virtual_machine_configuration_read = _schema_virtual_machine_configuration_read = AAZObjectType()

        virtual_machine_configuration_read = _schema_virtual_machine_configuration_read
        virtual_machine_configuration_read.image_reference = AAZObjectType(
            serialized_name="imageReference",
            flags={"required": True},
        )
        virtual_machine_configuration_read.os_profile = AAZObjectType(
            serialized_name="osProfile",
            flags={"required": True},
        )
        virtual_machine_configuration_read.vm_size = AAZStrType(
            serialized_name="vmSize",
            flags={"required": True},
        )

        image_reference = _schema_virtual_machine_configuration_read.image_reference
        image_reference.offer = AAZStrType()
        image_reference.publisher = AAZStrType()
        image_reference.sku = AAZStrType()
        image_reference.version = AAZStrType()

        os_profile = _schema_virtual_machine_configuration_read.os_profile
        os_profile.admin_password = AAZStrType(
            serialized_name="adminPassword",
        )
        os_profile.admin_username = AAZStrType(
            serialized_name="adminUsername",
        )
        os_profile.os_configuration = AAZObjectType(
            serialized_name="osConfiguration",
        )

        os_configuration = _schema_virtual_machine_configuration_read.os_profile.os_configuration
        os_configuration.os_type = AAZStrType(
            serialized_name="osType",
            flags={"required": True},
        )

        disc_linux = _schema_virtual_machine_configuration_read.os_profile.os_configuration.discriminate_by("os_type", "Linux")
        disc_linux.disable_password_authentication = AAZBoolType(
            serialized_name="disablePasswordAuthentication",
        )
        disc_linux.ssh = AAZObjectType()
        disc_linux.ssh_key_pair = AAZObjectType(
            serialized_name="sshKeyPair",
        )

        ssh = _schema_virtual_machine_configuration_read.os_profile.os_configuration.discriminate_by("os_type", "Linux").ssh
        ssh.public_keys = AAZListType(
            serialized_name="publicKeys",
        )

        public_keys = _schema_virtual_machine_configuration_read.os_profile.os_configuration.discriminate_by("os_type", "Linux").ssh.public_keys
        public_keys.Element = AAZObjectType()

        _element = _schema_virtual_machine_configuration_read.os_profile.os_configuration.discriminate_by("os_type", "Linux").ssh.public_keys.Element
        _element.key_data = AAZStrType(
            serialized_name="keyData",
        )

        ssh_key_pair = _schema_virtual_machine_configuration_read.os_profile.os_configuration.discriminate_by("os_type", "Linux").ssh_key_pair
        ssh_key_pair.private_key = AAZStrType(
            serialized_name="privateKey",
        )
        ssh_key_pair.public_key = AAZStrType(
            serialized_name="publicKey",
        )

        _schema.image_reference = cls._schema_virtual_machine_configuration_read.image_reference
        _schema.os_profile = cls._schema_virtual_machine_configuration_read.os_profile
        _schema.vm_size = cls._schema_virtual_machine_configuration_read.vm_size

    _schema_virtual_machine_resource_names_read = None

    @classmethod
    def _build_schema_virtual_machine_resource_names_read(cls, _schema):
        if cls._schema_virtual_machine_resource_names_read is not None:
            _schema.data_disk_names = cls._schema_virtual_machine_resource_names_read.data_disk_names
            _schema.host_name = cls._schema_virtual_machine_resource_names_read.host_name
            _schema.network_interfaces = cls._schema_virtual_machine_resource_names_read.network_interfaces
            _schema.os_disk_name = cls._schema_virtual_machine_resource_names_read.os_disk_name
            _schema.vm_name = cls._schema_virtual_machine_resource_names_read.vm_name
            return

        cls._schema_virtual_machine_resource_names_read = _schema_virtual_machine_resource_names_read = AAZObjectType()

        virtual_machine_resource_names_read = _schema_virtual_machine_resource_names_read
        virtual_machine_resource_names_read.data_disk_names = AAZDictType(
            serialized_name="dataDiskNames",
        )
        virtual_machine_resource_names_read.host_name = AAZStrType(
            serialized_name="hostName",
        )
        virtual_machine_resource_names_read.network_interfaces = AAZListType(
            serialized_name="networkInterfaces",
        )
        virtual_machine_resource_names_read.os_disk_name = AAZStrType(
            serialized_name="osDiskName",
        )
        virtual_machine_resource_names_read.vm_name = AAZStrType(
            serialized_name="vmName",
        )

        data_disk_names = _schema_virtual_machine_resource_names_read.data_disk_names
        data_disk_names.Element = AAZListType()

        _element = _schema_virtual_machine_resource_names_read.data_disk_names.Element
        _element.Element = AAZStrType()

        network_interfaces = _schema_virtual_machine_resource_names_read.network_interfaces
        network_interfaces.Element = AAZObjectType()

        _element = _schema_virtual_machine_resource_names_read.network_interfaces.Element
        _element.network_interface_name = AAZStrType(
            serialized_name="networkInterfaceName",
        )

        _schema.data_disk_names = cls._schema_virtual_machine_resource_names_read.data_disk_names
        _schema.host_name = cls._schema_virtual_machine_resource_names_read.host_name
        _schema.network_interfaces = cls._schema_virtual_machine_resource_names_read.network_interfaces
        _schema.os_disk_name = cls._schema_virtual_machine_resource_names_read.os_disk_name
        _schema.vm_name = cls._schema_virtual_machine_resource_names_read.vm_name


__all__ = ["Wait"]
