# pylint: disable=line-too-long,useless-suppression,too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=useless-super-delegation

import datetime
from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload

from .._utils.model_base import Model as _Model, rest_field

if TYPE_CHECKING:
    from .. import models as _models


class CheckTrafficManagerRelativeDnsNameAvailabilityParameters(_Model):  # pylint: disable=name-too-long
    """Parameters supplied to check Traffic Manager name operation.

    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource.
    :vartype type: str
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name of the resource."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The type of the resource."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        type: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class CloudError(_Model):
    """An error returned by the Azure Resource Manager.

    :ivar error: The content of the error.
    :vartype error: ~azure.mgmt.trafficmanager.models.CloudErrorBody
    """

    error: Optional["_models.CloudErrorBody"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The content of the error."""

    @overload
    def __init__(
        self,
        *,
        error: Optional["_models.CloudErrorBody"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class CloudErrorBody(_Model):
    """The content of an error returned by the Azure Resource Manager.

    :ivar code: Error code.
    :vartype code: str
    :ivar message: Error message.
    :vartype message: str
    :ivar target: Error target.
    :vartype target: str
    :ivar details: Error details.
    :vartype details: list[~azure.mgmt.trafficmanager.models.CloudErrorBody]
    """

    code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Error code."""
    message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Error message."""
    target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Error target."""
    details: Optional[list["_models.CloudErrorBody"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Error details."""

    @overload
    def __init__(
        self,
        *,
        code: Optional[str] = None,
        message: Optional[str] = None,
        target: Optional[str] = None,
        details: Optional[list["_models.CloudErrorBody"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class DeleteOperationResult(_Model):
    """The result of the request or operation.

    :ivar operation_result: The result of the operation or request.
    :vartype operation_result: bool
    """

    operation_result: Optional[bool] = rest_field(name="boolean", visibility=["read"])
    """The result of the operation or request."""


class DnsConfig(_Model):
    """Class containing DNS settings in a Traffic Manager profile.

    :ivar relative_name: The relative DNS name provided by this Traffic Manager profile. This value
     is combined with the DNS domain name used by Azure Traffic Manager to form the fully-qualified
     domain name (FQDN) of the profile.
    :vartype relative_name: str
    :ivar fqdn: The fully-qualified domain name (FQDN) of the Traffic Manager profile. This is
     formed from the concatenation of the RelativeName with the DNS domain used by Azure Traffic
     Manager.
    :vartype fqdn: str
    :ivar ttl: The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and DNS
     clients how long to cache DNS responses provided by this Traffic Manager profile.
    :vartype ttl: int
    """

    relative_name: Optional[str] = rest_field(
        name="relativeName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The relative DNS name provided by this Traffic Manager profile. This value is combined with the
     DNS domain name used by Azure Traffic Manager to form the fully-qualified domain name (FQDN) of
     the profile."""
    fqdn: Optional[str] = rest_field(visibility=["read"])
    """The fully-qualified domain name (FQDN) of the Traffic Manager profile. This is formed from the
     concatenation of the RelativeName with the DNS domain used by Azure Traffic Manager."""
    ttl: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and DNS clients
     how long to cache DNS responses provided by this Traffic Manager profile."""

    @overload
    def __init__(
        self,
        *,
        relative_name: Optional[str] = None,
        ttl: Optional[int] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class Resource(_Model):
    """The core properties of ARM resources.

    :ivar id: Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name of the resource."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ProxyResource(Resource):
    """The resource model definition for a ARM proxy resource. It will have everything other than
    required location and tags.

    :ivar id: Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
    :vartype type: str
    """

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class Endpoint(ProxyResource):
    """Class representing a Traffic Manager endpoint.

    :ivar id: Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
    :vartype type: str
    :ivar properties: The properties of the Traffic Manager endpoint.
    :vartype properties: ~azure.mgmt.trafficmanager.models.EndpointProperties
    """

    properties: Optional["_models.EndpointProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The properties of the Traffic Manager endpoint."""

    __flattened_items = [
        "target_resource_id",
        "target",
        "endpoint_status",
        "weight",
        "priority",
        "endpoint_location",
        "endpoint_monitor_status",
        "min_child_endpoints",
        "min_child_endpoints_i_pv4",
        "min_child_endpoints_i_pv6",
        "geo_mapping",
        "subnets",
        "custom_headers",
        "always_serve",
    ]

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
        properties: Optional["_models.EndpointProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
        super().__init__(*args, **kwargs)
        for k, v in _flattened_input.items():
            setattr(self, k, v)

    def __getattr__(self, name: str) -> Any:
        if name in self.__flattened_items:
            if self.properties is None:
                return None
            return getattr(self.properties, name)
        raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")

    def __setattr__(self, key: str, value: Any) -> None:
        if key in self.__flattened_items:
            if self.properties is None:
                self.properties = self._attr_to_rest_field["properties"]._class_type()
            setattr(self.properties, key, value)
        else:
            super().__setattr__(key, value)


class EndpointProperties(_Model):
    """Class representing a Traffic Manager endpoint properties.

    :ivar target_resource_id: The Azure Resource URI of the of the endpoint. Not applicable to
     endpoints of type 'ExternalEndpoints'.
    :vartype target_resource_id: str
    :ivar target: The fully-qualified DNS name or IP address of the endpoint. Traffic Manager
     returns this value in DNS responses to direct traffic to this endpoint.
    :vartype target: str
    :ivar endpoint_status: The status of the endpoint. If the endpoint is Enabled, it is probed for
     endpoint health and is included in the traffic routing method. Known values are: "Enabled" and
     "Disabled".
    :vartype endpoint_status: str or ~azure.mgmt.trafficmanager.models.EndpointStatus
    :ivar weight: The weight of this endpoint when using the 'Weighted' traffic routing method.
     Possible values are from 1 to 1000.
    :vartype weight: int
    :ivar priority: The priority of this endpoint when using the 'Priority' traffic routing method.
     Possible values are from 1 to 1000, lower values represent higher priority. This is an optional
     parameter.  If specified, it must be specified on all endpoints, and no two endpoints can share
     the same priority value.
    :vartype priority: int
    :ivar endpoint_location: Specifies the location of the external or nested endpoints when using
     the 'Performance' traffic routing method.
    :vartype endpoint_location: str
    :ivar endpoint_monitor_status: The monitoring status of the endpoint. Known values are:
     "CheckingEndpoint", "Online", "Degraded", "Disabled", "Inactive", "Stopped", and "Unmonitored".
    :vartype endpoint_monitor_status: str or
     ~azure.mgmt.trafficmanager.models.EndpointMonitorStatus
    :ivar min_child_endpoints: The minimum number of endpoints that must be available in the child
     profile in order for the parent profile to be considered available. Only applicable to endpoint
     of type 'NestedEndpoints'.
    :vartype min_child_endpoints: int
    :ivar min_child_endpoints_i_pv4: The minimum number of IPv4 (DNS record type A) endpoints that
     must be available in the child profile in order for the parent profile to be considered
     available. Only applicable to endpoint of type 'NestedEndpoints'.
    :vartype min_child_endpoints_i_pv4: int
    :ivar min_child_endpoints_i_pv6: The minimum number of IPv6 (DNS record type AAAA) endpoints
     that must be available in the child profile in order for the parent profile to be considered
     available. Only applicable to endpoint of type 'NestedEndpoints'.
    :vartype min_child_endpoints_i_pv6: int
    :ivar geo_mapping: The list of countries/regions mapped to this endpoint when using the
     'Geographic' traffic routing method. Please consult Traffic Manager Geographic documentation
     for a full list of accepted values.
    :vartype geo_mapping: list[str]
    :ivar subnets: The list of subnets, IP addresses, and/or address ranges mapped to this endpoint
     when using the 'Subnet' traffic routing method. An empty list will match all ranges not covered
     by other endpoints.
    :vartype subnets: list[~azure.mgmt.trafficmanager.models.EndpointPropertiesSubnetsItem]
    :ivar custom_headers: List of custom headers.
    :vartype custom_headers:
     list[~azure.mgmt.trafficmanager.models.EndpointPropertiesCustomHeadersItem]
    :ivar always_serve: If Always Serve is enabled, probing for endpoint health will be disabled
     and endpoints will be included in the traffic routing method. Known values are: "Enabled" and
     "Disabled".
    :vartype always_serve: str or ~azure.mgmt.trafficmanager.models.AlwaysServe
    """

    target_resource_id: Optional[str] = rest_field(
        name="targetResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The Azure Resource URI of the of the endpoint. Not applicable to endpoints of type
     'ExternalEndpoints'."""
    target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The fully-qualified DNS name or IP address of the endpoint. Traffic Manager returns this value
     in DNS responses to direct traffic to this endpoint."""
    endpoint_status: Optional[Union[str, "_models.EndpointStatus"]] = rest_field(
        name="endpointStatus", visibility=["read", "create", "update", "delete", "query"]
    )
    """The status of the endpoint. If the endpoint is Enabled, it is probed for endpoint health and is
     included in the traffic routing method. Known values are: \"Enabled\" and \"Disabled\"."""
    weight: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The weight of this endpoint when using the 'Weighted' traffic routing method. Possible values
     are from 1 to 1000."""
    priority: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The priority of this endpoint when using the 'Priority' traffic routing method. Possible values
     are from 1 to 1000, lower values represent higher priority. This is an optional parameter.  If
     specified, it must be specified on all endpoints, and no two endpoints can share the same
     priority value."""
    endpoint_location: Optional[str] = rest_field(
        name="endpointLocation", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the location of the external or nested endpoints when using the 'Performance' traffic
     routing method."""
    endpoint_monitor_status: Optional[Union[str, "_models.EndpointMonitorStatus"]] = rest_field(
        name="endpointMonitorStatus", visibility=["read", "create", "update", "delete", "query"]
    )
    """The monitoring status of the endpoint. Known values are: \"CheckingEndpoint\", \"Online\",
     \"Degraded\", \"Disabled\", \"Inactive\", \"Stopped\", and \"Unmonitored\"."""
    min_child_endpoints: Optional[int] = rest_field(
        name="minChildEndpoints", visibility=["read", "create", "update", "delete", "query"]
    )
    """The minimum number of endpoints that must be available in the child profile in order for the
     parent profile to be considered available. Only applicable to endpoint of type
     'NestedEndpoints'."""
    min_child_endpoints_i_pv4: Optional[int] = rest_field(
        name="minChildEndpointsIPv4", visibility=["read", "create", "update", "delete", "query"]
    )
    """The minimum number of IPv4 (DNS record type A) endpoints that must be available in the child
     profile in order for the parent profile to be considered available. Only applicable to endpoint
     of type 'NestedEndpoints'."""
    min_child_endpoints_i_pv6: Optional[int] = rest_field(
        name="minChildEndpointsIPv6", visibility=["read", "create", "update", "delete", "query"]
    )
    """The minimum number of IPv6 (DNS record type AAAA) endpoints that must be available in the child
     profile in order for the parent profile to be considered available. Only applicable to endpoint
     of type 'NestedEndpoints'."""
    geo_mapping: Optional[list[str]] = rest_field(
        name="geoMapping", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic
     routing method. Please consult Traffic Manager Geographic documentation for a full list of
     accepted values."""
    subnets: Optional[list["_models.EndpointPropertiesSubnetsItem"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of subnets, IP addresses, and/or address ranges mapped to this endpoint when using the
     'Subnet' traffic routing method. An empty list will match all ranges not covered by other
     endpoints."""
    custom_headers: Optional[list["_models.EndpointPropertiesCustomHeadersItem"]] = rest_field(
        name="customHeaders", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of custom headers."""
    always_serve: Optional[Union[str, "_models.AlwaysServe"]] = rest_field(
        name="alwaysServe", visibility=["read", "create", "update", "delete", "query"]
    )
    """If Always Serve is enabled, probing for endpoint health will be disabled and endpoints will be
     included in the traffic routing method. Known values are: \"Enabled\" and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        target_resource_id: Optional[str] = None,
        target: Optional[str] = None,
        endpoint_status: Optional[Union[str, "_models.EndpointStatus"]] = None,
        weight: Optional[int] = None,
        priority: Optional[int] = None,
        endpoint_location: Optional[str] = None,
        endpoint_monitor_status: Optional[Union[str, "_models.EndpointMonitorStatus"]] = None,
        min_child_endpoints: Optional[int] = None,
        min_child_endpoints_i_pv4: Optional[int] = None,
        min_child_endpoints_i_pv6: Optional[int] = None,
        geo_mapping: Optional[list[str]] = None,
        subnets: Optional[list["_models.EndpointPropertiesSubnetsItem"]] = None,
        custom_headers: Optional[list["_models.EndpointPropertiesCustomHeadersItem"]] = None,
        always_serve: Optional[Union[str, "_models.AlwaysServe"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class EndpointPropertiesCustomHeadersItem(_Model):
    """Custom header name and value.

    :ivar name: Header name.
    :vartype name: str
    :ivar value: Header value.
    :vartype value: str
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Header name."""
    value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Header value."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        value: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class EndpointPropertiesSubnetsItem(_Model):
    """Subnet first address, scope, and/or last address.

    :ivar first: First address in the subnet.
    :vartype first: str
    :ivar last: Last address in the subnet.
    :vartype last: str
    :ivar scope: Block size (number of leading bits in the subnet mask).
    :vartype scope: int
    """

    first: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """First address in the subnet."""
    last: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Last address in the subnet."""
    scope: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Block size (number of leading bits in the subnet mask)."""

    @overload
    def __init__(
        self,
        *,
        first: Optional[str] = None,
        last: Optional[str] = None,
        scope: Optional[int] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class GeographicHierarchyProperties(_Model):
    """Class representing the properties of the Geographic hierarchy used with the Geographic traffic
    routing method.

    :ivar geographic_hierarchy: The region at the root of the hierarchy from all the regions in the
     hierarchy can be retrieved.
    :vartype geographic_hierarchy: ~azure.mgmt.trafficmanager.models.Region
    """

    geographic_hierarchy: Optional["_models.Region"] = rest_field(
        name="geographicHierarchy", visibility=["read", "create", "update", "delete", "query"]
    )
    """The region at the root of the hierarchy from all the regions in the hierarchy can be retrieved."""

    @overload
    def __init__(
        self,
        *,
        geographic_hierarchy: Optional["_models.Region"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class HeatMapEndpoint(_Model):
    """Class which is a sparse representation of a Traffic Manager endpoint.

    :ivar resource_id: The ARM Resource ID of this Traffic Manager endpoint.
    :vartype resource_id: str
    :ivar endpoint_id: A number uniquely identifying this endpoint in query experiences.
    :vartype endpoint_id: int
    """

    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The ARM Resource ID of this Traffic Manager endpoint."""
    endpoint_id: Optional[int] = rest_field(
        name="endpointId", visibility=["read", "create", "update", "delete", "query"]
    )
    """A number uniquely identifying this endpoint in query experiences."""

    @overload
    def __init__(
        self,
        *,
        resource_id: Optional[str] = None,
        endpoint_id: Optional[int] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class HeatMapModel(ProxyResource):
    """Class representing a Traffic Manager HeatMap.

    :ivar id: Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
    :vartype type: str
    :ivar properties: The properties of the Traffic Manager HeatMap.
    :vartype properties: ~azure.mgmt.trafficmanager.models.HeatMapProperties
    """

    properties: Optional["_models.HeatMapProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The properties of the Traffic Manager HeatMap."""

    __flattened_items = ["start_time", "end_time", "endpoints", "traffic_flows"]

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
        properties: Optional["_models.HeatMapProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
        super().__init__(*args, **kwargs)
        for k, v in _flattened_input.items():
            setattr(self, k, v)

    def __getattr__(self, name: str) -> Any:
        if name in self.__flattened_items:
            if self.properties is None:
                return None
            return getattr(self.properties, name)
        raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")

    def __setattr__(self, key: str, value: Any) -> None:
        if key in self.__flattened_items:
            if self.properties is None:
                self.properties = self._attr_to_rest_field["properties"]._class_type()
            setattr(self.properties, key, value)
        else:
            super().__setattr__(key, value)


class HeatMapProperties(_Model):
    """Class representing a Traffic Manager HeatMap properties.

    :ivar start_time: The beginning of the time window for this HeatMap, inclusive.
    :vartype start_time: ~datetime.datetime
    :ivar end_time: The ending of the time window for this HeatMap, exclusive.
    :vartype end_time: ~datetime.datetime
    :ivar endpoints: The endpoints used in this HeatMap calculation.
    :vartype endpoints: list[~azure.mgmt.trafficmanager.models.HeatMapEndpoint]
    :ivar traffic_flows: The traffic flows produced in this HeatMap calculation.
    :vartype traffic_flows: list[~azure.mgmt.trafficmanager.models.TrafficFlow]
    """

    start_time: Optional[datetime.datetime] = rest_field(
        name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The beginning of the time window for this HeatMap, inclusive."""
    end_time: Optional[datetime.datetime] = rest_field(
        name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The ending of the time window for this HeatMap, exclusive."""
    endpoints: Optional[list["_models.HeatMapEndpoint"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The endpoints used in this HeatMap calculation."""
    traffic_flows: Optional[list["_models.TrafficFlow"]] = rest_field(
        name="trafficFlows", visibility=["read", "create", "update", "delete", "query"]
    )
    """The traffic flows produced in this HeatMap calculation."""

    @overload
    def __init__(
        self,
        *,
        start_time: Optional[datetime.datetime] = None,
        end_time: Optional[datetime.datetime] = None,
        endpoints: Optional[list["_models.HeatMapEndpoint"]] = None,
        traffic_flows: Optional[list["_models.TrafficFlow"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class MonitorConfig(_Model):
    """Class containing endpoint monitoring settings in a Traffic Manager profile.

    :ivar profile_monitor_status: The profile-level monitoring status of the Traffic Manager
     profile. Known values are: "CheckingEndpoints", "Online", "Degraded", "Disabled", and
     "Inactive".
    :vartype profile_monitor_status: str or ~azure.mgmt.trafficmanager.models.ProfileMonitorStatus
    :ivar protocol: The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. Known
     values are: "HTTP", "HTTPS", and "TCP".
    :vartype protocol: str or ~azure.mgmt.trafficmanager.models.MonitorProtocol
    :ivar port: The TCP port used to probe for endpoint health.
    :vartype port: int
    :ivar path: The path relative to the endpoint domain name used to probe for endpoint health.
    :vartype path: str
    :ivar interval_in_seconds: The monitor interval for endpoints in this profile. This is the
     interval at which Traffic Manager will check the health of each endpoint in this profile.
    :vartype interval_in_seconds: int
    :ivar timeout_in_seconds: The monitor timeout for endpoints in this profile. This is the time
     that Traffic Manager allows endpoints in this profile to response to the health check.
    :vartype timeout_in_seconds: int
    :ivar tolerated_number_of_failures: The number of consecutive failed health check that Traffic
     Manager tolerates before declaring an endpoint in this profile Degraded after the next failed
     health check.
    :vartype tolerated_number_of_failures: int
    :ivar custom_headers: List of custom headers.
    :vartype custom_headers: list[~azure.mgmt.trafficmanager.models.MonitorConfigCustomHeadersItem]
    :ivar expected_status_code_ranges: List of expected status code ranges.
    :vartype expected_status_code_ranges:
     list[~azure.mgmt.trafficmanager.models.MonitorConfigExpectedStatusCodeRangesItem]
    """

    profile_monitor_status: Optional[Union[str, "_models.ProfileMonitorStatus"]] = rest_field(
        name="profileMonitorStatus", visibility=["read", "create", "update", "delete", "query"]
    )
    """The profile-level monitoring status of the Traffic Manager profile. Known values are:
     \"CheckingEndpoints\", \"Online\", \"Degraded\", \"Disabled\", and \"Inactive\"."""
    protocol: Optional[Union[str, "_models.MonitorProtocol"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. Known values are:
     \"HTTP\", \"HTTPS\", and \"TCP\"."""
    port: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The TCP port used to probe for endpoint health."""
    path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The path relative to the endpoint domain name used to probe for endpoint health."""
    interval_in_seconds: Optional[int] = rest_field(
        name="intervalInSeconds", visibility=["read", "create", "update", "delete", "query"]
    )
    """The monitor interval for endpoints in this profile. This is the interval at which Traffic
     Manager will check the health of each endpoint in this profile."""
    timeout_in_seconds: Optional[int] = rest_field(
        name="timeoutInSeconds", visibility=["read", "create", "update", "delete", "query"]
    )
    """The monitor timeout for endpoints in this profile. This is the time that Traffic Manager allows
     endpoints in this profile to response to the health check."""
    tolerated_number_of_failures: Optional[int] = rest_field(
        name="toleratedNumberOfFailures", visibility=["read", "create", "update", "delete", "query"]
    )
    """The number of consecutive failed health check that Traffic Manager tolerates before declaring
     an endpoint in this profile Degraded after the next failed health check."""
    custom_headers: Optional[list["_models.MonitorConfigCustomHeadersItem"]] = rest_field(
        name="customHeaders", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of custom headers."""
    expected_status_code_ranges: Optional[list["_models.MonitorConfigExpectedStatusCodeRangesItem"]] = rest_field(
        name="expectedStatusCodeRanges", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of expected status code ranges."""

    @overload
    def __init__(
        self,
        *,
        profile_monitor_status: Optional[Union[str, "_models.ProfileMonitorStatus"]] = None,
        protocol: Optional[Union[str, "_models.MonitorProtocol"]] = None,
        port: Optional[int] = None,
        path: Optional[str] = None,
        interval_in_seconds: Optional[int] = None,
        timeout_in_seconds: Optional[int] = None,
        tolerated_number_of_failures: Optional[int] = None,
        custom_headers: Optional[list["_models.MonitorConfigCustomHeadersItem"]] = None,
        expected_status_code_ranges: Optional[list["_models.MonitorConfigExpectedStatusCodeRangesItem"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class MonitorConfigCustomHeadersItem(_Model):
    """Custom header name and value.

    :ivar name: Header name.
    :vartype name: str
    :ivar value: Header value.
    :vartype value: str
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Header name."""
    value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Header value."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        value: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class MonitorConfigExpectedStatusCodeRangesItem(_Model):  # pylint: disable=name-too-long
    """Min and max value of a status code range.

    :ivar min: Min status code.
    :vartype min: int
    :ivar max: Max status code.
    :vartype max: int
    """

    min: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Min status code."""
    max: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Max status code."""

    @overload
    def __init__(
        self,
        *,
        min: Optional[int] = None,  # pylint: disable=redefined-builtin
        max: Optional[int] = None,  # pylint: disable=redefined-builtin
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class TrackedResource(Resource):
    """The resource model definition for a ARM tracked top level resource.

    :ivar id: Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
    :vartype type: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The Azure Region where the resource lives.
    :vartype location: str
    """

    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update"])
    """Resource tags."""
    location: Optional[str] = rest_field(visibility=["read", "create"])
    """The Azure Region where the resource lives."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
        tags: Optional[dict[str, str]] = None,
        location: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class Profile(TrackedResource):
    """Class representing a Traffic Manager profile.

    :ivar id: Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
    :vartype type: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The Azure Region where the resource lives.
    :vartype location: str
    :ivar properties: The properties of the Traffic Manager profile.
    :vartype properties: ~azure.mgmt.trafficmanager.models.ProfileProperties
    """

    properties: Optional["_models.ProfileProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The properties of the Traffic Manager profile."""

    __flattened_items = [
        "profile_status",
        "traffic_routing_method",
        "dns_config",
        "monitor_config",
        "endpoints",
        "traffic_view_enrollment_status",
        "allowed_endpoint_record_types",
        "max_return",
        "record_type",
    ]

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
        tags: Optional[dict[str, str]] = None,
        location: Optional[str] = None,
        properties: Optional["_models.ProfileProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
        super().__init__(*args, **kwargs)
        for k, v in _flattened_input.items():
            setattr(self, k, v)

    def __getattr__(self, name: str) -> Any:
        if name in self.__flattened_items:
            if self.properties is None:
                return None
            return getattr(self.properties, name)
        raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")

    def __setattr__(self, key: str, value: Any) -> None:
        if key in self.__flattened_items:
            if self.properties is None:
                self.properties = self._attr_to_rest_field["properties"]._class_type()
            setattr(self.properties, key, value)
        else:
            super().__setattr__(key, value)


class ProfileProperties(_Model):
    """Class representing the Traffic Manager profile properties.

    :ivar profile_status: The status of the Traffic Manager profile. Known values are: "Enabled"
     and "Disabled".
    :vartype profile_status: str or ~azure.mgmt.trafficmanager.models.ProfileStatus
    :ivar traffic_routing_method: The traffic routing method of the Traffic Manager profile. Known
     values are: "Performance", "Priority", "Weighted", "Geographic", "MultiValue", and "Subnet".
    :vartype traffic_routing_method: str or ~azure.mgmt.trafficmanager.models.TrafficRoutingMethod
    :ivar dns_config: The DNS settings of the Traffic Manager profile.
    :vartype dns_config: ~azure.mgmt.trafficmanager.models.DnsConfig
    :ivar monitor_config: The endpoint monitoring settings of the Traffic Manager profile.
    :vartype monitor_config: ~azure.mgmt.trafficmanager.models.MonitorConfig
    :ivar endpoints: The list of endpoints in the Traffic Manager profile.
    :vartype endpoints: list[~azure.mgmt.trafficmanager.models.Endpoint]
    :ivar traffic_view_enrollment_status: Indicates whether Traffic View is 'Enabled' or 'Disabled'
     for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature will
     increase the cost of the Traffic Manage profile. Known values are: "Enabled" and "Disabled".
    :vartype traffic_view_enrollment_status: str or
     ~azure.mgmt.trafficmanager.models.TrafficViewEnrollmentStatus
    :ivar allowed_endpoint_record_types: The list of allowed endpoint record types.
    :vartype allowed_endpoint_record_types: list[str or
     ~azure.mgmt.trafficmanager.models.AllowedEndpointRecordType]
    :ivar max_return: Maximum number of endpoints to be returned for MultiValue routing type.
    :vartype max_return: int
    :ivar record_type: When record type is set, a traffic manager profile will allow only endpoints
     that match this type. Known values are: "A", "AAAA", and "CNAME".
    :vartype record_type: str or ~azure.mgmt.trafficmanager.models.RecordType
    """

    profile_status: Optional[Union[str, "_models.ProfileStatus"]] = rest_field(
        name="profileStatus", visibility=["read", "create", "update", "delete", "query"]
    )
    """The status of the Traffic Manager profile. Known values are: \"Enabled\" and \"Disabled\"."""
    traffic_routing_method: Optional[Union[str, "_models.TrafficRoutingMethod"]] = rest_field(
        name="trafficRoutingMethod", visibility=["read", "create", "update", "delete", "query"]
    )
    """The traffic routing method of the Traffic Manager profile. Known values are: \"Performance\",
     \"Priority\", \"Weighted\", \"Geographic\", \"MultiValue\", and \"Subnet\"."""
    dns_config: Optional["_models.DnsConfig"] = rest_field(
        name="dnsConfig", visibility=["read", "create", "update", "delete", "query"]
    )
    """The DNS settings of the Traffic Manager profile."""
    monitor_config: Optional["_models.MonitorConfig"] = rest_field(
        name="monitorConfig", visibility=["read", "create", "update", "delete", "query"]
    )
    """The endpoint monitoring settings of the Traffic Manager profile."""
    endpoints: Optional[list["_models.Endpoint"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of endpoints in the Traffic Manager profile."""
    traffic_view_enrollment_status: Optional[Union[str, "_models.TrafficViewEnrollmentStatus"]] = rest_field(
        name="trafficViewEnrollmentStatus", visibility=["read", "create", "update", "delete", "query"]
    )
    """Indicates whether Traffic View is 'Enabled' or 'Disabled' for the Traffic Manager profile.
     Null, indicates 'Disabled'. Enabling this feature will increase the cost of the Traffic Manage
     profile. Known values are: \"Enabled\" and \"Disabled\"."""
    allowed_endpoint_record_types: Optional[list[Union[str, "_models.AllowedEndpointRecordType"]]] = rest_field(
        name="allowedEndpointRecordTypes", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of allowed endpoint record types."""
    max_return: Optional[int] = rest_field(name="maxReturn", visibility=["read", "create", "update", "delete", "query"])
    """Maximum number of endpoints to be returned for MultiValue routing type."""
    record_type: Optional[Union[str, "_models.RecordType"]] = rest_field(
        name="recordType", visibility=["read", "create", "update", "delete", "query"]
    )
    """When record type is set, a traffic manager profile will allow only endpoints that match this
     type. Known values are: \"A\", \"AAAA\", and \"CNAME\"."""

    @overload
    def __init__(
        self,
        *,
        profile_status: Optional[Union[str, "_models.ProfileStatus"]] = None,
        traffic_routing_method: Optional[Union[str, "_models.TrafficRoutingMethod"]] = None,
        dns_config: Optional["_models.DnsConfig"] = None,
        monitor_config: Optional["_models.MonitorConfig"] = None,
        endpoints: Optional[list["_models.Endpoint"]] = None,
        traffic_view_enrollment_status: Optional[Union[str, "_models.TrafficViewEnrollmentStatus"]] = None,
        allowed_endpoint_record_types: Optional[list[Union[str, "_models.AllowedEndpointRecordType"]]] = None,
        max_return: Optional[int] = None,
        record_type: Optional[Union[str, "_models.RecordType"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class QueryExperience(_Model):
    """Class representing a Traffic Manager HeatMap query experience properties.

    :ivar endpoint_id: The id of the endpoint from the 'endpoints' array which these queries were
     routed to. Required.
    :vartype endpoint_id: int
    :ivar query_count: The number of queries originating from this location. Required.
    :vartype query_count: int
    :ivar latency: The latency experienced by queries originating from this location.
    :vartype latency: float
    """

    endpoint_id: int = rest_field(name="endpointId", visibility=["read", "create", "update", "delete", "query"])
    """The id of the endpoint from the 'endpoints' array which these queries were routed to. Required."""
    query_count: int = rest_field(name="queryCount", visibility=["read", "create", "update", "delete", "query"])
    """The number of queries originating from this location. Required."""
    latency: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The latency experienced by queries originating from this location."""

    @overload
    def __init__(
        self,
        *,
        endpoint_id: int,
        query_count: int,
        latency: Optional[float] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class Region(_Model):
    """Class representing a region in the Geographic hierarchy used with the Geographic traffic
    routing method.

    :ivar code: The code of the region.
    :vartype code: str
    :ivar name: The name of the region.
    :vartype name: str
    :ivar regions: The list of Regions grouped under this Region in the Geographic Hierarchy.
    :vartype regions: list[~azure.mgmt.trafficmanager.models.Region]
    """

    code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The code of the region."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name of the region."""
    regions: Optional[list["_models.Region"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The list of Regions grouped under this Region in the Geographic Hierarchy."""

    @overload
    def __init__(
        self,
        *,
        code: Optional[str] = None,
        name: Optional[str] = None,
        regions: Optional[list["_models.Region"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class TrafficFlow(_Model):
    """Class representing a Traffic Manager HeatMap traffic flow properties.

    :ivar source_ip: The IP address that this query experience originated from.
    :vartype source_ip: str
    :ivar latitude: The approximate latitude that these queries originated from.
    :vartype latitude: float
    :ivar longitude: The approximate longitude that these queries originated from.
    :vartype longitude: float
    :ivar query_experiences: The query experiences produced in this HeatMap calculation.
    :vartype query_experiences: list[~azure.mgmt.trafficmanager.models.QueryExperience]
    """

    source_ip: Optional[str] = rest_field(name="sourceIp", visibility=["read", "create", "update", "delete", "query"])
    """The IP address that this query experience originated from."""
    latitude: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The approximate latitude that these queries originated from."""
    longitude: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The approximate longitude that these queries originated from."""
    query_experiences: Optional[list["_models.QueryExperience"]] = rest_field(
        name="queryExperiences", visibility=["read", "create", "update", "delete", "query"]
    )
    """The query experiences produced in this HeatMap calculation."""

    @overload
    def __init__(
        self,
        *,
        source_ip: Optional[str] = None,
        latitude: Optional[float] = None,
        longitude: Optional[float] = None,
        query_experiences: Optional[list["_models.QueryExperience"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class TrafficManagerGeographicHierarchy(ProxyResource):
    """Class representing the Geographic hierarchy used with the Geographic traffic routing method.

    :ivar id: Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
    :vartype type: str
    :ivar properties: The properties of the Geographic Hierarchy resource.
    :vartype properties: ~azure.mgmt.trafficmanager.models.GeographicHierarchyProperties
    """

    properties: Optional["_models.GeographicHierarchyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The properties of the Geographic Hierarchy resource."""

    __flattened_items = ["geographic_hierarchy"]

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
        properties: Optional["_models.GeographicHierarchyProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
        super().__init__(*args, **kwargs)
        for k, v in _flattened_input.items():
            setattr(self, k, v)

    def __getattr__(self, name: str) -> Any:
        if name in self.__flattened_items:
            if self.properties is None:
                return None
            return getattr(self.properties, name)
        raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")

    def __setattr__(self, key: str, value: Any) -> None:
        if key in self.__flattened_items:
            if self.properties is None:
                self.properties = self._attr_to_rest_field["properties"]._class_type()
            setattr(self.properties, key, value)
        else:
            super().__setattr__(key, value)


class TrafficManagerNameAvailability(_Model):
    """Class representing a Traffic Manager Name Availability response.

    :ivar name: The relative name.
    :vartype name: str
    :ivar type: Traffic Manager profile resource type.
    :vartype type: str
    :ivar name_available: Describes whether the relative name is available or not.
    :vartype name_available: bool
    :ivar reason: The reason why the name is not available, when applicable.
    :vartype reason: str
    :ivar message: Descriptive message that explains why the name is not available, when
     applicable.
    :vartype message: str
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The relative name."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Traffic Manager profile resource type."""
    name_available: Optional[bool] = rest_field(
        name="nameAvailable", visibility=["read", "create", "update", "delete", "query"]
    )
    """Describes whether the relative name is available or not."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason why the name is not available, when applicable."""
    message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Descriptive message that explains why the name is not available, when applicable."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        type: Optional[str] = None,
        name_available: Optional[bool] = None,
        reason: Optional[str] = None,
        message: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class UserMetricsModel(ProxyResource):
    """Class representing Traffic Manager User Metrics.

    :ivar id: Fully qualified resource Id for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
    :vartype type: str
    :ivar properties: The properties of the Traffic Manager User Metrics.
    :vartype properties: ~azure.mgmt.trafficmanager.models.UserMetricsProperties
    """

    properties: Optional["_models.UserMetricsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The properties of the Traffic Manager User Metrics."""

    __flattened_items = ["key"]

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
        properties: Optional["_models.UserMetricsProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
        super().__init__(*args, **kwargs)
        for k, v in _flattened_input.items():
            setattr(self, k, v)

    def __getattr__(self, name: str) -> Any:
        if name in self.__flattened_items:
            if self.properties is None:
                return None
            return getattr(self.properties, name)
        raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")

    def __setattr__(self, key: str, value: Any) -> None:
        if key in self.__flattened_items:
            if self.properties is None:
                self.properties = self._attr_to_rest_field["properties"]._class_type()
            setattr(self.properties, key, value)
        else:
            super().__setattr__(key, value)


class UserMetricsProperties(_Model):
    """Class representing a Traffic Manager Real User Metrics key response.

    :ivar key: The key returned by the User Metrics operation.
    :vartype key: str
    """

    key: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The key returned by the User Metrics operation."""

    @overload
    def __init__(
        self,
        *,
        key: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
