# --------------------------------------------------------------------------------------------
# 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(
    "network firewall create",
)
class Create(AAZCommand):
    """Create an Azure Firewall.

    :example: Create a Azure firewall with private ranges
        az network firewall create -g MyResourceGroup -n MyFirewall --private-ranges 10.0.0.0 10.0.0.0/16 IANAPrivateRanges

    :example: Create a Virtual WAN Secure Hub Firewall
        az network firewall create -g MyResourceGroup -n MyFirewall --sku AZFW_Hub --tier Standard --virtual-hub MyVirtualHub1 --public-ip-count 1

    :example: Create a Basic SKU Firewall with Management IP Configuration
        az network firewall create -g MyResourceGroup -n MyFirewall --sku AZFW_VNet --tier Basic --vnet-name MyVNet --conf-name MyIpConfig --m-conf-name MyManagementIpConfig --m-public-ip MyPublicIp

    :example: Create a Basic SKU Firewall with Virtual Hub
        az network firewall create -g MyResourceGroup -n MyFirewall --sku AZFW_Hub --tier Basic --vhub MyVHub --public-ip-count 2
    """

    _aaz_info = {
        "version": "2022-01-01",
        "resources": [
            ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/azurefirewalls/{}", "2022-01-01"],
        ]
    }

    AZ_SUPPORT_NO_WAIT = True

    def _handler(self, command_args):
        super()._handler(command_args)
        return self.build_lro_poller(self._execute_operations, 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.name = AAZStrArg(
            options=["-n", "--name"],
            help="Azure Firewall name.",
            required=True,
            fmt=AAZStrArgFormat(
                max_length=56,
                min_length=1,
            ),
        )
        _args_schema.resource_group = AAZResourceGroupNameArg(
            required=True,
        )
        _args_schema.location = AAZResourceLocationArg(
            help="Resource location.",
            fmt=AAZResourceLocationArgFormat(
                resource_group_arg="resource_group",
            ),
        )
        _args_schema.firewall_policy = AAZStrArg(
            options=["--policy", "--firewall-policy"],
            help="Name or ID of the firewallPolicy associated with this azure firewall.",
        )
        _args_schema.sku = AAZStrArg(
            options=["--sku"],
            help="SKU of Azure firewall. This field cannot be updated after the creation. The default sku in server end is AZFW_VNet. If you want to attach azure firewall to  vhub, you should set sku to AZFW_Hub.",
            enum={"AZFW_Hub": "AZFW_Hub", "AZFW_VNet": "AZFW_VNet"},
        )
        _args_schema.tier = AAZStrArg(
            options=["--tier"],
            help="Tier of an azure firewall. --tier will take effect only when --sku is set.",
            default="Standard",
            enum={"Basic": "Basic", "Premium": "Premium", "Standard": "Standard"},
        )
        _args_schema.threat_intel_mode = AAZStrArg(
            options=["--threat-intel-mode"],
            help="The operation mode for Threat Intelligence.",
            enum={"Alert": "Alert", "Deny": "Deny", "Off": "Off"},
        )
        _args_schema.virtual_hub = AAZStrArg(
            options=["--vhub", "--virtual-hub"],
            help="Name or ID of the virtualHub to which the firewall belongs.",
        )
        _args_schema.tags = AAZDictArg(
            options=["--tags"],
            help="Resource tags.",
        )
        _args_schema.zones = AAZListArg(
            options=["-z", "--zones"],
            help="Space-separated list of availability zones into which to provision the resource. Allowed values: 1, 2, 3.",
        )

        tags = cls._args_schema.tags
        tags.Element = AAZStrArg()

        zones = cls._args_schema.zones
        zones.Element = AAZStrArg()

        # define Arg Group "HubIpAddresses"

        # define Arg Group "Management IP Configuration"

        _args_schema = cls._args_schema
        _args_schema.m_conf_name = AAZStrArg(
            options=["--m-conf-name"],
            arg_group="Management IP Configuration",
            help="Name of the management IP configuration.",
        )
        _args_schema.m_public_ip = AAZStrArg(
            options=["--m-public-ip"],
            arg_group="Management IP Configuration",
            help="Name or ID of the public IP to use for management IP configuration.",
        )
        _args_schema.mgmt_ip_conf_subnet = AAZStrArg(
            options=["--mgmt-ip-conf-subnet"],
            arg_group="Management IP Configuration",
            help="test",
        )

        # define Arg Group "ManagementIpConfiguration"

        # define Arg Group "Parameters"

        # define Arg Group "Properties"

        _args_schema = cls._args_schema
        _args_schema.additional_properties = AAZDictArg(
            options=["--additional-properties"],
            arg_group="Properties",
            help="The additional properties used to further config this azure firewall.",
        )
        _args_schema.ip_configurations = AAZListArg(
            options=["--ip-configurations"],
            arg_group="Properties",
            help="IP configuration of the Azure Firewall resource.",
        )

        additional_properties = cls._args_schema.additional_properties
        additional_properties.Element = AAZStrArg()

        ip_configurations = cls._args_schema.ip_configurations
        ip_configurations.Element = AAZObjectArg()
        cls._build_args_azure_firewall_ip_configuration_create(ip_configurations.Element)

        # define Arg Group "Virtual Hub Public Ip"

        _args_schema = cls._args_schema
        _args_schema.public_ip_count = AAZIntArg(
            options=["--count", "--public-ip-count"],
            arg_group="Virtual Hub Public Ip",
            help="Number of Public IP Address associated with azure firewall. It's used to add public ip addresses into this firewall.",
        )
        return cls._args_schema

    _args_azure_firewall_ip_configuration_create = None

    @classmethod
    def _build_args_azure_firewall_ip_configuration_create(cls, _schema):
        if cls._args_azure_firewall_ip_configuration_create is not None:
            _schema.name = cls._args_azure_firewall_ip_configuration_create.name
            _schema.public_ip_address = cls._args_azure_firewall_ip_configuration_create.public_ip_address
            _schema.subnet = cls._args_azure_firewall_ip_configuration_create.subnet
            return

        cls._args_azure_firewall_ip_configuration_create = AAZObjectArg()

        azure_firewall_ip_configuration_create = cls._args_azure_firewall_ip_configuration_create
        azure_firewall_ip_configuration_create.name = AAZStrArg(
            options=["name"],
            help="Name of the resource that is unique within a resource group. This name can be used to access the resource.",
        )
        azure_firewall_ip_configuration_create.public_ip_address = AAZStrArg(
            options=["public-ip-address"],
            help="Reference to the PublicIP resource. This field is a mandatory input if subnet is not null.",
        )
        azure_firewall_ip_configuration_create.subnet = AAZStrArg(
            options=["subnet"],
            help="Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'.",
        )

        _schema.name = cls._args_azure_firewall_ip_configuration_create.name
        _schema.public_ip_address = cls._args_azure_firewall_ip_configuration_create.public_ip_address
        _schema.subnet = cls._args_azure_firewall_ip_configuration_create.subnet

    _args_azure_firewall_rc_action_create = None

    @classmethod
    def _build_args_azure_firewall_rc_action_create(cls, _schema):
        if cls._args_azure_firewall_rc_action_create is not None:
            _schema.type = cls._args_azure_firewall_rc_action_create.type
            return

        cls._args_azure_firewall_rc_action_create = AAZObjectArg()

        azure_firewall_rc_action_create = cls._args_azure_firewall_rc_action_create
        azure_firewall_rc_action_create.type = AAZStrArg(
            options=["type"],
            help="The type of action.",
            enum={"Allow": "Allow", "Deny": "Deny"},
        )

        _schema.type = cls._args_azure_firewall_rc_action_create.type

    def _execute_operations(self):
        self.pre_operations()
        yield self.AzureFirewallsCreateOrUpdate(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=True)
        return result

    class AzureFirewallsCreateOrUpdate(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 [202]:
                return self.client.build_lro_polling(
                    self.ctx.args.no_wait,
                    session,
                    self.on_200_201,
                    self.on_error,
                    lro_options={"final-state-via": "azure-async-operation"},
                    path_format_arguments=self.url_parameters,
                )
            if session.http_response.status_code in [200, 201]:
                return self.client.build_lro_polling(
                    self.ctx.args.no_wait,
                    session,
                    self.on_200_201,
                    self.on_error,
                    lro_options={"final-state-via": "azure-async-operation"},
                    path_format_arguments=self.url_parameters,
                )

            return self.on_error(session.http_response)

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

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

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

        @property
        def url_parameters(self):
            parameters = {
                **self.serialize_url_param(
                    "azureFirewallName", self.ctx.args.name,
                    required=True,
                ),
                **self.serialize_url_param(
                    "resourceGroupName", self.ctx.args.resource_group,
                    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", "2022-01-01",
                    required=True,
                ),
            }
            return parameters

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

        @property
        def content(self):
            _content_value, _builder = self.new_content_builder(
                self.ctx.args,
                typ=AAZObjectType,
                typ_kwargs={"flags": {"required": True, "client_flatten": True}}
            )
            _builder.set_prop("location", AAZStrType, ".location")
            _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
            _builder.set_prop("tags", AAZDictType, ".tags")
            _builder.set_prop("zones", AAZListType, ".zones")

            properties = _builder.get(".properties")
            if properties is not None:
                properties.set_prop("additionalProperties", AAZDictType, ".additional_properties")
                properties.set_prop("firewallPolicy", AAZObjectType)
                properties.set_prop("hubIPAddresses", AAZObjectType)
                properties.set_prop("ipConfigurations", AAZListType, ".ip_configurations")
                properties.set_prop("managementIpConfiguration", AAZObjectType)
                properties.set_prop("sku", AAZObjectType)
                properties.set_prop("threatIntelMode", AAZStrType, ".threat_intel_mode")
                properties.set_prop("virtualHub", AAZObjectType)

            additional_properties = _builder.get(".properties.additionalProperties")
            if additional_properties is not None:
                additional_properties.set_elements(AAZStrType, ".")

            firewall_policy = _builder.get(".properties.firewallPolicy")
            if firewall_policy is not None:
                firewall_policy.set_prop("id", AAZStrType, ".firewall_policy")

            hub_ip_addresses = _builder.get(".properties.hubIPAddresses")
            if hub_ip_addresses is not None:
                hub_ip_addresses.set_prop("publicIPs", AAZObjectType)

            public_i_ps = _builder.get(".properties.hubIPAddresses.publicIPs")
            if public_i_ps is not None:
                public_i_ps.set_prop("count", AAZIntType, ".public_ip_count")

            ip_configurations = _builder.get(".properties.ipConfigurations")
            if ip_configurations is not None:
                _CreateHelper._build_schema_azure_firewall_ip_configuration_create(ip_configurations.set_elements(AAZObjectType, "."))

            management_ip_configuration = _builder.get(".properties.managementIpConfiguration")
            if management_ip_configuration is not None:
                management_ip_configuration.set_prop("name", AAZStrType, ".m_conf_name")
                management_ip_configuration.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})

            properties = _builder.get(".properties.managementIpConfiguration.properties")
            if properties is not None:
                properties.set_prop("publicIPAddress", AAZObjectType)
                properties.set_prop("subnet", AAZObjectType)

            public_ip_address = _builder.get(".properties.managementIpConfiguration.properties.publicIPAddress")
            if public_ip_address is not None:
                public_ip_address.set_prop("id", AAZStrType, ".m_public_ip")

            subnet = _builder.get(".properties.managementIpConfiguration.properties.subnet")
            if subnet is not None:
                subnet.set_prop("id", AAZStrType, ".mgmt_ip_conf_subnet")

            sku = _builder.get(".properties.sku")
            if sku is not None:
                sku.set_prop("name", AAZStrType, ".sku")
                sku.set_prop("tier", AAZStrType, ".tier")

            virtual_hub = _builder.get(".properties.virtualHub")
            if virtual_hub is not None:
                virtual_hub.set_prop("id", AAZStrType, ".virtual_hub")

            tags = _builder.get(".tags")
            if tags is not None:
                tags.set_elements(AAZStrType, ".")

            zones = _builder.get(".zones")
            if zones is not None:
                zones.set_elements(AAZStrType, ".")

            return self.serialize_content(_content_value)

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

        _schema_on_200_201 = None

        @classmethod
        def _build_schema_on_200_201(cls):
            if cls._schema_on_200_201 is not None:
                return cls._schema_on_200_201

            cls._schema_on_200_201 = AAZObjectType()

            _schema_on_200_201 = cls._schema_on_200_201
            _schema_on_200_201.etag = AAZStrType(
                flags={"read_only": True},
            )
            _schema_on_200_201.id = AAZStrType()
            _schema_on_200_201.location = AAZStrType()
            _schema_on_200_201.name = AAZStrType(
                flags={"read_only": True},
            )
            _schema_on_200_201.properties = AAZObjectType(
                flags={"client_flatten": True},
            )
            _schema_on_200_201.tags = AAZDictType()
            _schema_on_200_201.type = AAZStrType(
                flags={"read_only": True},
            )
            _schema_on_200_201.zones = AAZListType()

            properties = cls._schema_on_200_201.properties
            properties.additional_properties = AAZDictType(
                serialized_name="additionalProperties",
            )
            properties.application_rule_collections = AAZListType(
                serialized_name="applicationRuleCollections",
            )
            properties.firewall_policy = AAZObjectType(
                serialized_name="firewallPolicy",
            )
            _CreateHelper._build_schema_sub_resource_read(properties.firewall_policy)
            properties.hub_ip_addresses = AAZObjectType(
                serialized_name="hubIPAddresses",
            )
            properties.ip_configurations = AAZListType(
                serialized_name="ipConfigurations",
            )
            properties.ip_groups = AAZListType(
                serialized_name="ipGroups",
            )
            properties.management_ip_configuration = AAZObjectType(
                serialized_name="managementIpConfiguration",
            )
            _CreateHelper._build_schema_azure_firewall_ip_configuration_read(properties.management_ip_configuration)
            properties.nat_rule_collections = AAZListType(
                serialized_name="natRuleCollections",
            )
            properties.network_rule_collections = AAZListType(
                serialized_name="networkRuleCollections",
            )
            properties.provisioning_state = AAZStrType(
                serialized_name="provisioningState",
                flags={"read_only": True},
            )
            properties.sku = AAZObjectType()
            properties.threat_intel_mode = AAZStrType(
                serialized_name="threatIntelMode",
            )
            properties.virtual_hub = AAZObjectType(
                serialized_name="virtualHub",
            )
            _CreateHelper._build_schema_sub_resource_read(properties.virtual_hub)

            additional_properties = cls._schema_on_200_201.properties.additional_properties
            additional_properties.Element = AAZStrType()

            application_rule_collections = cls._schema_on_200_201.properties.application_rule_collections
            application_rule_collections.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.application_rule_collections.Element
            _element.etag = AAZStrType(
                flags={"read_only": True},
            )
            _element.id = AAZStrType()
            _element.name = AAZStrType()
            _element.properties = AAZObjectType(
                flags={"client_flatten": True},
            )

            properties = cls._schema_on_200_201.properties.application_rule_collections.Element.properties
            properties.action = AAZObjectType()
            _CreateHelper._build_schema_azure_firewall_rc_action_read(properties.action)
            properties.priority = AAZIntType()
            properties.provisioning_state = AAZStrType(
                serialized_name="provisioningState",
                flags={"read_only": True},
            )
            properties.rules = AAZListType()

            rules = cls._schema_on_200_201.properties.application_rule_collections.Element.properties.rules
            rules.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.application_rule_collections.Element.properties.rules.Element
            _element.description = AAZStrType()
            _element.fqdn_tags = AAZListType(
                serialized_name="fqdnTags",
            )
            _element.name = AAZStrType()
            _element.protocols = AAZListType()
            _element.source_addresses = AAZListType(
                serialized_name="sourceAddresses",
            )
            _element.source_ip_groups = AAZListType(
                serialized_name="sourceIpGroups",
            )
            _element.target_fqdns = AAZListType(
                serialized_name="targetFqdns",
            )

            fqdn_tags = cls._schema_on_200_201.properties.application_rule_collections.Element.properties.rules.Element.fqdn_tags
            fqdn_tags.Element = AAZStrType()

            protocols = cls._schema_on_200_201.properties.application_rule_collections.Element.properties.rules.Element.protocols
            protocols.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.application_rule_collections.Element.properties.rules.Element.protocols.Element
            _element.port = AAZIntType()
            _element.protocol_type = AAZStrType(
                serialized_name="protocolType",
            )

            source_addresses = cls._schema_on_200_201.properties.application_rule_collections.Element.properties.rules.Element.source_addresses
            source_addresses.Element = AAZStrType()

            source_ip_groups = cls._schema_on_200_201.properties.application_rule_collections.Element.properties.rules.Element.source_ip_groups
            source_ip_groups.Element = AAZStrType()

            target_fqdns = cls._schema_on_200_201.properties.application_rule_collections.Element.properties.rules.Element.target_fqdns
            target_fqdns.Element = AAZStrType()

            hub_ip_addresses = cls._schema_on_200_201.properties.hub_ip_addresses
            hub_ip_addresses.private_ip_address = AAZStrType(
                serialized_name="privateIPAddress",
            )
            hub_ip_addresses.public_i_ps = AAZObjectType(
                serialized_name="publicIPs",
            )

            public_i_ps = cls._schema_on_200_201.properties.hub_ip_addresses.public_i_ps
            public_i_ps.addresses = AAZListType()
            public_i_ps.count = AAZIntType()

            addresses = cls._schema_on_200_201.properties.hub_ip_addresses.public_i_ps.addresses
            addresses.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.hub_ip_addresses.public_i_ps.addresses.Element
            _element.address = AAZStrType()

            ip_configurations = cls._schema_on_200_201.properties.ip_configurations
            ip_configurations.Element = AAZObjectType()
            _CreateHelper._build_schema_azure_firewall_ip_configuration_read(ip_configurations.Element)

            ip_groups = cls._schema_on_200_201.properties.ip_groups
            ip_groups.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.ip_groups.Element
            _element.change_number = AAZStrType(
                serialized_name="changeNumber",
                flags={"read_only": True},
            )
            _element.id = AAZStrType(
                flags={"read_only": True},
            )

            nat_rule_collections = cls._schema_on_200_201.properties.nat_rule_collections
            nat_rule_collections.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.nat_rule_collections.Element
            _element.etag = AAZStrType(
                flags={"read_only": True},
            )
            _element.id = AAZStrType()
            _element.name = AAZStrType()
            _element.properties = AAZObjectType(
                flags={"client_flatten": True},
            )

            properties = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties
            properties.action = AAZObjectType()
            properties.priority = AAZIntType()
            properties.provisioning_state = AAZStrType(
                serialized_name="provisioningState",
                flags={"read_only": True},
            )
            properties.rules = AAZListType()

            action = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties.action
            action.type = AAZStrType()

            rules = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties.rules
            rules.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties.rules.Element
            _element.description = AAZStrType()
            _element.destination_addresses = AAZListType(
                serialized_name="destinationAddresses",
            )
            _element.destination_ports = AAZListType(
                serialized_name="destinationPorts",
            )
            _element.name = AAZStrType()
            _element.protocols = AAZListType()
            _element.source_addresses = AAZListType(
                serialized_name="sourceAddresses",
            )
            _element.source_ip_groups = AAZListType(
                serialized_name="sourceIpGroups",
            )
            _element.translated_address = AAZStrType(
                serialized_name="translatedAddress",
            )
            _element.translated_fqdn = AAZStrType(
                serialized_name="translatedFqdn",
            )
            _element.translated_port = AAZStrType(
                serialized_name="translatedPort",
            )

            destination_addresses = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties.rules.Element.destination_addresses
            destination_addresses.Element = AAZStrType()

            destination_ports = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties.rules.Element.destination_ports
            destination_ports.Element = AAZStrType()

            protocols = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties.rules.Element.protocols
            protocols.Element = AAZStrType()

            source_addresses = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties.rules.Element.source_addresses
            source_addresses.Element = AAZStrType()

            source_ip_groups = cls._schema_on_200_201.properties.nat_rule_collections.Element.properties.rules.Element.source_ip_groups
            source_ip_groups.Element = AAZStrType()

            network_rule_collections = cls._schema_on_200_201.properties.network_rule_collections
            network_rule_collections.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.network_rule_collections.Element
            _element.etag = AAZStrType(
                flags={"read_only": True},
            )
            _element.id = AAZStrType()
            _element.name = AAZStrType()
            _element.properties = AAZObjectType(
                flags={"client_flatten": True},
            )

            properties = cls._schema_on_200_201.properties.network_rule_collections.Element.properties
            properties.action = AAZObjectType()
            _CreateHelper._build_schema_azure_firewall_rc_action_read(properties.action)
            properties.priority = AAZIntType()
            properties.provisioning_state = AAZStrType(
                serialized_name="provisioningState",
                flags={"read_only": True},
            )
            properties.rules = AAZListType()

            rules = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules
            rules.Element = AAZObjectType()

            _element = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules.Element
            _element.description = AAZStrType()
            _element.destination_addresses = AAZListType(
                serialized_name="destinationAddresses",
            )
            _element.destination_fqdns = AAZListType(
                serialized_name="destinationFqdns",
            )
            _element.destination_ip_groups = AAZListType(
                serialized_name="destinationIpGroups",
            )
            _element.destination_ports = AAZListType(
                serialized_name="destinationPorts",
            )
            _element.name = AAZStrType()
            _element.protocols = AAZListType()
            _element.source_addresses = AAZListType(
                serialized_name="sourceAddresses",
            )
            _element.source_ip_groups = AAZListType(
                serialized_name="sourceIpGroups",
            )

            destination_addresses = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules.Element.destination_addresses
            destination_addresses.Element = AAZStrType()

            destination_fqdns = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules.Element.destination_fqdns
            destination_fqdns.Element = AAZStrType()

            destination_ip_groups = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules.Element.destination_ip_groups
            destination_ip_groups.Element = AAZStrType()

            destination_ports = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules.Element.destination_ports
            destination_ports.Element = AAZStrType()

            protocols = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules.Element.protocols
            protocols.Element = AAZStrType()

            source_addresses = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules.Element.source_addresses
            source_addresses.Element = AAZStrType()

            source_ip_groups = cls._schema_on_200_201.properties.network_rule_collections.Element.properties.rules.Element.source_ip_groups
            source_ip_groups.Element = AAZStrType()

            sku = cls._schema_on_200_201.properties.sku
            sku.name = AAZStrType()
            sku.tier = AAZStrType()

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

            zones = cls._schema_on_200_201.zones
            zones.Element = AAZStrType()

            return cls._schema_on_200_201


