# 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 Resource(_Model):
    """Resource.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.extendedlocation.models.SystemData
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}."""
    name: Optional[str] = rest_field(visibility=["read"])
    """The name of the resource."""
    type: Optional[str] = rest_field(visibility=["read"])
    """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or
     \"Microsoft.Storage/storageAccounts\"."""
    system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"])
    """Azure Resource Manager metadata containing createdBy and modifiedBy information."""


class TrackedResource(Resource):
    """Tracked Resource.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.extendedlocation.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    """

    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""
    location: str = rest_field(visibility=["read", "create"])
    """The geo-location where the resource lives. Required."""

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, 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 CustomLocation(TrackedResource):
    """Custom Locations definition.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.extendedlocation.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: The set of properties specific to a Custom Location.
    :vartype properties: ~azure.mgmt.extendedlocation.models.CustomLocationProperties
    :ivar identity: Identity for the resource.
    :vartype identity: ~azure.mgmt.extendedlocation.models.Identity
    """

    properties: Optional["_models.CustomLocationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The set of properties specific to a Custom Location."""
    identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Identity for the resource."""

    __flattened_items = [
        "authentication",
        "cluster_extension_ids",
        "display_name",
        "host_resource_id",
        "host_type",
        "namespace",
        "provisioning_state",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.CustomLocationProperties"] = None,
        identity: Optional["_models.Identity"] = 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 CustomLocationFindTargetResourceGroupProperties(_Model):  # pylint: disable=name-too-long
    """The Find Target Resource Group operation request.

    :ivar labels: Labels of the custom resource, this is a map of {key,value} pairs.
    :vartype labels: dict[str, str]
    """

    labels: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Labels of the custom resource, this is a map of {key,value} pairs."""

    @overload
    def __init__(
        self,
        *,
        labels: Optional[dict[str, 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 CustomLocationFindTargetResourceGroupResult(_Model):  # pylint: disable=name-too-long
    """The Find Target Resource Group operation response.

    :ivar matched_resource_sync_rule: The matching resource sync rule is the particular resource
     sync rule that matched the match expressions and labels and had lowest priority. This is the
     rule responsible for mapping the target resource to the target resource group.
    :vartype matched_resource_sync_rule: str
    :ivar target_resource_group: The target resource group of matching resource sync rule. The
     labels from the request will be used to find out matching resource sync rule against the
     selector property of the resource sync rule. The one with highest priority will be returned if
     there are multiple matching rules.
    :vartype target_resource_group: str
    """

    matched_resource_sync_rule: Optional[str] = rest_field(name="matchedResourceSyncRule", visibility=["read"])
    """The matching resource sync rule is the particular resource sync rule that matched the match
     expressions and labels and had lowest priority. This is the rule responsible for mapping the
     target resource to the target resource group."""
    target_resource_group: Optional[str] = rest_field(name="targetResourceGroup", visibility=["read"])
    """The target resource group of matching resource sync rule. The labels from the request will be
     used to find out matching resource sync rule against the selector property of the resource sync
     rule. The one with highest priority will be returned if there are multiple matching rules."""


class CustomLocationOperation(_Model):
    """Custom Locations operation.

    :ivar display: Describes the properties of a Custom Locations Operation Value Display.
    :vartype display: ~azure.mgmt.extendedlocation.models.CustomLocationOperationValueDisplay
    :ivar is_data_action: Is this Operation a data plane operation.
    :vartype is_data_action: bool
    :ivar name: The name of the compute operation.
    :vartype name: str
    :ivar origin: The origin of the compute operation.
    :vartype origin: str
    """

    display: Optional["_models.CustomLocationOperationValueDisplay"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Describes the properties of a Custom Locations Operation Value Display."""
    is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"])
    """Is this Operation a data plane operation."""
    name: Optional[str] = rest_field(visibility=["read"])
    """The name of the compute operation."""
    origin: Optional[str] = rest_field(visibility=["read"])
    """The origin of the compute operation."""

    __flattened_items = ["description", "operation", "provider", "resource"]

    @overload
    def __init__(
        self,
        *,
        display: Optional["_models.CustomLocationOperationValueDisplay"] = 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.display is None:
                return None
            return getattr(self.display, 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.display is None:
                self.display = self._attr_to_rest_field["display"]._class_type()
            setattr(self.display, key, value)
        else:
            super().__setattr__(key, value)


class CustomLocationOperationValueDisplay(_Model):
    """Describes the properties of a Custom Locations Operation Value Display.

    :ivar description: The description of the operation.
    :vartype description: str
    :ivar operation: The display name of the compute operation.
    :vartype operation: str
    :ivar provider: The resource provider for the operation.
    :vartype provider: str
    :ivar resource: The display name of the resource the operation applies to.
    :vartype resource: str
    """

    description: Optional[str] = rest_field(visibility=["read"])
    """The description of the operation."""
    operation: Optional[str] = rest_field(visibility=["read"])
    """The display name of the compute operation."""
    provider: Optional[str] = rest_field(visibility=["read"])
    """The resource provider for the operation."""
    resource: Optional[str] = rest_field(visibility=["read"])
    """The display name of the resource the operation applies to."""


class CustomLocationProperties(_Model):
    """Properties for a custom location.

    :ivar authentication: This is optional input that contains the authentication that should be
     used to generate the namespace.
    :vartype authentication:
     ~azure.mgmt.extendedlocation.models.CustomLocationPropertiesAuthentication
    :ivar cluster_extension_ids: Contains the reference to the add-on that contains charts to
     deploy CRDs and operators.
    :vartype cluster_extension_ids: list[str]
    :ivar display_name: Display name for the Custom Locations location.
    :vartype display_name: str
    :ivar host_resource_id: Connected Cluster or AKS Cluster. The Custom Locations RP will perform
     a checkAccess API for listAdminCredentials permissions.
    :vartype host_resource_id: str
    :ivar host_type: Type of host the Custom Locations is referencing (Kubernetes, etc...).
     "Kubernetes"
    :vartype host_type: str or ~azure.mgmt.extendedlocation.models.HostType
    :ivar namespace: Kubernetes namespace that will be created on the specified cluster.
    :vartype namespace: str
    :ivar provisioning_state: Provisioning State for the Custom Location.
    :vartype provisioning_state: str
    """

    authentication: Optional["_models.CustomLocationPropertiesAuthentication"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """This is optional input that contains the authentication that should be used to generate the
     namespace."""
    cluster_extension_ids: Optional[list[str]] = rest_field(
        name="clusterExtensionIds", visibility=["read", "create", "update", "delete", "query"]
    )
    """Contains the reference to the add-on that contains charts to deploy CRDs and operators."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name for the Custom Locations location."""
    host_resource_id: Optional[str] = rest_field(
        name="hostResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Connected Cluster or AKS Cluster. The Custom Locations RP will perform a checkAccess API for
     listAdminCredentials permissions."""
    host_type: Optional[Union[str, "_models.HostType"]] = rest_field(
        name="hostType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of host the Custom Locations is referencing (Kubernetes, etc...). \"Kubernetes\""""
    namespace: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Kubernetes namespace that will be created on the specified cluster."""
    provisioning_state: Optional[str] = rest_field(
        name="provisioningState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Provisioning State for the Custom Location."""

    @overload
    def __init__(
        self,
        *,
        authentication: Optional["_models.CustomLocationPropertiesAuthentication"] = None,
        cluster_extension_ids: Optional[list[str]] = None,
        display_name: Optional[str] = None,
        host_resource_id: Optional[str] = None,
        host_type: Optional[Union[str, "_models.HostType"]] = None,
        namespace: Optional[str] = None,
        provisioning_state: 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 CustomLocationPropertiesAuthentication(_Model):
    """This is optional input that contains the authentication that should be used to generate the
    namespace.

    :ivar type: The type of the Custom Locations authentication.
    :vartype type: str
    :ivar value: The kubeconfig value.
    :vartype value: str
    """

    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The type of the Custom Locations authentication."""
    value: Optional[str] = rest_field(visibility=["create", "update"])
    """The kubeconfig value."""

    @overload
    def __init__(
        self,
        *,
        type: 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 ProxyResource(Resource):
    """Proxy Resource.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.extendedlocation.models.SystemData
    """


class EnabledResourceType(ProxyResource):
    """EnabledResourceType definition.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar properties: The set of properties for EnabledResourceType specific to a Custom Location.
    :vartype properties: ~azure.mgmt.extendedlocation.models.EnabledResourceTypeProperties
    :ivar system_data: Metadata pertaining to creation and last modification of the resource.
    :vartype system_data: ~azure.mgmt.extendedlocation.models.SystemData
    """

    properties: Optional["_models.EnabledResourceTypeProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The set of properties for EnabledResourceType specific to a Custom Location."""

    __flattened_items = ["cluster_extension_id", "extension_type", "types_metadata"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.EnabledResourceTypeProperties"] = 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 EnabledResourceTypeProperties(_Model):
    """Properties for EnabledResourceType of a custom location.

    :ivar cluster_extension_id: Cluster Extension ID.
    :vartype cluster_extension_id: str
    :ivar extension_type: Cluster Extension Type.
    :vartype extension_type: str
    :ivar types_metadata: Metadata of the Resource Type.
    :vartype types_metadata:
     list[~azure.mgmt.extendedlocation.models.EnabledResourceTypePropertiesTypesMetadataItem]
    """

    cluster_extension_id: Optional[str] = rest_field(
        name="clusterExtensionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Cluster Extension ID."""
    extension_type: Optional[str] = rest_field(
        name="extensionType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Cluster Extension Type."""
    types_metadata: Optional[list["_models.EnabledResourceTypePropertiesTypesMetadataItem"]] = rest_field(
        name="typesMetadata", visibility=["read", "create", "update", "delete", "query"]
    )
    """Metadata of the Resource Type."""

    @overload
    def __init__(
        self,
        *,
        cluster_extension_id: Optional[str] = None,
        extension_type: Optional[str] = None,
        types_metadata: Optional[list["_models.EnabledResourceTypePropertiesTypesMetadataItem"]] = 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 EnabledResourceTypePropertiesTypesMetadataItem(_Model):  # pylint: disable=name-too-long
    """Metadata of the Resource Type.

    :ivar api_version: Api Version of Resource Type.
    :vartype api_version: str
    :ivar resource_provider_namespace: Resource Provider Namespace of Resource Type.
    :vartype resource_provider_namespace: str
    :ivar resource_type: Resource Type.
    :vartype resource_type: str
    """

    api_version: Optional[str] = rest_field(
        name="apiVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Api Version of Resource Type."""
    resource_provider_namespace: Optional[str] = rest_field(
        name="resourceProviderNamespace", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource Provider Namespace of Resource Type."""
    resource_type: Optional[str] = rest_field(
        name="resourceType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource Type."""

    @overload
    def __init__(
        self,
        *,
        api_version: Optional[str] = None,
        resource_provider_namespace: Optional[str] = None,
        resource_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 ErrorAdditionalInfo(_Model):
    """The resource management error additional info.

    :ivar type: The additional info type.
    :vartype type: str
    :ivar info: The additional info.
    :vartype info: any
    """

    type: Optional[str] = rest_field(visibility=["read"])
    """The additional info type."""
    info: Optional[Any] = rest_field(visibility=["read"])
    """The additional info."""


class ErrorDetail(_Model):
    """The error detail.

    :ivar code: The error code.
    :vartype code: str
    :ivar message: The error message.
    :vartype message: str
    :ivar target: The error target.
    :vartype target: str
    :ivar details: The error details.
    :vartype details: list[~azure.mgmt.extendedlocation.models.ErrorDetail]
    :ivar additional_info: The error additional info.
    :vartype additional_info: list[~azure.mgmt.extendedlocation.models.ErrorAdditionalInfo]
    """

    code: Optional[str] = rest_field(visibility=["read"])
    """The error code."""
    message: Optional[str] = rest_field(visibility=["read"])
    """The error message."""
    target: Optional[str] = rest_field(visibility=["read"])
    """The error target."""
    details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"])
    """The error details."""
    additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field(
        name="additionalInfo", visibility=["read"]
    )
    """The error additional info."""


class ErrorResponse(_Model):
    """Error response.

    :ivar error: The error object.
    :vartype error: ~azure.mgmt.extendedlocation.models.ErrorDetail
    """

    error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The error object."""

    @overload
    def __init__(
        self,
        *,
        error: Optional["_models.ErrorDetail"] = 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 Identity(_Model):
    """Identity for the resource.

    :ivar principal_id: The principal ID of resource identity.
    :vartype principal_id: str
    :ivar tenant_id: The tenant ID of resource.
    :vartype tenant_id: str
    :ivar type: The identity type. Known values are: "SystemAssigned" and "None".
    :vartype type: str or ~azure.mgmt.extendedlocation.models.ResourceIdentityType
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The principal ID of resource identity."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"])
    """The tenant ID of resource."""
    type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The identity type. Known values are: \"SystemAssigned\" and \"None\"."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.ResourceIdentityType"]] = 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 MatchExpressionsProperties(_Model):
    """Resource Sync Rules matchExpression property definition.

    :ivar key: Key is the label key that the selector applies to.
    :vartype key: str
    :ivar operator: The Operator field represents a key's relationship to a set of values. Valid
     operators are In, NotIn, Exists and DoesNotExist.
    :vartype operator: str
    :ivar values_property: The label value.
    :vartype values_property: list[str]
    """

    key: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Key is the label key that the selector applies to."""
    operator: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The Operator field represents a key's relationship to a set of values. Valid operators are In,
     NotIn, Exists and DoesNotExist."""
    values_property: Optional[list[str]] = rest_field(
        name="values", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="values"
    )
    """The label value."""

    @overload
    def __init__(
        self,
        *,
        key: Optional[str] = None,
        operator: Optional[str] = None,
        values_property: Optional[list[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 PatchableCustomLocations(_Model):
    """The Custom Locations patchable resource definition.

    :ivar identity: Identity for the resource.
    :vartype identity: ~azure.mgmt.extendedlocation.models.Identity
    :ivar properties: The Custom Locations patchable properties.
    :vartype properties: ~azure.mgmt.extendedlocation.models.CustomLocationProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Identity for the resource."""
    properties: Optional["_models.CustomLocationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The Custom Locations patchable properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = [
        "authentication",
        "cluster_extension_ids",
        "display_name",
        "host_resource_id",
        "host_type",
        "namespace",
        "provisioning_state",
    ]

    @overload
    def __init__(
        self,
        *,
        identity: Optional["_models.Identity"] = None,
        properties: Optional["_models.CustomLocationProperties"] = None,
        tags: Optional[dict[str, 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:
        _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 PatchableResourceSyncRule(_Model):
    """The Resource Sync Rules patchable resource definition.

    :ivar properties: The Resource Sync Rules patchable properties.
    :vartype properties: ~azure.mgmt.extendedlocation.models.ResourceSyncRuleProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    properties: Optional["_models.ResourceSyncRuleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The Resource Sync Rules patchable properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = ["priority", "provisioning_state", "selector", "target_resource_group"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ResourceSyncRuleProperties"] = None,
        tags: Optional[dict[str, 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:
        _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 ResourceSyncRule(TrackedResource):
    """Resource Sync Rules definition.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.extendedlocation.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: The set of properties specific to a Resource Sync Rule.
    :vartype properties: ~azure.mgmt.extendedlocation.models.ResourceSyncRuleProperties
    """

    properties: Optional["_models.ResourceSyncRuleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The set of properties specific to a Resource Sync Rule."""

    __flattened_items = ["priority", "provisioning_state", "selector", "target_resource_group"]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.ResourceSyncRuleProperties"] = 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 ResourceSyncRuleProperties(_Model):
    """Properties for a resource sync rule. For an unmapped custom resource, its labels will be used
    to find out matching resource sync rules using the selector property of the resource sync rule.
    If this resource sync rule has highest priority among all matching rules, then the unmapped
    custom resource will be projected to the target resource group associated with this resource
    sync rule.

    :ivar priority: Priority represents a priority of the Resource Sync Rule.
    :vartype priority: int
    :ivar provisioning_state: Provisioning State for the Resource Sync Rule.
    :vartype provisioning_state: str
    :ivar selector: A label selector is composed of two parts, matchLabels and matchExpressions.
     The first part, matchLabels is a map of {key,value} pairs. A single {key,value} in the
     matchLabels map is equivalent to an element of matchExpressions, whose key field is 'key', the
     operator is 'In', and the values array contains only 'value'. The second part, matchExpressions
     is a list of resource selector requirements. Valid operators include In, NotIn, Exists, and
     DoesNotExist. The values set must be non-empty in the case of In and NotIn. The values set must
     be empty in the case of Exists and DoesNotExist. All of the requirements, from both matchLabels
     and matchExpressions must all be satisfied in order to match.
    :vartype selector: ~azure.mgmt.extendedlocation.models.ResourceSyncRulePropertiesSelector
    :ivar target_resource_group: For an unmapped custom resource, its labels will be used to find
     matching resource sync rules. If this resource sync rule is one of the matching rules with
     highest priority, then the unmapped custom resource will be projected to the target resource
     group associated with this resource sync rule. The user creating this resource sync rule should
     have write permissions on the target resource group and this write permission will be validated
     when creating the resource sync rule.
    :vartype target_resource_group: str
    """

    priority: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Priority represents a priority of the Resource Sync Rule."""
    provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"])
    """Provisioning State for the Resource Sync Rule."""
    selector: Optional["_models.ResourceSyncRulePropertiesSelector"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """A label selector is composed of two parts, matchLabels and matchExpressions. The first part,
     matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is
     equivalent to an element of matchExpressions, whose key field is 'key', the operator is 'In',
     and the values array contains only 'value'. The second part, matchExpressions is a list of
     resource selector requirements. Valid operators include In, NotIn, Exists, and DoesNotExist.
     The values set must be non-empty in the case of In and NotIn. The values set must be empty in
     the case of Exists and DoesNotExist. All of the requirements, from both matchLabels and
     matchExpressions must all be satisfied in order to match."""
    target_resource_group: Optional[str] = rest_field(
        name="targetResourceGroup", visibility=["read", "create", "update", "delete", "query"]
    )
    """For an unmapped custom resource, its labels will be used to find matching resource sync rules.
     If this resource sync rule is one of the matching rules with highest priority, then the
     unmapped custom resource will be projected to the target resource group associated with this
     resource sync rule. The user creating this resource sync rule should have write permissions on
     the target resource group and this write permission will be validated when creating the
     resource sync rule."""

    @overload
    def __init__(
        self,
        *,
        priority: Optional[int] = None,
        selector: Optional["_models.ResourceSyncRulePropertiesSelector"] = None,
        target_resource_group: 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 ResourceSyncRulePropertiesSelector(_Model):
    """A label selector is composed of two parts, matchLabels and matchExpressions. The first part,
    matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is
    equivalent to an element of matchExpressions, whose key field is 'key', the operator is 'In',
    and the values array contains only 'value'. The second part, matchExpressions is a list of
    resource selector requirements. Valid operators include In, NotIn, Exists, and DoesNotExist.
    The values set must be non-empty in the case of In and NotIn. The values set must be empty in
    the case of Exists and DoesNotExist. All of the requirements, from both matchLabels and
    matchExpressions must all be satisfied in order to match.

    :ivar match_expressions: MatchExpressions is a list of resource selector requirements. Valid
     operators include In, NotIn, Exists, and DoesNotExist. The values set must be non-empty in the
     case of In and NotIn. The values set must be empty in the case of Exists and DoesNotExist.
    :vartype match_expressions:
     list[~azure.mgmt.extendedlocation.models.MatchExpressionsProperties]
    :ivar match_labels: MatchLabels is a map of {key,value} pairs. A single {key,value} in the
     matchLabels map is equivalent to an element of matchExpressions, whose key field is 'key', the
     operator is 'In', and the values array contains only 'value'.
    :vartype match_labels: dict[str, str]
    """

    match_expressions: Optional[list["_models.MatchExpressionsProperties"]] = rest_field(
        name="matchExpressions", visibility=["read", "create", "update", "delete", "query"]
    )
    """MatchExpressions is a list of resource selector requirements. Valid operators include In,
     NotIn, Exists, and DoesNotExist. The values set must be non-empty in the case of In and NotIn.
     The values set must be empty in the case of Exists and DoesNotExist."""
    match_labels: Optional[dict[str, str]] = rest_field(
        name="matchLabels", visibility=["read", "create", "update", "delete", "query"]
    )
    """MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is
     equivalent to an element of matchExpressions, whose key field is 'key', the operator is 'In',
     and the values array contains only 'value'."""

    __flattened_items = [""]

    @overload
    def __init__(
        self,
        *,
        match_expressions: Optional[list["_models.MatchExpressionsProperties"]] = None,
        match_labels: Optional[dict[str, 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:
        _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.match_expressions is None:
                return None
            return getattr(self.match_expressions, 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.match_expressions is None:
                self.match_expressions = self._attr_to_rest_field["match_expressions"]._class_type()
            setattr(self.match_expressions, key, value)
        else:
            super().__setattr__(key, value)


class SystemData(_Model):
    """Metadata pertaining to creation and last modification of the resource.

    :ivar created_by: The identity that created the resource.
    :vartype created_by: str
    :ivar created_by_type: The type of identity that created the resource. Known values are:
     "User", "Application", "ManagedIdentity", and "Key".
    :vartype created_by_type: str or ~azure.mgmt.extendedlocation.models.CreatedByType
    :ivar created_at: The timestamp of resource creation (UTC).
    :vartype created_at: ~datetime.datetime
    :ivar last_modified_by: The identity that last modified the resource.
    :vartype last_modified_by: str
    :ivar last_modified_by_type: The type of identity that last modified the resource. Known values
     are: "User", "Application", "ManagedIdentity", and "Key".
    :vartype last_modified_by_type: str or ~azure.mgmt.extendedlocation.models.CreatedByType
    :ivar last_modified_at: The timestamp of resource last modification (UTC).
    :vartype last_modified_at: ~datetime.datetime
    """

    created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"])
    """The identity that created the resource."""
    created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(
        name="createdByType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of identity that created the resource. Known values are: \"User\", \"Application\",
     \"ManagedIdentity\", and \"Key\"."""
    created_at: Optional[datetime.datetime] = rest_field(
        name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The timestamp of resource creation (UTC)."""
    last_modified_by: Optional[str] = rest_field(
        name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"]
    )
    """The identity that last modified the resource."""
    last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(
        name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of identity that last modified the resource. Known values are: \"User\",
     \"Application\", \"ManagedIdentity\", and \"Key\"."""
    last_modified_at: Optional[datetime.datetime] = rest_field(
        name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The timestamp of resource last modification (UTC)."""

    @overload
    def __init__(
        self,
        *,
        created_by: Optional[str] = None,
        created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
        created_at: Optional[datetime.datetime] = None,
        last_modified_by: Optional[str] = None,
        last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
        last_modified_at: Optional[datetime.datetime] = 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)