class _CreateHelper:
    """Helper class for Create"""

    @classmethod
    def _build_schema_azure_firewall_ip_configuration_create(cls, _builder):
        if _builder is None:
            return
        _builder.set_prop("name", AAZStrType, ".name")
        _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})

        properties = _builder.get(".properties")
        if properties is not None:
            properties.set_prop("publicIPAddress", AAZObjectType)
            properties.set_prop("subnet", AAZObjectType)

        public_ip_address = _builder.get(".properties.publicIPAddress")
        if public_ip_address is not None:
            public_ip_address.set_prop("id", AAZStrType, ".public_ip_address")

        subnet = _builder.get(".properties.subnet")
        if subnet is not None:
            subnet.set_prop("id", AAZStrType, ".subnet")

    @classmethod
    def _build_schema_azure_firewall_rc_action_create(cls, _builder):
        if _builder is None:
            return
        _builder.set_prop("type", AAZStrType, ".type")

    _schema_azure_firewall_ip_configuration_read = None

    @classmethod
    def _build_schema_azure_firewall_ip_configuration_read(cls, _schema):
        if cls._schema_azure_firewall_ip_configuration_read is not None:
            _schema.etag = cls._schema_azure_firewall_ip_configuration_read.etag
            _schema.id = cls._schema_azure_firewall_ip_configuration_read.id
            _schema.name = cls._schema_azure_firewall_ip_configuration_read.name
            _schema.properties = cls._schema_azure_firewall_ip_configuration_read.properties
            _schema.type = cls._schema_azure_firewall_ip_configuration_read.type
            return

        cls._schema_azure_firewall_ip_configuration_read = _schema_azure_firewall_ip_configuration_read = AAZObjectType()

        azure_firewall_ip_configuration_read = _schema_azure_firewall_ip_configuration_read
        azure_firewall_ip_configuration_read.etag = AAZStrType(
            flags={"read_only": True},
        )
        azure_firewall_ip_configuration_read.id = AAZStrType()
        azure_firewall_ip_configuration_read.name = AAZStrType()
        azure_firewall_ip_configuration_read.properties = AAZObjectType(
            flags={"client_flatten": True},
        )
        azure_firewall_ip_configuration_read.type = AAZStrType(
            flags={"read_only": True},
        )

        properties = _schema_azure_firewall_ip_configuration_read.properties
        properties.private_ip_address = AAZStrType(
            serialized_name="privateIPAddress",
            flags={"read_only": True},
        )
        properties.provisioning_state = AAZStrType(
            serialized_name="provisioningState",
            flags={"read_only": True},
        )
        properties.public_ip_address = AAZObjectType(
            serialized_name="publicIPAddress",
        )
        cls._build_schema_sub_resource_read(properties.public_ip_address)
        properties.subnet = AAZObjectType()
        cls._build_schema_sub_resource_read(properties.subnet)

        _schema.etag = cls._schema_azure_firewall_ip_configuration_read.etag
        _schema.id = cls._schema_azure_firewall_ip_configuration_read.id
        _schema.name = cls._schema_azure_firewall_ip_configuration_read.name
        _schema.properties = cls._schema_azure_firewall_ip_configuration_read.properties
        _schema.type = cls._schema_azure_firewall_ip_configuration_read.type

    _schema_azure_firewall_rc_action_read = None

    @classmethod
    def _build_schema_azure_firewall_rc_action_read(cls, _schema):
        if cls._schema_azure_firewall_rc_action_read is not None:
            _schema.type = cls._schema_azure_firewall_rc_action_read.type
            return

        cls._schema_azure_firewall_rc_action_read = _schema_azure_firewall_rc_action_read = AAZObjectType()

        azure_firewall_rc_action_read = _schema_azure_firewall_rc_action_read
        azure_firewall_rc_action_read.type = AAZStrType()

        _schema.type = cls._schema_azure_firewall_rc_action_read.type

    _schema_sub_resource_read = None

    @classmethod
    def _build_schema_sub_resource_read(cls, _schema):
        if cls._schema_sub_resource_read is not None:
            _schema.id = cls._schema_sub_resource_read.id
            return

        cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType()

        sub_resource_read = _schema_sub_resource_read
        sub_resource_read.id = AAZStrType()

        _schema.id = cls._schema_sub_resource_read.id


__all__ = ["Create"]
