# 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 AdministratorProperties(_Model):
    """Properties of a active directory administrator.

    :ivar administrator_type: Type of the sever administrator. "ActiveDirectory"
    :vartype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
    :ivar login: Login name of the server administrator. Required.
    :vartype login: str
    :ivar sid: SID (object ID) of the server administrator. Required.
    :vartype sid: str
    :ivar tenant_id: Tenant ID of the administrator.
    :vartype tenant_id: str
    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
    :vartype azure_ad_only_authentication: bool
    """

    administrator_type: Optional[Union[str, "_models.AdministratorType"]] = rest_field(
        name="administratorType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the sever administrator. \"ActiveDirectory\""""
    login: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Login name of the server administrator. Required."""
    sid: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """SID (object ID) of the server administrator. Required."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"])
    """Tenant ID of the administrator."""
    azure_ad_only_authentication: Optional[bool] = rest_field(name="azureADOnlyAuthentication", visibility=["read"])
    """Azure Active Directory only Authentication enabled."""

    @overload
    def __init__(
        self,
        *,
        login: str,
        sid: str,
        administrator_type: Optional[Union[str, "_models.AdministratorType"]] = None,
        tenant_id: 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 AdvancedThreatProtectionProperties(_Model):
    """Properties of an Advanced Threat Protection state.

    :ivar state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
     disabled or a state has not been applied yet on the specific database or server. Required.
     Known values are: "New", "Enabled", and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    state: Union[str, "_models.AdvancedThreatProtectionState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or a
     state has not been applied yet on the specific database or server. Required. Known values are:
     \"New\", \"Enabled\", and \"Disabled\"."""
    creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339")
    """Specifies the UTC creation time of the policy."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.AdvancedThreatProtectionState"],
    ) -> 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):
    """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.sql.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 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.sql.models.SystemData
    """


class Advisor(ProxyResource):
    """Database, Server or Elastic Pool Advisor.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.AdvisorProperties
    :ivar kind: Resource kind.
    :vartype kind: str
    :ivar location: Resource location.
    :vartype location: str
    """

    properties: Optional["_models.AdvisorProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Resource kind."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Resource location."""

    __flattened_items = [
        "advisor_status",
        "auto_execute_status",
        "auto_execute_status_inherited_from",
        "recommendations_status",
        "last_checked",
        "recommended_actions",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.AdvisorProperties"] = 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 AdvisorProperties(_Model):
    """Properties for a Database, Server or Elastic Pool Advisor.

    :ivar advisor_status: Gets the status of availability of this advisor to customers. Possible
     values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. Known values
     are: "GA", "PublicPreview", "LimitedPublicPreview", and "PrivatePreview".
    :vartype advisor_status: str or ~azure.mgmt.sql.models.AdvisorStatus
    :ivar auto_execute_status: Gets the auto-execute status (whether to let the system execute the
     recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Required. Known
     values are: "Enabled", "Disabled", and "Default".
    :vartype auto_execute_status: str or ~azure.mgmt.sql.models.AutoExecuteStatus
    :ivar auto_execute_status_inherited_from: Gets the resource from which current value of
     auto-execute status is inherited. Auto-execute status can be set on (and inherited from)
     different levels in the resource hierarchy. Possible values are 'Subscription', 'Server',
     'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). Known
     values are: "Default", "Subscription", "Server", "ElasticPool", and "Database".
    :vartype auto_execute_status_inherited_from: str or
     ~azure.mgmt.sql.models.AutoExecuteStatusInheritedFrom
    :ivar recommendations_status: Gets that status of recommendations for this advisor and reason
     for not having any recommendations. Possible values include, but are not limited to, 'Ok'
     (Recommendations available),LowActivity (not enough workload to analyze), 'DbSeemsTuned'
     (Database is doing well), etc.
    :vartype recommendations_status: str
    :ivar last_checked: Gets the time when the current resource was analyzed for recommendations by
     this advisor.
    :vartype last_checked: ~datetime.datetime
    :ivar recommended_actions: Gets the recommended actions for this advisor.
    :vartype recommended_actions: list[~azure.mgmt.sql.models.RecommendedAction]
    """

    advisor_status: Optional[Union[str, "_models.AdvisorStatus"]] = rest_field(
        name="advisorStatus", visibility=["read"]
    )
    """Gets the status of availability of this advisor to customers. Possible values are 'GA',
     'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. Known values are: \"GA\",
     \"PublicPreview\", \"LimitedPublicPreview\", and \"PrivatePreview\"."""
    auto_execute_status: Union[str, "_models.AutoExecuteStatus"] = rest_field(
        name="autoExecuteStatus", visibility=["read", "create", "update", "delete", "query"]
    )
    """Gets the auto-execute status (whether to let the system execute the recommendations) of this
     advisor. Possible values are 'Enabled' and 'Disabled'. Required. Known values are: \"Enabled\",
     \"Disabled\", and \"Default\"."""
    auto_execute_status_inherited_from: Optional[Union[str, "_models.AutoExecuteStatusInheritedFrom"]] = rest_field(
        name="autoExecuteStatusInheritedFrom", visibility=["read"]
    )
    """Gets the resource from which current value of auto-execute status is inherited. Auto-execute
     status can be set on (and inherited from) different levels in the resource hierarchy. Possible
     values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is
     not explicitly set on any level). Known values are: \"Default\", \"Subscription\", \"Server\",
     \"ElasticPool\", and \"Database\"."""
    recommendations_status: Optional[str] = rest_field(name="recommendationsStatus", visibility=["read"])
    """Gets that status of recommendations for this advisor and reason for not having any
     recommendations. Possible values include, but are not limited to, 'Ok' (Recommendations
     available),LowActivity (not enough workload to analyze), 'DbSeemsTuned' (Database is doing
     well), etc."""
    last_checked: Optional[datetime.datetime] = rest_field(name="lastChecked", visibility=["read"], format="rfc3339")
    """Gets the time when the current resource was analyzed for recommendations by this advisor."""
    recommended_actions: Optional[list["_models.RecommendedAction"]] = rest_field(
        name="recommendedActions", visibility=["read"]
    )
    """Gets the recommended actions for this advisor."""

    @overload
    def __init__(
        self,
        *,
        auto_execute_status: Union[str, "_models.AutoExecuteStatus"],
    ) -> 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 AutomaticTuningOptions(_Model):
    """Automatic tuning properties for individual advisors.

    :ivar desired_state: Automatic tuning option desired state. Known values are: "Off", "On", and
     "Default".
    :vartype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeDesired
    :ivar actual_state: Automatic tuning option actual state. Known values are: "Off" and "On".
    :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeActual
    :ivar reason_code: Reason code if desired and actual state are different.
    :vartype reason_code: int
    :ivar reason_desc: Reason description if desired and actual state are different. Known values
     are: "Default", "Disabled", "AutoConfigured", "InheritedFromServer", "QueryStoreOff",
     "QueryStoreReadOnly", and "NotSupported".
    :vartype reason_desc: str or ~azure.mgmt.sql.models.AutomaticTuningDisabledReason
    """

    desired_state: Optional[Union[str, "_models.AutomaticTuningOptionModeDesired"]] = rest_field(
        name="desiredState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Automatic tuning option desired state. Known values are: \"Off\", \"On\", and \"Default\"."""
    actual_state: Optional[Union[str, "_models.AutomaticTuningOptionModeActual"]] = rest_field(
        name="actualState", visibility=["read"]
    )
    """Automatic tuning option actual state. Known values are: \"Off\" and \"On\"."""
    reason_code: Optional[int] = rest_field(name="reasonCode", visibility=["read"])
    """Reason code if desired and actual state are different."""
    reason_desc: Optional[Union[str, "_models.AutomaticTuningDisabledReason"]] = rest_field(
        name="reasonDesc", visibility=["read"]
    )
    """Reason description if desired and actual state are different. Known values are: \"Default\",
     \"Disabled\", \"AutoConfigured\", \"InheritedFromServer\", \"QueryStoreOff\",
     \"QueryStoreReadOnly\", and \"NotSupported\"."""

    @overload
    def __init__(
        self,
        *,
        desired_state: Optional[Union[str, "_models.AutomaticTuningOptionModeDesired"]] = 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 AutomaticTuningServerOptions(_Model):
    """Automatic tuning properties for individual advisors.

    :ivar desired_state: Automatic tuning option desired state. Known values are: "Off", "On", and
     "Default".
    :vartype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeDesired
    :ivar actual_state: Automatic tuning option actual state. Known values are: "Off" and "On".
    :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeActual
    :ivar reason_code: Reason code if desired and actual state are different.
    :vartype reason_code: int
    :ivar reason_desc: Reason description if desired and actual state are different. Known values
     are: "Default", "Disabled", and "AutoConfigured".
    :vartype reason_desc: str or ~azure.mgmt.sql.models.AutomaticTuningServerReason
    """

    desired_state: Optional[Union[str, "_models.AutomaticTuningOptionModeDesired"]] = rest_field(
        name="desiredState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Automatic tuning option desired state. Known values are: \"Off\", \"On\", and \"Default\"."""
    actual_state: Optional[Union[str, "_models.AutomaticTuningOptionModeActual"]] = rest_field(
        name="actualState", visibility=["read"]
    )
    """Automatic tuning option actual state. Known values are: \"Off\" and \"On\"."""
    reason_code: Optional[int] = rest_field(name="reasonCode", visibility=["read"])
    """Reason code if desired and actual state are different."""
    reason_desc: Optional[Union[str, "_models.AutomaticTuningServerReason"]] = rest_field(
        name="reasonDesc", visibility=["read"]
    )
    """Reason description if desired and actual state are different. Known values are: \"Default\",
     \"Disabled\", and \"AutoConfigured\"."""

    @overload
    def __init__(
        self,
        *,
        desired_state: Optional[Union[str, "_models.AutomaticTuningOptionModeDesired"]] = 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 AutomaticTuningServerProperties(_Model):
    """Server-level Automatic Tuning properties.

    :ivar desired_state: Automatic tuning desired state. Known values are: "Custom", "Auto", and
     "Unspecified".
    :vartype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningServerMode
    :ivar actual_state: Automatic tuning actual state. Known values are: "Custom", "Auto", and
     "Unspecified".
    :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningServerMode
    :ivar options: Automatic tuning options definition.
    :vartype options: dict[str, ~azure.mgmt.sql.models.AutomaticTuningServerOptions]
    """

    desired_state: Optional[Union[str, "_models.AutomaticTuningServerMode"]] = rest_field(
        name="desiredState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Automatic tuning desired state. Known values are: \"Custom\", \"Auto\", and \"Unspecified\"."""
    actual_state: Optional[Union[str, "_models.AutomaticTuningServerMode"]] = rest_field(
        name="actualState", visibility=["read"]
    )
    """Automatic tuning actual state. Known values are: \"Custom\", \"Auto\", and \"Unspecified\"."""
    options: Optional[dict[str, "_models.AutomaticTuningServerOptions"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Automatic tuning options definition."""

    @overload
    def __init__(
        self,
        *,
        desired_state: Optional[Union[str, "_models.AutomaticTuningServerMode"]] = None,
        options: Optional[dict[str, "_models.AutomaticTuningServerOptions"]] = 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 AutoPauseDelayTimeRange(_Model):
    """Supported auto pause delay time range.

    :ivar min_value: Minimum value.
    :vartype min_value: int
    :ivar max_value: Maximum value.
    :vartype max_value: int
    :ivar step_size: Step value for discrete values between the minimum value and the maximum
     value.
    :vartype step_size: int
    :ivar default: Default value is no value is provided.
    :vartype default: int
    :ivar unit: Unit of time that delay is expressed in. "Minutes"
    :vartype unit: str or ~azure.mgmt.sql.models.PauseDelayTimeUnit
    :ivar do_not_pause_value: Value that is used to not pause (infinite delay before pause).
    :vartype do_not_pause_value: int
    """

    min_value: Optional[int] = rest_field(name="minValue", visibility=["read"])
    """Minimum value."""
    max_value: Optional[int] = rest_field(name="maxValue", visibility=["read"])
    """Maximum value."""
    step_size: Optional[int] = rest_field(name="stepSize", visibility=["read"])
    """Step value for discrete values between the minimum value and the maximum value."""
    default: Optional[int] = rest_field(visibility=["read"])
    """Default value is no value is provided."""
    unit: Optional[Union[str, "_models.PauseDelayTimeUnit"]] = rest_field(visibility=["read"])
    """Unit of time that delay is expressed in. \"Minutes\""""
    do_not_pause_value: Optional[int] = rest_field(name="doNotPauseValue", visibility=["read"])
    """Value that is used to not pause (infinite delay before pause)."""


class AzureADOnlyAuthProperties(_Model):
    """Properties of a active directory only authentication.

    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
     Required.
    :vartype azure_ad_only_authentication: bool
    """

    azure_ad_only_authentication: bool = rest_field(
        name="azureADOnlyAuthentication", visibility=["read", "create", "update", "delete", "query"]
    )
    """Azure Active Directory only Authentication enabled. Required."""

    @overload
    def __init__(
        self,
        *,
        azure_ad_only_authentication: bool,
    ) -> 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 BackupShortTermRetentionPolicy(ProxyResource):
    """A short term retention policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.BackupShortTermRetentionPolicyProperties
    """

    properties: Optional["_models.BackupShortTermRetentionPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["retention_days", "diff_backup_interval_in_hours"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.BackupShortTermRetentionPolicyProperties"] = 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 BackupShortTermRetentionPolicyProperties(_Model):
    """Properties of a short term retention policy.

    :ivar retention_days: The backup retention period in days. This is how many days Point-in-Time
     Restore will be supported.
    :vartype retention_days: int
    :ivar diff_backup_interval_in_hours: The differential backup interval in hours. This is how
     many interval hours between each differential backup will be supported. This is only applicable
     to live databases but not dropped databases. Known values are: 12 and 24.
    :vartype diff_backup_interval_in_hours: int or ~azure.mgmt.sql.models.DiffBackupIntervalInHours
    """

    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """The backup retention period in days. This is how many days Point-in-Time Restore will be
     supported."""
    diff_backup_interval_in_hours: Optional[Union[int, "_models.DiffBackupIntervalInHours"]] = rest_field(
        name="diffBackupIntervalInHours", visibility=["read", "create", "update", "delete", "query"]
    )
    """The differential backup interval in hours. This is how many interval hours between each
     differential backup will be supported. This is only applicable to live databases but not
     dropped databases. Known values are: 12 and 24."""

    @overload
    def __init__(
        self,
        *,
        retention_days: Optional[int] = None,
        diff_backup_interval_in_hours: Optional[Union[int, "_models.DiffBackupIntervalInHours"]] = 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 Baseline(_Model):
    """SQL Vulnerability Assessment baseline Details.

    :ivar expected_results: SQL Vulnerability Assessment baseline expected results.
    :vartype expected_results: list[list[str]]
    :ivar updated_time: SQL Vulnerability Assessment baseline update time (UTC).
    :vartype updated_time: ~datetime.datetime
    """

    expected_results: Optional[list[list[str]]] = rest_field(name="expectedResults", visibility=["read"])
    """SQL Vulnerability Assessment baseline expected results."""
    updated_time: Optional[datetime.datetime] = rest_field(name="updatedTime", visibility=["read"], format="rfc3339")
    """SQL Vulnerability Assessment baseline update time (UTC)."""


class BaselineAdjustedResult(_Model):
    """SQL Vulnerability Assessment baseline adjusted results.

    :ivar baseline: SQL Vulnerability Assessment baseline details.
    :vartype baseline: ~azure.mgmt.sql.models.Baseline
    :ivar status: SQL Vulnerability Assessment baseline status. Known values are: "NonFinding",
     "Finding", and "InternalError".
    :vartype status: str or ~azure.mgmt.sql.models.RuleStatus
    :ivar results_not_in_baseline: SQL Vulnerability Assessment results that are not in baseline.
    :vartype results_not_in_baseline: list[list[str]]
    :ivar results_only_in_baseline: SQL Vulnerability Assessment results that are in baseline.
    :vartype results_only_in_baseline: list[list[str]]
    """

    baseline: Optional["_models.Baseline"] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment baseline details."""
    status: Optional[Union[str, "_models.RuleStatus"]] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment baseline status. Known values are: \"NonFinding\", \"Finding\",
     and \"InternalError\"."""
    results_not_in_baseline: Optional[list[list[str]]] = rest_field(name="resultsNotInBaseline", visibility=["read"])
    """SQL Vulnerability Assessment results that are not in baseline."""
    results_only_in_baseline: Optional[list[list[str]]] = rest_field(name="resultsOnlyInBaseline", visibility=["read"])
    """SQL Vulnerability Assessment results that are in baseline."""


class BenchmarkReference(_Model):
    """SQL Vulnerability Assessment benchmark reference.

    :ivar benchmark: SQL Vulnerability Assessment benchmark name.
    :vartype benchmark: str
    :ivar reference: SQL Vulnerability Assessment benchmark reference.
    :vartype reference: str
    """

    benchmark: Optional[str] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment benchmark name."""
    reference: Optional[str] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment benchmark reference."""


class CertificateInfo(_Model):
    """Certificate information.

    :ivar certificate_name: The certificate name.
    :vartype certificate_name: str
    :ivar expiry_date: The certificate expiry date.
    :vartype expiry_date: ~datetime.datetime
    """

    certificate_name: Optional[str] = rest_field(name="certificateName", visibility=["read"])
    """The certificate name."""
    expiry_date: Optional[datetime.datetime] = rest_field(name="expiryDate", visibility=["read"], format="rfc3339")
    """The certificate expiry date."""


class ChangeLongTermRetentionBackupAccessTierParameters(_Model):  # pylint: disable=name-too-long
    """Contains the information necessary to change long term retention backup access tier and related
    operation mode.

    :ivar backup_storage_access_tier: The long term retention backup storage access tier. Required.
    :vartype backup_storage_access_tier: str
    :ivar operation_mode: The operation mode when updating ltr backup storage access tier.
     Required.
    :vartype operation_mode: str
    """

    backup_storage_access_tier: str = rest_field(
        name="backupStorageAccessTier", visibility=["read", "create", "update", "delete", "query"]
    )
    """The long term retention backup storage access tier. Required."""
    operation_mode: str = rest_field(name="operationMode", visibility=["read", "create", "update", "delete", "query"])
    """The operation mode when updating ltr backup storage access tier. Required."""

    @overload
    def __init__(
        self,
        *,
        backup_storage_access_tier: str,
        operation_mode: str,
    ) -> 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 CheckNameAvailabilityRequest(_Model):
    """A request to check whether the specified name for a resource is available.

    :ivar name: Required.
    :vartype name: str
    :ivar type: Required. "Microsoft.Sql/servers"
    :vartype type: str or ~azure.mgmt.sql.models.CheckNameAvailabilityResourceType
    """

    name: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Required."""
    type: Union[str, "_models.CheckNameAvailabilityResourceType"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Required. \"Microsoft.Sql/servers\""""

    @overload
    def __init__(
        self,
        *,
        name: str,
        type: Union[str, "_models.CheckNameAvailabilityResourceType"],
    ) -> 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 CheckNameAvailabilityResponse(_Model):
    """The result of a name availability check.

    :ivar name: The name whose availability was checked.
    :vartype name: str
    :ivar available: True if the name is available, otherwise false.
    :vartype available: bool
    :ivar reason: The reason code explaining why the name is unavailable. Will be undefined if the
     name is available. Known values are: "Invalid" and "AlreadyExists".
    :vartype reason: str or ~azure.mgmt.sql.models.CheckNameAvailabilityReason
    :ivar message: A message explaining why the name is unavailable. Will be undefined if the name
     is available.
    :vartype message: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The name whose availability was checked."""
    available: Optional[bool] = rest_field(visibility=["read"])
    """True if the name is available, otherwise false."""
    reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = rest_field(visibility=["read"])
    """The reason code explaining why the name is unavailable. Will be undefined if the name is
     available. Known values are: \"Invalid\" and \"AlreadyExists\"."""
    message: Optional[str] = rest_field(visibility=["read"])
    """A message explaining why the name is unavailable. Will be undefined if the name is available."""


class CompleteDatabaseRestoreDefinition(_Model):
    """Contains the information necessary to perform a complete database restore operation.

    :ivar last_backup_name: The last backup name to apply. Required.
    :vartype last_backup_name: str
    """

    last_backup_name: str = rest_field(
        name="lastBackupName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The last backup name to apply. Required."""

    @overload
    def __init__(
        self,
        *,
        last_backup_name: str,
    ) -> 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 CopyLongTermRetentionBackupParameters(_Model):
    """Contains the information necessary to perform long term retention backup copy operation.

    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.CopyLongTermRetentionBackupParametersProperties
    """

    properties: Optional["_models.CopyLongTermRetentionBackupParametersProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "target_subscription_id",
        "target_resource_group",
        "target_server_resource_id",
        "target_server_fully_qualified_domain_name",
        "target_database_name",
        "target_backup_storage_redundancy",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.CopyLongTermRetentionBackupParametersProperties"] = 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 CopyLongTermRetentionBackupParametersProperties(_Model):  # pylint: disable=name-too-long
    """Contains the properties to perform long term retention backup copy operation.

    :ivar target_subscription_id: The subscription that owns the target server.
    :vartype target_subscription_id: str
    :ivar target_resource_group: The resource group that owns the target server.
    :vartype target_resource_group: str
    :ivar target_server_resource_id: The resource Id of the target server that owns the database.
    :vartype target_server_resource_id: str
    :ivar target_server_fully_qualified_domain_name: The fully qualified domain name of the target
     server.
    :vartype target_server_fully_qualified_domain_name: str
    :ivar target_database_name: The name of the database owns the copied backup.
    :vartype target_database_name: str
    :ivar target_backup_storage_redundancy: The storage redundancy type of the copied backup. Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype target_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    """

    target_subscription_id: Optional[str] = rest_field(name="targetSubscriptionId", visibility=["create"])
    """The subscription that owns the target server."""
    target_resource_group: Optional[str] = rest_field(name="targetResourceGroup", visibility=["create"])
    """The resource group that owns the target server."""
    target_server_resource_id: Optional[str] = rest_field(name="targetServerResourceId", visibility=["create"])
    """The resource Id of the target server that owns the database."""
    target_server_fully_qualified_domain_name: Optional[str] = rest_field(
        name="targetServerFullyQualifiedDomainName", visibility=["create"]
    )
    """The fully qualified domain name of the target server."""
    target_database_name: Optional[str] = rest_field(name="targetDatabaseName", visibility=["create"])
    """The name of the database owns the copied backup."""
    target_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="targetBackupStorageRedundancy", visibility=["create"]
    )
    """The storage redundancy type of the copied backup. Known values are: \"Geo\", \"Local\",
     \"Zone\", and \"GeoZone\"."""

    @overload
    def __init__(
        self,
        *,
        target_subscription_id: Optional[str] = None,
        target_resource_group: Optional[str] = None,
        target_server_resource_id: Optional[str] = None,
        target_server_fully_qualified_domain_name: Optional[str] = None,
        target_database_name: Optional[str] = None,
        target_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = 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 CreateDatabaseRestorePointDefinition(_Model):
    """Contains the information necessary to perform a create database restore point operation.

    :ivar restore_point_label: The restore point label to apply. Required.
    :vartype restore_point_label: str
    """

    restore_point_label: str = rest_field(
        name="restorePointLabel", visibility=["read", "create", "update", "delete", "query"]
    )
    """The restore point label to apply. Required."""

    @overload
    def __init__(
        self,
        *,
        restore_point_label: str,
    ) -> 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):
    """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.sql.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 Database(TrackedResource):
    """A database 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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseProperties
    :ivar sku: The database SKU.

     The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU
     name, tier/edition, family, and capacity) that are available to your subscription in an Azure
     region, use the ``Capabilities_ListByLocation`` REST API or one of the following commands:



     .. code-block:: azurecli

        az sql db list-editions -l <location> -o table



     .. code-block:: powershell

        Get-AzSqlServerServiceObjective -Location <location>
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar kind: Kind of database. This is metadata used for the Azure portal experience.
    :vartype kind: str
    :ivar managed_by: Resource that manages the database.
    :vartype managed_by: str
    :ivar identity: The Azure Active Directory identity of the database.
    :vartype identity: ~azure.mgmt.sql.models.DatabaseIdentity
    """

    properties: Optional["_models.DatabaseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The database SKU.
     
     The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU
     name, tier/edition, family, and capacity) that are available to your subscription in an Azure
     region, use the ``Capabilities_ListByLocation`` REST API or one of the following commands:
     
     
     
     .. code-block:: azurecli
     
        az sql db list-editions -l <location> -o table
     
     
     
     .. code-block:: powershell
     
        Get-AzSqlServerServiceObjective -Location <location>"""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Kind of database. This is metadata used for the Azure portal experience."""
    managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read"])
    """Resource that manages the database."""
    identity: Optional["_models.DatabaseIdentity"] = rest_field(visibility=["read", "create"])
    """The Azure Active Directory identity of the database."""

    __flattened_items = [
        "create_mode",
        "collation",
        "max_size_bytes",
        "sample_name",
        "elastic_pool_id",
        "source_database_id",
        "status",
        "database_id",
        "creation_date",
        "current_service_objective_name",
        "requested_service_objective_name",
        "default_secondary_location",
        "failover_group_id",
        "restore_point_in_time",
        "source_database_deletion_date",
        "recovery_services_recovery_point_id",
        "long_term_retention_backup_resource_id",
        "recoverable_database_id",
        "restorable_dropped_database_id",
        "catalog_collation",
        "zone_redundant",
        "license_type",
        "max_log_size_bytes",
        "earliest_restore_date",
        "read_scale",
        "high_availability_replica_count",
        "secondary_type",
        "current_sku",
        "auto_pause_delay",
        "current_backup_storage_redundancy",
        "requested_backup_storage_redundancy",
        "min_capacity",
        "paused_date",
        "resumed_date",
        "maintenance_configuration_id",
        "is_ledger_on",
        "is_infra_encryption_enabled",
        "federated_client_id",
        "keys_property",
        "encryption_protector",
        "preferred_enclave_type",
        "use_free_limit",
        "free_limit_exhaustion_behavior",
        "source_resource_id",
        "manual_cutover",
        "perform_cutover",
        "availability_zone",
        "encryption_protector_auto_rotation",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.DatabaseProperties"] = None,
        sku: Optional["_models.Sku"] = None,
        identity: Optional["_models.DatabaseIdentity"] = 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 DatabaseAdvancedThreatProtection(ProxyResource):
    """A database Advanced Threat Protection.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.AdvancedThreatProtectionProperties
    """

    properties: Optional["_models.AdvancedThreatProtectionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["state", "creation_time"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.AdvancedThreatProtectionProperties"] = 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 DatabaseAutomaticTuning(ProxyResource):
    """Database-level Automatic Tuning.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseAutomaticTuningProperties
    """

    properties: Optional["_models.DatabaseAutomaticTuningProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["desired_state", "actual_state", "options"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseAutomaticTuningProperties"] = 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 DatabaseAutomaticTuningProperties(_Model):
    """Database-level Automatic Tuning properties.

    :ivar desired_state: Automatic tuning desired state. Known values are: "Inherit", "Custom",
     "Auto", and "Unspecified".
    :vartype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningMode
    :ivar actual_state: Automatic tuning actual state. Known values are: "Inherit", "Custom",
     "Auto", and "Unspecified".
    :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningMode
    :ivar options: Automatic tuning options definition.
    :vartype options: dict[str, ~azure.mgmt.sql.models.AutomaticTuningOptions]
    """

    desired_state: Optional[Union[str, "_models.AutomaticTuningMode"]] = rest_field(
        name="desiredState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Automatic tuning desired state. Known values are: \"Inherit\", \"Custom\", \"Auto\", and
     \"Unspecified\"."""
    actual_state: Optional[Union[str, "_models.AutomaticTuningMode"]] = rest_field(
        name="actualState", visibility=["read"]
    )
    """Automatic tuning actual state. Known values are: \"Inherit\", \"Custom\", \"Auto\", and
     \"Unspecified\"."""
    options: Optional[dict[str, "_models.AutomaticTuningOptions"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Automatic tuning options definition."""

    @overload
    def __init__(
        self,
        *,
        desired_state: Optional[Union[str, "_models.AutomaticTuningMode"]] = None,
        options: Optional[dict[str, "_models.AutomaticTuningOptions"]] = 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 DatabaseBlobAuditingPolicy(ProxyResource):
    """A database blob auditing policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseBlobAuditingPolicyProperties
    :ivar kind: Resource kind.
    :vartype kind: str
    """

    properties: Optional["_models.DatabaseBlobAuditingPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Resource kind."""

    __flattened_items = [
        "retention_days",
        "audit_actions_and_groups",
        "is_storage_secondary_key_in_use",
        "is_azure_monitor_target_enabled",
        "queue_delay_ms",
        "is_managed_identity_in_use",
        "state",
        "storage_endpoint",
        "storage_account_access_key",
        "storage_account_subscription_id",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseBlobAuditingPolicyProperties"] = 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 DatabaseBlobAuditingPolicyProperties(_Model):
    """Properties of a database blob auditing policy.

    :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage
     account.
    :vartype retention_days: int
    :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:

     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.

     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.

     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP

     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.

     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES

     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}

     Note that <object> in the above format can refer to an object like a table, view, or stored
     procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name}
     and SCHEMA::{schema_name} are used, respectively.

     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public

     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
    :vartype audit_actions_and_groups: list[str]
    :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the
     storage's secondary key.
    :vartype is_storage_secondary_key_in_use: bool
    :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.

     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit
     actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum
     is 2,147,483,647.
    :vartype queue_delay_ms: int
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     `https://MyAccount.blob.core.windows.net <https://MyAccount.blob.core.windows.net>`_). If state
     is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:

     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355).
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the number of days to keep in the audit logs in the storage account."""
    audit_actions_and_groups: Optional[list[str]] = rest_field(
        name="auditActionsAndGroups", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the Actions-Groups and Actions to audit.
     
     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:
     
     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.
     
     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.
     
     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):
     
     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP
     
     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.
     
     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.
     
     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES
     
     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}
     
     Note that <object> in the above format can refer to an object like a table, view, or stored
     procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name}
     and SCHEMA::{schema_name} are used, respectively.
     
     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public
     
     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_."""
    is_storage_secondary_key_in_use: Optional[bool] = rest_field(
        name="isStorageSecondaryKeyInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether storageAccountAccessKey value is the storage's secondary key."""
    is_azure_monitor_target_enabled: Optional[bool] = rest_field(
        name="isAzureMonitorTargetEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether audit events are sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.
     
     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.
     
     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_
     
     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_."""
    queue_delay_ms: Optional[int] = rest_field(
        name="queueDelayMs", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the amount of time in milliseconds that can elapse before audit actions are forced to
     be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647."""
    is_managed_identity_in_use: Optional[bool] = rest_field(
        name="isManagedIdentityInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether Managed Identity is used to access blob storage."""
    state: Union[str, "_models.BlobAuditingPolicyState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: \"Enabled\" and
     \"Disabled\"."""
    storage_endpoint: Optional[str] = rest_field(
        name="storageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage endpoint (e.g. `https://MyAccount.blob.core.windows.net
     <https://MyAccount.blob.core.windows.net>`_). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["create", "update"]
    )
    """Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:
     
     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355)."""
    storage_account_subscription_id: Optional[str] = rest_field(
        name="storageAccountSubscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage subscription Id."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.BlobAuditingPolicyState"],
        retention_days: Optional[int] = None,
        audit_actions_and_groups: Optional[list[str]] = None,
        is_storage_secondary_key_in_use: Optional[bool] = None,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        queue_delay_ms: Optional[int] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: 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 DatabaseColumn(ProxyResource):
    """A database column 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseColumnProperties
    """

    properties: Optional["_models.DatabaseColumnProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["column_type", "temporal_type", "memory_optimized", "is_computed"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseColumnProperties"] = 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 DatabaseColumnProperties(_Model):
    """Database column properties.

    :ivar column_type: The column data type. Known values are: "image", "text", "uniqueidentifier",
     "date", "time", "datetime2", "datetimeoffset", "tinyint", "smallint", "int", "smalldatetime",
     "real", "money", "datetime", "float", "sql_variant", "ntext", "bit", "decimal", "numeric",
     "smallmoney", "bigint", "hierarchyid", "geometry", "geography", "varbinary", "varchar",
     "binary", "char", "timestamp", "nvarchar", "nchar", "xml", and "sysname".
    :vartype column_type: str or ~azure.mgmt.sql.models.ColumnDataType
    :ivar temporal_type: The table temporal type. Known values are: "NonTemporalTable",
     "HistoryTable", and "SystemVersionedTemporalTable".
    :vartype temporal_type: str or ~azure.mgmt.sql.models.TableTemporalType
    :ivar memory_optimized: Whether or not the column belongs to a memory optimized table.
    :vartype memory_optimized: bool
    :ivar is_computed: Whether or not the column is computed.
    :vartype is_computed: bool
    """

    column_type: Optional[Union[str, "_models.ColumnDataType"]] = rest_field(
        name="columnType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The column data type. Known values are: \"image\", \"text\", \"uniqueidentifier\", \"date\",
     \"time\", \"datetime2\", \"datetimeoffset\", \"tinyint\", \"smallint\", \"int\",
     \"smalldatetime\", \"real\", \"money\", \"datetime\", \"float\", \"sql_variant\", \"ntext\",
     \"bit\", \"decimal\", \"numeric\", \"smallmoney\", \"bigint\", \"hierarchyid\", \"geometry\",
     \"geography\", \"varbinary\", \"varchar\", \"binary\", \"char\", \"timestamp\", \"nvarchar\",
     \"nchar\", \"xml\", and \"sysname\"."""
    temporal_type: Optional[Union[str, "_models.TableTemporalType"]] = rest_field(
        name="temporalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The table temporal type. Known values are: \"NonTemporalTable\", \"HistoryTable\", and
     \"SystemVersionedTemporalTable\"."""
    memory_optimized: Optional[bool] = rest_field(
        name="memoryOptimized", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not the column belongs to a memory optimized table."""
    is_computed: Optional[bool] = rest_field(
        name="isComputed", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not the column is computed."""

    @overload
    def __init__(
        self,
        *,
        column_type: Optional[Union[str, "_models.ColumnDataType"]] = None,
        temporal_type: Optional[Union[str, "_models.TableTemporalType"]] = None,
        memory_optimized: Optional[bool] = None,
        is_computed: Optional[bool] = 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 DatabaseExtensions(ProxyResource):
    """An Import, Export, or PolybaseImport 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseExtensionsProperties
    """

    properties: Optional["_models.DatabaseExtensionsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "operation_mode",
        "storage_key_type",
        "storage_key",
        "storage_uri",
        "administrator_login",
        "administrator_login_password",
        "authentication_type",
        "database_edition",
        "service_objective_name",
        "max_size_bytes",
        "network_isolation",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseExtensionsProperties"] = 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 DatabaseExtensionsProperties(_Model):
    """Contains the database information after a successful Import, Export, or PolybaseImport.

    :ivar operation_mode: Operation mode of the operation: Import, Export, or PolybaseImport.
     Required. Known values are: "PolybaseImport", "Import", and "Export".
    :vartype operation_mode: str or ~azure.mgmt.sql.models.OperationMode
    :ivar storage_key_type: Storage key type: StorageAccessKey, SharedAccessKey or ManagedIdentity.
     Required. Known values are: "SharedAccessKey", "StorageAccessKey", and "ManagedIdentity".
    :vartype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
    :ivar storage_key: Storage key for the storage account. If StorageKeyType is ManagedIdentity,
     this field should specify the Managed Identity's resource ID. Required.
    :vartype storage_key: str
    :ivar storage_uri: Storage Uri for the storage account. Required.
    :vartype storage_uri: str
    :ivar administrator_login: Administrator login name. If AuthenticationType is ManagedIdentity,
     this field should specify the Managed Identity's resource ID.
    :vartype administrator_login: str
    :ivar administrator_login_password: Administrator login password. If AuthenticationType is
     ManagedIdentity, this field should not be specified.
    :vartype administrator_login_password: str
    :ivar authentication_type: Authentication type used to access the SQL: Sql, ADPassword or
     ManagedIdentity.
    :vartype authentication_type: str
    :ivar database_edition: Database edition for the newly created database in the case of an
     import operation.
    :vartype database_edition: str
    :ivar service_objective_name: Database service level objective for the newly created database
     in the case of an import operation.
    :vartype service_objective_name: str
    :ivar max_size_bytes: Database max size in bytes for the newly created database in the case of
     an import operation.
    :vartype max_size_bytes: str
    :ivar network_isolation: Optional resource information to enable network isolation for request.
    :vartype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
    """

    operation_mode: Union[str, "_models.OperationMode"] = rest_field(name="operationMode", visibility=["create"])
    """Operation mode of the operation: Import, Export, or PolybaseImport. Required. Known values are:
     \"PolybaseImport\", \"Import\", and \"Export\"."""
    storage_key_type: Union[str, "_models.StorageKeyType"] = rest_field(name="storageKeyType", visibility=["create"])
    """Storage key type: StorageAccessKey, SharedAccessKey or ManagedIdentity. Required. Known values
     are: \"SharedAccessKey\", \"StorageAccessKey\", and \"ManagedIdentity\"."""
    storage_key: str = rest_field(name="storageKey", visibility=["create"])
    """Storage key for the storage account. If StorageKeyType is ManagedIdentity, this field should
     specify the Managed Identity's resource ID. Required."""
    storage_uri: str = rest_field(name="storageUri", visibility=["create"])
    """Storage Uri for the storage account. Required."""
    administrator_login: Optional[str] = rest_field(name="administratorLogin", visibility=["create"])
    """Administrator login name. If AuthenticationType is ManagedIdentity, this field should specify
     the Managed Identity's resource ID."""
    administrator_login_password: Optional[str] = rest_field(name="administratorLoginPassword", visibility=["create"])
    """Administrator login password. If AuthenticationType is ManagedIdentity, this field should not
     be specified."""
    authentication_type: Optional[str] = rest_field(name="authenticationType", visibility=["create"])
    """Authentication type used to access the SQL: Sql, ADPassword or ManagedIdentity."""
    database_edition: Optional[str] = rest_field(name="databaseEdition", visibility=["create"])
    """Database edition for the newly created database in the case of an import operation."""
    service_objective_name: Optional[str] = rest_field(name="serviceObjectiveName", visibility=["create"])
    """Database service level objective for the newly created database in the case of an import
     operation."""
    max_size_bytes: Optional[str] = rest_field(name="maxSizeBytes", visibility=["create"])
    """Database max size in bytes for the newly created database in the case of an import operation."""
    network_isolation: Optional["_models.NetworkIsolationSettings"] = rest_field(
        name="networkIsolation", visibility=["create"]
    )
    """Optional resource information to enable network isolation for request."""

    @overload
    def __init__(
        self,
        *,
        operation_mode: Union[str, "_models.OperationMode"],
        storage_key_type: Union[str, "_models.StorageKeyType"],
        storage_key: str,
        storage_uri: str,
        administrator_login: Optional[str] = None,
        administrator_login_password: Optional[str] = None,
        authentication_type: Optional[str] = None,
        database_edition: Optional[str] = None,
        service_objective_name: Optional[str] = None,
        max_size_bytes: Optional[str] = None,
        network_isolation: Optional["_models.NetworkIsolationSettings"] = 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 DatabaseIdentity(_Model):
    """Azure Active Directory identity configuration for a resource.

    :ivar type: The identity type. Known values are: "None" and "UserAssigned".
    :vartype type: str or ~azure.mgmt.sql.models.DatabaseIdentityType
    :ivar tenant_id: The Azure Active Directory tenant id.
    :vartype tenant_id: str
    :ivar user_assigned_identities: The resource ids of the user assigned identities to use.
    :vartype user_assigned_identities: dict[str, ~azure.mgmt.sql.models.DatabaseUserIdentity]
    """

    type: Optional[Union[str, "_models.DatabaseIdentityType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The identity type. Known values are: \"None\" and \"UserAssigned\"."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"])
    """The Azure Active Directory tenant id."""
    user_assigned_identities: Optional[dict[str, "_models.DatabaseUserIdentity"]] = rest_field(
        name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource ids of the user assigned identities to use."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.DatabaseIdentityType"]] = None,
        user_assigned_identities: Optional[dict[str, "_models.DatabaseUserIdentity"]] = 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 DatabaseKey(_Model):
    """Database level key used for encryption at rest.

    :ivar type: The database key type. Only supported value is 'AzureKeyVault'. "AzureKeyVault"
    :vartype type: str or ~azure.mgmt.sql.models.DatabaseKeyType
    :ivar thumbprint: Thumbprint of the database key.
    :vartype thumbprint: str
    :ivar creation_date: The database key creation date.
    :vartype creation_date: ~datetime.datetime
    :ivar subregion: Subregion of the server key.
    :vartype subregion: str
    :ivar key_version: The database key's version.
    :vartype key_version: str
    """

    type: Optional[Union[str, "_models.DatabaseKeyType"]] = rest_field(visibility=["read"])
    """The database key type. Only supported value is 'AzureKeyVault'. \"AzureKeyVault\""""
    thumbprint: Optional[str] = rest_field(visibility=["read"])
    """Thumbprint of the database key."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """The database key creation date."""
    subregion: Optional[str] = rest_field(visibility=["read"])
    """Subregion of the server key."""
    key_version: Optional[str] = rest_field(name="keyVersion", visibility=["read"])
    """The database key's version."""


class DatabaseOperation(ProxyResource):
    """A database operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseOperationProperties
    """

    properties: Optional["_models.DatabaseOperationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "database_name",
        "operation",
        "operation_friendly_name",
        "percent_complete",
        "server_name",
        "start_time",
        "state",
        "error_code",
        "error_description",
        "error_severity",
        "is_user_error",
        "estimated_completion_time",
        "description",
        "is_cancellable",
        "operation_phase_details",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseOperationProperties"] = 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 DatabaseOperationProperties(_Model):
    """The properties of a database operation.

    :ivar database_name: The name of the database the operation is being performed on.
    :vartype database_name: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar server_name: The name of the server.
    :vartype server_name: str
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    :ivar operation_phase_details: The operation phase details.
    :vartype operation_phase_details: ~azure.mgmt.sql.models.PhaseDetails
    """

    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """The name of the database the operation is being performed on."""
    operation: Optional[str] = rest_field(visibility=["read"])
    """The name of operation."""
    operation_friendly_name: Optional[str] = rest_field(name="operationFriendlyName", visibility=["read"])
    """The friendly name of operation."""
    percent_complete: Optional[int] = rest_field(name="percentComplete", visibility=["read"])
    """The percentage of the operation completed."""
    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """The name of the server."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The operation start time."""
    state: Optional[Union[str, "_models.ManagementOperationState"]] = rest_field(visibility=["read"])
    """The operation state. Known values are: \"Pending\", \"InProgress\", \"Succeeded\", \"Failed\",
     \"CancelInProgress\", and \"Cancelled\"."""
    error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"])
    """The operation error code."""
    error_description: Optional[str] = rest_field(name="errorDescription", visibility=["read"])
    """The operation error description."""
    error_severity: Optional[int] = rest_field(name="errorSeverity", visibility=["read"])
    """The operation error severity."""
    is_user_error: Optional[bool] = rest_field(name="isUserError", visibility=["read"])
    """Whether or not the error is a user error."""
    estimated_completion_time: Optional[datetime.datetime] = rest_field(
        name="estimatedCompletionTime", visibility=["read"], format="rfc3339"
    )
    """The estimated completion time of the operation."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The operation description."""
    is_cancellable: Optional[bool] = rest_field(name="isCancellable", visibility=["read"])
    """Whether the operation can be cancelled."""
    operation_phase_details: Optional["_models.PhaseDetails"] = rest_field(
        name="operationPhaseDetails", visibility=["read"]
    )
    """The operation phase details."""


class DatabaseProperties(_Model):
    """The database's properties.

    :ivar create_mode: Specifies the mode of database creation.

     Default: regular database creation.

     Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified
     as the resource ID of the source database.

     Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId
     must be specified as the resource ID of the existing primary database.

     PointInTimeRestore: Creates a database by restoring a point in time backup of an existing
     database. sourceDatabaseId must be specified as the resource ID of the existing database, and
     restorePointInTime must be specified.

     Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be
     specified as the recoverable database resource ID to restore.

     Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must
     be specified. If sourceDatabaseId is the database's original resource ID, then
     sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable
     dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may
     also be specified to restore from an earlier point in time.

     RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention
     vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource
     ID.

     Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse
     edition. Known values are: "Default", "Copy", "Secondary", "PointInTimeRestore", "Restore",
     "Recovery", "RestoreExternalBackup", "RestoreExternalBackupSecondary",
     "RestoreLongTermRetentionBackup", and "OnlineSecondary".
    :vartype create_mode: str or ~azure.mgmt.sql.models.CreateMode
    :ivar collation: The collation of the database.
    :vartype collation: str
    :ivar max_size_bytes: The max size of the database expressed in bytes.
    :vartype max_size_bytes: int
    :ivar sample_name: The name of the sample schema to apply when creating this database. Known
     values are: "AdventureWorksLT", "WideWorldImportersStd", and "WideWorldImportersFull".
    :vartype sample_name: str or ~azure.mgmt.sql.models.SampleName
    :ivar elastic_pool_id: The resource identifier of the elastic pool containing this database.
    :vartype elastic_pool_id: str
    :ivar source_database_id: The resource identifier of the source database associated with create
     operation of this database.
    :vartype source_database_id: str
    :ivar status: The status of the database. Known values are: "Online", "Restoring",
     "RecoveryPending", "Recovering", "Suspect", "Offline", "Standby", "Shutdown", "EmergencyMode",
     "AutoClosed", "Copying", "Creating", "Inaccessible", "OfflineSecondary", "Pausing", "Paused",
     "Resuming", "Scaling", "OfflineChangingDwPerformanceTiers", "OnlineChangingDwPerformanceTiers",
     "Disabled", "Stopping", "Stopped", and "Starting".
    :vartype status: str or ~azure.mgmt.sql.models.DatabaseStatus
    :ivar database_id: The ID of the database.
    :vartype database_id: str
    :ivar creation_date: The creation date of the database (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar current_service_objective_name: The current service level objective name of the database.
    :vartype current_service_objective_name: str
    :ivar requested_service_objective_name: The requested service level objective name of the
     database.
    :vartype requested_service_objective_name: str
    :ivar default_secondary_location: The default secondary region for this database.
    :vartype default_secondary_location: str
    :ivar failover_group_id: Failover Group resource identifier that this database belongs to.
    :vartype failover_group_id: str
    :ivar restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
     database that will be restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar source_database_deletion_date: Specifies the time that the database was deleted.
    :vartype source_database_deletion_date: ~datetime.datetime
    :ivar recovery_services_recovery_point_id: The resource identifier of the recovery point
     associated with create operation of this database.
    :vartype recovery_services_recovery_point_id: str
    :ivar long_term_retention_backup_resource_id: The resource identifier of the long term
     retention backup associated with create operation of this database.
    :vartype long_term_retention_backup_resource_id: str
    :ivar recoverable_database_id: The resource identifier of the recoverable database associated
     with create operation of this database.
    :vartype recoverable_database_id: str
    :ivar restorable_dropped_database_id: The resource identifier of the restorable dropped
     database associated with create operation of this database.
    :vartype restorable_dropped_database_id: str
    :ivar catalog_collation: Collation of the metadata catalog. Known values are:
     "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
    :vartype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
    :ivar zone_redundant: Whether or not this database is zone redundant, which means the replicas
     of this database will be spread across multiple availability zones.
    :vartype zone_redundant: bool
    :ivar license_type: The license type to apply for this database. ``LicenseIncluded`` if you
     need a license, or ``BasePrice`` if you have a license and are eligible for the Azure Hybrid
     Benefit. Known values are: "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType
    :ivar max_log_size_bytes: The max log size for this database.
    :vartype max_log_size_bytes: int
    :ivar earliest_restore_date: This records the earliest start date and time that restore is
     available for this database (ISO8601 format).
    :vartype earliest_restore_date: ~datetime.datetime
    :ivar read_scale: The state of read-only routing. If enabled, connections that have application
     intent set to readonly in their connection string may be routed to a readonly secondary replica
     in the same region. Not applicable to a Hyperscale database within an elastic pool. Known
     values are: "Enabled" and "Disabled".
    :vartype read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale
    :ivar high_availability_replica_count: The number of secondary replicas associated with the
     Business Critical, Premium, or Hyperscale edition database that are used to provide high
     availability. Not applicable to a Hyperscale database within an elastic pool.
    :vartype high_availability_replica_count: int
    :ivar secondary_type: The secondary type of the database if it is a secondary.  Valid values
     are Geo, Named and Standby. Known values are: "Geo", "Named", and "Standby".
    :vartype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType
    :ivar current_sku: The name and tier of the SKU.
    :vartype current_sku: ~azure.mgmt.sql.models.Sku
    :ivar auto_pause_delay: Time in minutes after which database is automatically paused. A value
     of -1 means that automatic pause is disabled.
    :vartype auto_pause_delay: int
    :ivar current_backup_storage_redundancy: The storage account type used to store backups for
     this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype current_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage account type to be used to store backups
     for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar min_capacity: Minimal capacity that database will always have allocated, if not paused.
    :vartype min_capacity: float
    :ivar paused_date: The date when database was paused by user configuration or action(ISO8601
     format). Null if the database is ready.
    :vartype paused_date: ~datetime.datetime
    :ivar resumed_date: The date when database was resumed by user action or database login
     (ISO8601 format). Null if the database is paused.
    :vartype resumed_date: ~datetime.datetime
    :ivar maintenance_configuration_id: Maintenance configuration id assigned to the database. This
     configuration defines the period when the maintenance updates will occur.
    :vartype maintenance_configuration_id: str
    :ivar is_ledger_on: Whether or not this database is a ledger database, which means all tables
     in the database are ledger tables. Note: the value of this property cannot be changed after the
     database has been created.
    :vartype is_ledger_on: bool
    :ivar is_infra_encryption_enabled: Infra encryption is enabled for this database.
    :vartype is_infra_encryption_enabled: bool
    :ivar federated_client_id: The Client id used for cross tenant per database CMK scenario.
    :vartype federated_client_id: str
    :ivar keys_property: The resource ids of the user assigned identities to use.
    :vartype keys_property: dict[str, ~azure.mgmt.sql.models.DatabaseKey]
    :ivar encryption_protector: The azure key vault URI of the database if it's configured with per
     Database Customer Managed Keys.
    :vartype encryption_protector: str
    :ivar preferred_enclave_type: Type of enclave requested on the database i.e. Default or VBS
     enclaves. Known values are: "Default" and "VBS".
    :vartype preferred_enclave_type: str or ~azure.mgmt.sql.models.AlwaysEncryptedEnclaveType
    :ivar use_free_limit: Whether or not the database uses free monthly limits. Allowed on one
     database in a subscription.
    :vartype use_free_limit: bool
    :ivar free_limit_exhaustion_behavior: Specifies the behavior when monthly free limits are
     exhausted for the free database.

     AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the
     month.

     BillForUsage: The database will continue to be online upon exhaustion of free limits and any
     overage will be billed. Known values are: "AutoPause" and "BillOverUsage".
    :vartype free_limit_exhaustion_behavior: str or
     ~azure.mgmt.sql.models.FreeLimitExhaustionBehavior
    :ivar source_resource_id: The resource identifier of the source associated with the create
     operation of this database.

     This property is only supported for DataWarehouse edition and allows to restore across
     subscriptions.

     When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId,
     restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode
     must be PointInTimeRestore, Restore or Recover.

     When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing
     database or existing sql pool, and restorePointInTime must be specified.

     When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped
     database or restorable dropped sql pool.

     When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or
     recoverable sql pool.

     When source subscription belongs to a different tenant than target subscription,
     “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant.
     For more details about “x-ms-authorization-auxiliary” header see
     `https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant
     <https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant>`_.
    :vartype source_resource_id: str
    :ivar manual_cutover: Whether or not customer controlled manual cutover needs to be done during
     Update Database operation to Hyperscale tier.

     This property is only applicable when scaling database from Business Critical/General
     Purpose/Premium/Standard tier to Hyperscale tier.

     When manualCutover is specified, the scaling operation will wait for user input to trigger
     cutover to Hyperscale database.

     To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in
     Waiting state.
    :vartype manual_cutover: bool
    :ivar perform_cutover: To trigger customer controlled manual cutover during the wait state
     while Scaling operation is in progress.

     This property parameter is only applicable for scaling operations that are initiated along with
     'manualCutover' parameter.

     This property is only applicable when scaling database from Business Critical/General
     Purpose/Premium/Standard tier to Hyperscale tier is already in progress.

     When performCutover is specified, the scaling operation will trigger cutover and perform
     role-change to Hyperscale database.
    :vartype perform_cutover: bool
    :ivar availability_zone: Specifies the availability zone the database is pinned to. Known
     values are: "NoPreference", "1", "2", and "3".
    :vartype availability_zone: str or ~azure.mgmt.sql.models.AvailabilityZoneType
    :ivar encryption_protector_auto_rotation: The flag to enable or disable auto rotation of
     database encryption protector AKV key.
    :vartype encryption_protector_auto_rotation: bool
    """

    create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field(name="createMode", visibility=["create"])
    """Specifies the mode of database creation.
     
     Default: regular database creation.
     
     Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified
     as the resource ID of the source database.
     
     Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId
     must be specified as the resource ID of the existing primary database.
     
     PointInTimeRestore: Creates a database by restoring a point in time backup of an existing
     database. sourceDatabaseId must be specified as the resource ID of the existing database, and
     restorePointInTime must be specified.
     
     Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be
     specified as the recoverable database resource ID to restore.
     
     Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must
     be specified. If sourceDatabaseId is the database's original resource ID, then
     sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable
     dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may
     also be specified to restore from an earlier point in time.
     
     RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention
     vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource
     ID.
     
     Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse
     edition. Known values are: \"Default\", \"Copy\", \"Secondary\", \"PointInTimeRestore\",
     \"Restore\", \"Recovery\", \"RestoreExternalBackup\", \"RestoreExternalBackupSecondary\",
     \"RestoreLongTermRetentionBackup\", and \"OnlineSecondary\"."""
    collation: Optional[str] = rest_field(visibility=["read", "create"])
    """The collation of the database."""
    max_size_bytes: Optional[int] = rest_field(
        name="maxSizeBytes", visibility=["read", "create", "update", "delete", "query"]
    )
    """The max size of the database expressed in bytes."""
    sample_name: Optional[Union[str, "_models.SampleName"]] = rest_field(name="sampleName", visibility=["create"])
    """The name of the sample schema to apply when creating this database. Known values are:
     \"AdventureWorksLT\", \"WideWorldImportersStd\", and \"WideWorldImportersFull\"."""
    elastic_pool_id: Optional[str] = rest_field(
        name="elasticPoolId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource identifier of the elastic pool containing this database."""
    source_database_id: Optional[str] = rest_field(name="sourceDatabaseId", visibility=["create"])
    """The resource identifier of the source database associated with create operation of this
     database."""
    status: Optional[Union[str, "_models.DatabaseStatus"]] = rest_field(visibility=["read"])
    """The status of the database. Known values are: \"Online\", \"Restoring\", \"RecoveryPending\",
     \"Recovering\", \"Suspect\", \"Offline\", \"Standby\", \"Shutdown\", \"EmergencyMode\",
     \"AutoClosed\", \"Copying\", \"Creating\", \"Inaccessible\", \"OfflineSecondary\", \"Pausing\",
     \"Paused\", \"Resuming\", \"Scaling\", \"OfflineChangingDwPerformanceTiers\",
     \"OnlineChangingDwPerformanceTiers\", \"Disabled\", \"Stopping\", \"Stopped\", and
     \"Starting\"."""
    database_id: Optional[str] = rest_field(name="databaseId", visibility=["read"])
    """The ID of the database."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """The creation date of the database (ISO8601 format)."""
    current_service_objective_name: Optional[str] = rest_field(name="currentServiceObjectiveName", visibility=["read"])
    """The current service level objective name of the database."""
    requested_service_objective_name: Optional[str] = rest_field(
        name="requestedServiceObjectiveName", visibility=["read"]
    )
    """The requested service level objective name of the database."""
    default_secondary_location: Optional[str] = rest_field(name="defaultSecondaryLocation", visibility=["read"])
    """The default secondary region for this database."""
    failover_group_id: Optional[str] = rest_field(name="failoverGroupId", visibility=["read"])
    """Failover Group resource identifier that this database belongs to."""
    restore_point_in_time: Optional[datetime.datetime] = rest_field(
        name="restorePointInTime", visibility=["create"], format="rfc3339"
    )
    """Specifies the point in time (ISO8601 format) of the source database that will be restored to
     create the new database."""
    source_database_deletion_date: Optional[datetime.datetime] = rest_field(
        name="sourceDatabaseDeletionDate", visibility=["create"], format="rfc3339"
    )
    """Specifies the time that the database was deleted."""
    recovery_services_recovery_point_id: Optional[str] = rest_field(
        name="recoveryServicesRecoveryPointId", visibility=["create"]
    )
    """The resource identifier of the recovery point associated with create operation of this
     database."""
    long_term_retention_backup_resource_id: Optional[str] = rest_field(
        name="longTermRetentionBackupResourceId", visibility=["create"]
    )
    """The resource identifier of the long term retention backup associated with create operation of
     this database."""
    recoverable_database_id: Optional[str] = rest_field(name="recoverableDatabaseId", visibility=["create"])
    """The resource identifier of the recoverable database associated with create operation of this
     database."""
    restorable_dropped_database_id: Optional[str] = rest_field(
        name="restorableDroppedDatabaseId", visibility=["create"]
    )
    """The resource identifier of the restorable dropped database associated with create operation of
     this database."""
    catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = rest_field(
        name="catalogCollation", visibility=["read", "create"]
    )
    """Collation of the metadata catalog. Known values are: \"DATABASE_DEFAULT\" and
     \"SQL_Latin1_General_CP1_CI_AS\"."""
    zone_redundant: Optional[bool] = rest_field(
        name="zoneRedundant", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not this database is zone redundant, which means the replicas of this database will
     be spread across multiple availability zones."""
    license_type: Optional[Union[str, "_models.DatabaseLicenseType"]] = rest_field(
        name="licenseType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The license type to apply for this database. ``LicenseIncluded`` if you need a license, or
     ``BasePrice`` if you have a license and are eligible for the Azure Hybrid Benefit. Known values
     are: \"LicenseIncluded\" and \"BasePrice\"."""
    max_log_size_bytes: Optional[int] = rest_field(name="maxLogSizeBytes", visibility=["read"])
    """The max log size for this database."""
    earliest_restore_date: Optional[datetime.datetime] = rest_field(
        name="earliestRestoreDate", visibility=["read"], format="rfc3339"
    )
    """This records the earliest start date and time that restore is available for this database
     (ISO8601 format)."""
    read_scale: Optional[Union[str, "_models.DatabaseReadScale"]] = rest_field(
        name="readScale", visibility=["read", "update"]
    )
    """The state of read-only routing. If enabled, connections that have application intent set to
     readonly in their connection string may be routed to a readonly secondary replica in the same
     region. Not applicable to a Hyperscale database within an elastic pool. Known values are:
     \"Enabled\" and \"Disabled\"."""
    high_availability_replica_count: Optional[int] = rest_field(
        name="highAvailabilityReplicaCount", visibility=["read", "create", "update", "delete", "query"]
    )
    """The number of secondary replicas associated with the Business Critical, Premium, or Hyperscale
     edition database that are used to provide high availability. Not applicable to a Hyperscale
     database within an elastic pool."""
    secondary_type: Optional[Union[str, "_models.SecondaryType"]] = rest_field(
        name="secondaryType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The secondary type of the database if it is a secondary.  Valid values are Geo, Named and
     Standby. Known values are: \"Geo\", \"Named\", and \"Standby\"."""
    current_sku: Optional["_models.Sku"] = rest_field(name="currentSku", visibility=["read"])
    """The name and tier of the SKU."""
    auto_pause_delay: Optional[int] = rest_field(
        name="autoPauseDelay", visibility=["read", "create", "update", "delete", "query"]
    )
    """Time in minutes after which database is automatically paused. A value of -1 means that
     automatic pause is disabled."""
    current_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="currentBackupStorageRedundancy", visibility=["read"]
    )
    """The storage account type used to store backups for this database. Known values are: \"Geo\",
     \"Local\", \"Zone\", and \"GeoZone\"."""
    requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="requestedBackupStorageRedundancy", visibility=["read", "create", "update", "delete", "query"]
    )
    """The storage account type to be used to store backups for this database. Known values are:
     \"Geo\", \"Local\", \"Zone\", and \"GeoZone\"."""
    min_capacity: Optional[float] = rest_field(
        name="minCapacity", visibility=["read", "create", "update", "delete", "query"]
    )
    """Minimal capacity that database will always have allocated, if not paused."""
    paused_date: Optional[datetime.datetime] = rest_field(name="pausedDate", visibility=["read"], format="rfc3339")
    """The date when database was paused by user configuration or action(ISO8601 format). Null if the
     database is ready."""
    resumed_date: Optional[datetime.datetime] = rest_field(name="resumedDate", visibility=["read"], format="rfc3339")
    """The date when database was resumed by user action or database login (ISO8601 format). Null if
     the database is paused."""
    maintenance_configuration_id: Optional[str] = rest_field(
        name="maintenanceConfigurationId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Maintenance configuration id assigned to the database. This configuration defines the period
     when the maintenance updates will occur."""
    is_ledger_on: Optional[bool] = rest_field(
        name="isLedgerOn", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not this database is a ledger database, which means all tables in the database are
     ledger tables. Note: the value of this property cannot be changed after the database has been
     created."""
    is_infra_encryption_enabled: Optional[bool] = rest_field(name="isInfraEncryptionEnabled", visibility=["read"])
    """Infra encryption is enabled for this database."""
    federated_client_id: Optional[str] = rest_field(
        name="federatedClientId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The Client id used for cross tenant per database CMK scenario."""
    keys_property: Optional[dict[str, "_models.DatabaseKey"]] = rest_field(
        name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys"
    )
    """The resource ids of the user assigned identities to use."""
    encryption_protector: Optional[str] = rest_field(
        name="encryptionProtector", visibility=["read", "create", "update", "delete", "query"]
    )
    """The azure key vault URI of the database if it's configured with per Database Customer Managed
     Keys."""
    preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = rest_field(
        name="preferredEnclaveType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of enclave requested on the database i.e. Default or VBS enclaves. Known values are:
     \"Default\" and \"VBS\"."""
    use_free_limit: Optional[bool] = rest_field(
        name="useFreeLimit", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not the database uses free monthly limits. Allowed on one database in a
     subscription."""
    free_limit_exhaustion_behavior: Optional[Union[str, "_models.FreeLimitExhaustionBehavior"]] = rest_field(
        name="freeLimitExhaustionBehavior", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the behavior when monthly free limits are exhausted for the free database.
     
     AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the
     month.
     
     BillForUsage: The database will continue to be online upon exhaustion of free limits and any
     overage will be billed. Known values are: \"AutoPause\" and \"BillOverUsage\"."""
    source_resource_id: Optional[str] = rest_field(name="sourceResourceId", visibility=["create"])
    """The resource identifier of the source associated with the create operation of this database.
     
     This property is only supported for DataWarehouse edition and allows to restore across
     subscriptions.
     
     When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId,
     restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode
     must be PointInTimeRestore, Restore or Recover.
     
     When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing
     database or existing sql pool, and restorePointInTime must be specified.
     
     When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped
     database or restorable dropped sql pool.
     
     When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or
     recoverable sql pool.
     
     When source subscription belongs to a different tenant than target subscription,
     “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant.
     For more details about “x-ms-authorization-auxiliary” header see
     `https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant
     <https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant>`_."""
    manual_cutover: Optional[bool] = rest_field(
        name="manualCutover", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not customer controlled manual cutover needs to be done during Update Database
     operation to Hyperscale tier.
     
     This property is only applicable when scaling database from Business Critical/General
     Purpose/Premium/Standard tier to Hyperscale tier.
     
     When manualCutover is specified, the scaling operation will wait for user input to trigger
     cutover to Hyperscale database.
     
     To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in
     Waiting state."""
    perform_cutover: Optional[bool] = rest_field(
        name="performCutover", visibility=["read", "create", "update", "delete", "query"]
    )
    """To trigger customer controlled manual cutover during the wait state while Scaling operation is
     in progress.
     
     This property parameter is only applicable for scaling operations that are initiated along with
     'manualCutover' parameter.
     
     This property is only applicable when scaling database from Business Critical/General
     Purpose/Premium/Standard tier to Hyperscale tier is already in progress.
     
     When performCutover is specified, the scaling operation will trigger cutover and perform
     role-change to Hyperscale database."""
    availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = rest_field(
        name="availabilityZone", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the availability zone the database is pinned to. Known values are: \"NoPreference\",
     \"1\", \"2\", and \"3\"."""
    encryption_protector_auto_rotation: Optional[bool] = rest_field(
        name="encryptionProtectorAutoRotation", visibility=["read", "create", "update", "delete", "query"]
    )
    """The flag to enable or disable auto rotation of database encryption protector AKV key."""

    @overload
    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        create_mode: Optional[Union[str, "_models.CreateMode"]] = None,
        collation: Optional[str] = None,
        max_size_bytes: Optional[int] = None,
        sample_name: Optional[Union[str, "_models.SampleName"]] = None,
        elastic_pool_id: Optional[str] = None,
        source_database_id: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        source_database_deletion_date: Optional[datetime.datetime] = None,
        recovery_services_recovery_point_id: Optional[str] = None,
        long_term_retention_backup_resource_id: Optional[str] = None,
        recoverable_database_id: Optional[str] = None,
        restorable_dropped_database_id: Optional[str] = None,
        catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = None,
        zone_redundant: Optional[bool] = None,
        license_type: Optional[Union[str, "_models.DatabaseLicenseType"]] = None,
        read_scale: Optional[Union[str, "_models.DatabaseReadScale"]] = None,
        high_availability_replica_count: Optional[int] = None,
        secondary_type: Optional[Union[str, "_models.SecondaryType"]] = None,
        auto_pause_delay: Optional[int] = None,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        min_capacity: Optional[float] = None,
        maintenance_configuration_id: Optional[str] = None,
        is_ledger_on: Optional[bool] = None,
        federated_client_id: Optional[str] = None,
        keys_property: Optional[dict[str, "_models.DatabaseKey"]] = None,
        encryption_protector: Optional[str] = None,
        preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = None,
        use_free_limit: Optional[bool] = None,
        free_limit_exhaustion_behavior: Optional[Union[str, "_models.FreeLimitExhaustionBehavior"]] = None,
        source_resource_id: Optional[str] = None,
        manual_cutover: Optional[bool] = None,
        perform_cutover: Optional[bool] = None,
        availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = None,
        encryption_protector_auto_rotation: Optional[bool] = 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 DatabaseSchema(ProxyResource):
    """A database schema 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.sql.models.SystemData
    """


class DatabaseSecurityAlertPolicy(ProxyResource):
    """A database security alert policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SecurityAlertsPolicyProperties
    """

    properties: Optional["_models.SecurityAlertsPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "state",
        "disabled_alerts",
        "email_addresses",
        "email_account_admins",
        "storage_endpoint",
        "storage_account_access_key",
        "retention_days",
        "creation_time",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SecurityAlertsPolicyProperties"] = 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 DatabaseSqlVulnerabilityAssessmentBaselineSet(ProxyResource):  # pylint: disable=name-too-long
    """A database sql vulnerability assessment baseline set.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties:
     ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentBaselineSetProperties
    """

    properties: Optional["_models.DatabaseSqlVulnerabilityAssessmentBaselineSetProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["results"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseSqlVulnerabilityAssessmentBaselineSetProperties"] = 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 DatabaseSqlVulnerabilityAssessmentBaselineSetProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a database Sql Vulnerability Assessment baseline set.

    :ivar results: The baseline set result. Required.
    :vartype results: dict[str, list[list[str]]]
    """

    results: dict[str, list[list[str]]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The baseline set result. Required."""

    @overload
    def __init__(
        self,
        *,
        results: dict[str, list[list[str]]],
    ) -> 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 DatabaseSqlVulnerabilityAssessmentRuleBaseline(ProxyResource):  # pylint: disable=name-too-long
    """A database sql vulnerability assessment rule baseline.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties:
     ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties
    """

    properties: Optional["_models.DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["results"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties"] = 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 DatabaseSqlVulnerabilityAssessmentRuleBaselineInput(ProxyResource):  # pylint: disable=name-too-long
    """A database sql vulnerability assessment rule baseline input.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties:
     ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties
    """

    properties: Optional["_models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["latest_scan", "results"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties"] = 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 DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a database Sql Vulnerability Assessment rule baseline.

    :ivar latest_scan: The latest scan flag. Required.
    :vartype latest_scan: bool
    :ivar results: The rule baseline result. Required.
    :vartype results: list[list[str]]
    """

    latest_scan: bool = rest_field(name="latestScan", visibility=["read", "create", "update", "delete", "query"])
    """The latest scan flag. Required."""
    results: list[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The rule baseline result. Required."""

    @overload
    def __init__(
        self,
        *,
        latest_scan: bool,
        results: list[list[str]],
    ) -> 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 DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput(ProxyResource):  # pylint: disable=name-too-long
    """A database sql vulnerability assessment rule baseline list input.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties:
     ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties
    """

    properties: Optional["_models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["latest_scan", "results"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties"] = 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 DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a database Sql Vulnerability Assessment rule baseline.

    :ivar latest_scan: The latest scan flag. Required.
    :vartype latest_scan: bool
    :ivar results: The rule baseline result list. Required.
    :vartype results: dict[str, list[list[str]]]
    """

    latest_scan: bool = rest_field(name="latestScan", visibility=["read", "create", "update", "delete", "query"])
    """The latest scan flag. Required."""
    results: dict[str, list[list[str]]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The rule baseline result list. Required."""

    @overload
    def __init__(
        self,
        *,
        latest_scan: bool,
        results: dict[str, list[list[str]]],
    ) -> 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 DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a database Sql Vulnerability Assessment rule baseline.

    :ivar results: The rule baseline result. Required.
    :vartype results: list[list[str]]
    """

    results: list[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The rule baseline result. Required."""

    @overload
    def __init__(
        self,
        *,
        results: list[list[str]],
    ) -> 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 DatabaseTable(ProxyResource):
    """A database table 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseTableProperties
    """

    properties: Optional["_models.DatabaseTableProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["temporal_type", "memory_optimized"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseTableProperties"] = 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 DatabaseTableProperties(_Model):
    """Database table properties.

    :ivar temporal_type: The table temporal type. Known values are: "NonTemporalTable",
     "HistoryTable", and "SystemVersionedTemporalTable".
    :vartype temporal_type: str or ~azure.mgmt.sql.models.TableTemporalType
    :ivar memory_optimized: Whether or not the table is memory optimized.
    :vartype memory_optimized: bool
    """

    temporal_type: Optional[Union[str, "_models.TableTemporalType"]] = rest_field(
        name="temporalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The table temporal type. Known values are: \"NonTemporalTable\", \"HistoryTable\", and
     \"SystemVersionedTemporalTable\"."""
    memory_optimized: Optional[bool] = rest_field(
        name="memoryOptimized", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not the table is memory optimized."""

    @overload
    def __init__(
        self,
        *,
        temporal_type: Optional[Union[str, "_models.TableTemporalType"]] = None,
        memory_optimized: Optional[bool] = 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 DatabaseUpdate(_Model):
    """A database update resource.

    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar identity: Database identity.
    :vartype identity: ~azure.mgmt.sql.models.DatabaseIdentity
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseUpdateProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name and tier of the SKU."""
    identity: Optional["_models.DatabaseIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Database identity."""
    properties: Optional["_models.DatabaseUpdateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = [
        "create_mode",
        "collation",
        "max_size_bytes",
        "sample_name",
        "elastic_pool_id",
        "source_database_id",
        "status",
        "database_id",
        "creation_date",
        "current_service_objective_name",
        "requested_service_objective_name",
        "default_secondary_location",
        "failover_group_id",
        "restore_point_in_time",
        "source_database_deletion_date",
        "recovery_services_recovery_point_id",
        "long_term_retention_backup_resource_id",
        "recoverable_database_id",
        "restorable_dropped_database_id",
        "catalog_collation",
        "zone_redundant",
        "license_type",
        "max_log_size_bytes",
        "earliest_restore_date",
        "read_scale",
        "high_availability_replica_count",
        "secondary_type",
        "current_sku",
        "auto_pause_delay",
        "current_backup_storage_redundancy",
        "requested_backup_storage_redundancy",
        "min_capacity",
        "paused_date",
        "resumed_date",
        "maintenance_configuration_id",
        "is_ledger_on",
        "is_infra_encryption_enabled",
        "federated_client_id",
        "keys_property",
        "encryption_protector",
        "preferred_enclave_type",
        "use_free_limit",
        "free_limit_exhaustion_behavior",
        "manual_cutover",
        "perform_cutover",
        "encryption_protector_auto_rotation",
    ]

    @overload
    def __init__(
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        identity: Optional["_models.DatabaseIdentity"] = None,
        properties: Optional["_models.DatabaseUpdateProperties"] = 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 DatabaseUpdateProperties(_Model):
    """A database update properties.

    :ivar create_mode: Specifies the mode of database creation.

     Default: regular database creation.

     Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified
     as the resource ID of the source database.

     Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId
     must be specified as the resource ID of the existing primary database.

     PointInTimeRestore: Creates a database by restoring a point in time backup of an existing
     database. sourceDatabaseId must be specified as the resource ID of the existing database, and
     restorePointInTime must be specified.

     Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be
     specified as the recoverable database resource ID to restore.

     Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must
     be specified. If sourceDatabaseId is the database's original resource ID, then
     sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable
     dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may
     also be specified to restore from an earlier point in time.

     RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention
     vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource
     ID.

     Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse
     edition. Known values are: "Default", "Copy", "Secondary", "PointInTimeRestore", "Restore",
     "Recovery", "RestoreExternalBackup", "RestoreExternalBackupSecondary",
     "RestoreLongTermRetentionBackup", and "OnlineSecondary".
    :vartype create_mode: str or ~azure.mgmt.sql.models.CreateMode
    :ivar collation: The collation of the database.
    :vartype collation: str
    :ivar max_size_bytes: The max size of the database expressed in bytes.
    :vartype max_size_bytes: int
    :ivar sample_name: The name of the sample schema to apply when creating this database. Known
     values are: "AdventureWorksLT", "WideWorldImportersStd", and "WideWorldImportersFull".
    :vartype sample_name: str or ~azure.mgmt.sql.models.SampleName
    :ivar elastic_pool_id: The resource identifier of the elastic pool containing this database.
    :vartype elastic_pool_id: str
    :ivar source_database_id: The resource identifier of the source database associated with create
     operation of this database.
    :vartype source_database_id: str
    :ivar status: The status of the database. Known values are: "Online", "Restoring",
     "RecoveryPending", "Recovering", "Suspect", "Offline", "Standby", "Shutdown", "EmergencyMode",
     "AutoClosed", "Copying", "Creating", "Inaccessible", "OfflineSecondary", "Pausing", "Paused",
     "Resuming", "Scaling", "OfflineChangingDwPerformanceTiers", "OnlineChangingDwPerformanceTiers",
     "Disabled", "Stopping", "Stopped", and "Starting".
    :vartype status: str or ~azure.mgmt.sql.models.DatabaseStatus
    :ivar database_id: The ID of the database.
    :vartype database_id: str
    :ivar creation_date: The creation date of the database (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar current_service_objective_name: The current service level objective name of the database.
    :vartype current_service_objective_name: str
    :ivar requested_service_objective_name: The requested service level objective name of the
     database.
    :vartype requested_service_objective_name: str
    :ivar default_secondary_location: The default secondary region for this database.
    :vartype default_secondary_location: str
    :ivar failover_group_id: Failover Group resource identifier that this database belongs to.
    :vartype failover_group_id: str
    :ivar restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
     database that will be restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar source_database_deletion_date: Specifies the time that the database was deleted.
    :vartype source_database_deletion_date: ~datetime.datetime
    :ivar recovery_services_recovery_point_id: The resource identifier of the recovery point
     associated with create operation of this database.
    :vartype recovery_services_recovery_point_id: str
    :ivar long_term_retention_backup_resource_id: The resource identifier of the long term
     retention backup associated with create operation of this database.
    :vartype long_term_retention_backup_resource_id: str
    :ivar recoverable_database_id: The resource identifier of the recoverable database associated
     with create operation of this database.
    :vartype recoverable_database_id: str
    :ivar restorable_dropped_database_id: The resource identifier of the restorable dropped
     database associated with create operation of this database.
    :vartype restorable_dropped_database_id: str
    :ivar catalog_collation: Collation of the metadata catalog. Known values are:
     "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
    :vartype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
    :ivar zone_redundant: Whether or not this database is zone redundant, which means the replicas
     of this database will be spread across multiple availability zones.
    :vartype zone_redundant: bool
    :ivar license_type: The license type to apply for this database. ``LicenseIncluded`` if you
     need a license, or ``BasePrice`` if you have a license and are eligible for the Azure Hybrid
     Benefit. Known values are: "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType
    :ivar max_log_size_bytes: The max log size for this database.
    :vartype max_log_size_bytes: int
    :ivar earliest_restore_date: This records the earliest start date and time that restore is
     available for this database (ISO8601 format).
    :vartype earliest_restore_date: ~datetime.datetime
    :ivar read_scale: The state of read-only routing. If enabled, connections that have application
     intent set to readonly in their connection string may be routed to a readonly secondary replica
     in the same region. Not applicable to a Hyperscale database within an elastic pool. Known
     values are: "Enabled" and "Disabled".
    :vartype read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale
    :ivar high_availability_replica_count: The number of secondary replicas associated with the
     Business Critical, Premium, or Hyperscale edition database that are used to provide high
     availability. Not applicable to a Hyperscale database within an elastic pool.
    :vartype high_availability_replica_count: int
    :ivar secondary_type: The secondary type of the database if it is a secondary.  Valid values
     are Geo, Named and Standby. Known values are: "Geo", "Named", and "Standby".
    :vartype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType
    :ivar current_sku: The name and tier of the SKU.
    :vartype current_sku: ~azure.mgmt.sql.models.Sku
    :ivar auto_pause_delay: Time in minutes after which database is automatically paused. A value
     of -1 means that automatic pause is disabled.
    :vartype auto_pause_delay: int
    :ivar current_backup_storage_redundancy: The storage account type used to store backups for
     this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype current_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage account type to be used to store backups
     for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar min_capacity: Minimal capacity that database will always have allocated, if not paused.
    :vartype min_capacity: float
    :ivar paused_date: The date when database was paused by user configuration or action(ISO8601
     format). Null if the database is ready.
    :vartype paused_date: ~datetime.datetime
    :ivar resumed_date: The date when database was resumed by user action or database login
     (ISO8601 format). Null if the database is paused.
    :vartype resumed_date: ~datetime.datetime
    :ivar maintenance_configuration_id: Maintenance configuration id assigned to the database. This
     configuration defines the period when the maintenance updates will occur.
    :vartype maintenance_configuration_id: str
    :ivar is_ledger_on: Whether or not this database is a ledger database, which means all tables
     in the database are ledger tables. Note: the value of this property cannot be changed after the
     database has been created.
    :vartype is_ledger_on: bool
    :ivar is_infra_encryption_enabled: Infra encryption is enabled for this database.
    :vartype is_infra_encryption_enabled: bool
    :ivar federated_client_id: The Client id used for cross tenant per database CMK scenario.
    :vartype federated_client_id: str
    :ivar keys_property: The resource ids of the user assigned identities to use.
    :vartype keys_property: dict[str, ~azure.mgmt.sql.models.DatabaseKey]
    :ivar encryption_protector: The azure key vault URI of the database if it's configured with per
     Database Customer Managed Keys.
    :vartype encryption_protector: str
    :ivar preferred_enclave_type: Type of enclave requested on the database i.e. Default or VBS
     enclaves. Known values are: "Default" and "VBS".
    :vartype preferred_enclave_type: str or ~azure.mgmt.sql.models.AlwaysEncryptedEnclaveType
    :ivar use_free_limit: Whether or not the database uses free monthly limits. Allowed on one
     database in a subscription.
    :vartype use_free_limit: bool
    :ivar free_limit_exhaustion_behavior: Specifies the behavior when monthly free limits are
     exhausted for the free database.

     AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the
     month.

     BillForUsage: The database will continue to be online upon exhaustion of free limits and any
     overage will be billed. Known values are: "AutoPause" and "BillOverUsage".
    :vartype free_limit_exhaustion_behavior: str or
     ~azure.mgmt.sql.models.FreeLimitExhaustionBehavior
    :ivar manual_cutover: Whether or not customer controlled manual cutover needs to be done during
     Update Database operation to Hyperscale tier.

     This property is only applicable when scaling database from Business Critical/General
     Purpose/Premium/Standard tier to Hyperscale tier.

     When manualCutover is specified, the scaling operation will wait for user input to trigger
     cutover to Hyperscale database.

     To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in
     Waiting state.
    :vartype manual_cutover: bool
    :ivar perform_cutover: To trigger customer controlled manual cutover during the wait state
     while Scaling operation is in progress.

     This property parameter is only applicable for scaling operations that are initiated along with
     'manualCutover' parameter.

     This property is only applicable when scaling database from Business Critical/General
     Purpose/Premium/Standard tier to Hyperscale tier is already in progress.

     When performCutover is specified, the scaling operation will trigger cutover and perform
     role-change to Hyperscale database.
    :vartype perform_cutover: bool
    :ivar encryption_protector_auto_rotation: The flag to enable or disable auto rotation of
     database encryption protector AKV key.
    :vartype encryption_protector_auto_rotation: bool
    """

    create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field(name="createMode", visibility=["create"])
    """Specifies the mode of database creation.
     
     Default: regular database creation.
     
     Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified
     as the resource ID of the source database.
     
     Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId
     must be specified as the resource ID of the existing primary database.
     
     PointInTimeRestore: Creates a database by restoring a point in time backup of an existing
     database. sourceDatabaseId must be specified as the resource ID of the existing database, and
     restorePointInTime must be specified.
     
     Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be
     specified as the recoverable database resource ID to restore.
     
     Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must
     be specified. If sourceDatabaseId is the database's original resource ID, then
     sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable
     dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may
     also be specified to restore from an earlier point in time.
     
     RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention
     vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource
     ID.
     
     Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse
     edition. Known values are: \"Default\", \"Copy\", \"Secondary\", \"PointInTimeRestore\",
     \"Restore\", \"Recovery\", \"RestoreExternalBackup\", \"RestoreExternalBackupSecondary\",
     \"RestoreLongTermRetentionBackup\", and \"OnlineSecondary\"."""
    collation: Optional[str] = rest_field(visibility=["read", "create"])
    """The collation of the database."""
    max_size_bytes: Optional[int] = rest_field(
        name="maxSizeBytes", visibility=["read", "create", "update", "delete", "query"]
    )
    """The max size of the database expressed in bytes."""
    sample_name: Optional[Union[str, "_models.SampleName"]] = rest_field(name="sampleName", visibility=["create"])
    """The name of the sample schema to apply when creating this database. Known values are:
     \"AdventureWorksLT\", \"WideWorldImportersStd\", and \"WideWorldImportersFull\"."""
    elastic_pool_id: Optional[str] = rest_field(
        name="elasticPoolId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource identifier of the elastic pool containing this database."""
    source_database_id: Optional[str] = rest_field(name="sourceDatabaseId", visibility=["create"])
    """The resource identifier of the source database associated with create operation of this
     database."""
    status: Optional[Union[str, "_models.DatabaseStatus"]] = rest_field(visibility=["read"])
    """The status of the database. Known values are: \"Online\", \"Restoring\", \"RecoveryPending\",
     \"Recovering\", \"Suspect\", \"Offline\", \"Standby\", \"Shutdown\", \"EmergencyMode\",
     \"AutoClosed\", \"Copying\", \"Creating\", \"Inaccessible\", \"OfflineSecondary\", \"Pausing\",
     \"Paused\", \"Resuming\", \"Scaling\", \"OfflineChangingDwPerformanceTiers\",
     \"OnlineChangingDwPerformanceTiers\", \"Disabled\", \"Stopping\", \"Stopped\", and
     \"Starting\"."""
    database_id: Optional[str] = rest_field(name="databaseId", visibility=["read"])
    """The ID of the database."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """The creation date of the database (ISO8601 format)."""
    current_service_objective_name: Optional[str] = rest_field(name="currentServiceObjectiveName", visibility=["read"])
    """The current service level objective name of the database."""
    requested_service_objective_name: Optional[str] = rest_field(
        name="requestedServiceObjectiveName", visibility=["read"]
    )
    """The requested service level objective name of the database."""
    default_secondary_location: Optional[str] = rest_field(name="defaultSecondaryLocation", visibility=["read"])
    """The default secondary region for this database."""
    failover_group_id: Optional[str] = rest_field(name="failoverGroupId", visibility=["read"])
    """Failover Group resource identifier that this database belongs to."""
    restore_point_in_time: Optional[datetime.datetime] = rest_field(
        name="restorePointInTime", visibility=["create"], format="rfc3339"
    )
    """Specifies the point in time (ISO8601 format) of the source database that will be restored to
     create the new database."""
    source_database_deletion_date: Optional[datetime.datetime] = rest_field(
        name="sourceDatabaseDeletionDate", visibility=["create"], format="rfc3339"
    )
    """Specifies the time that the database was deleted."""
    recovery_services_recovery_point_id: Optional[str] = rest_field(
        name="recoveryServicesRecoveryPointId", visibility=["create"]
    )
    """The resource identifier of the recovery point associated with create operation of this
     database."""
    long_term_retention_backup_resource_id: Optional[str] = rest_field(
        name="longTermRetentionBackupResourceId", visibility=["create"]
    )
    """The resource identifier of the long term retention backup associated with create operation of
     this database."""
    recoverable_database_id: Optional[str] = rest_field(name="recoverableDatabaseId", visibility=["create"])
    """The resource identifier of the recoverable database associated with create operation of this
     database."""
    restorable_dropped_database_id: Optional[str] = rest_field(
        name="restorableDroppedDatabaseId", visibility=["create"]
    )
    """The resource identifier of the restorable dropped database associated with create operation of
     this database."""
    catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = rest_field(
        name="catalogCollation", visibility=["read", "create"]
    )
    """Collation of the metadata catalog. Known values are: \"DATABASE_DEFAULT\" and
     \"SQL_Latin1_General_CP1_CI_AS\"."""
    zone_redundant: Optional[bool] = rest_field(
        name="zoneRedundant", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not this database is zone redundant, which means the replicas of this database will
     be spread across multiple availability zones."""
    license_type: Optional[Union[str, "_models.DatabaseLicenseType"]] = rest_field(
        name="licenseType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The license type to apply for this database. ``LicenseIncluded`` if you need a license, or
     ``BasePrice`` if you have a license and are eligible for the Azure Hybrid Benefit. Known values
     are: \"LicenseIncluded\" and \"BasePrice\"."""
    max_log_size_bytes: Optional[int] = rest_field(name="maxLogSizeBytes", visibility=["read"])
    """The max log size for this database."""
    earliest_restore_date: Optional[datetime.datetime] = rest_field(
        name="earliestRestoreDate", visibility=["read"], format="rfc3339"
    )
    """This records the earliest start date and time that restore is available for this database
     (ISO8601 format)."""
    read_scale: Optional[Union[str, "_models.DatabaseReadScale"]] = rest_field(
        name="readScale", visibility=["read", "update"]
    )
    """The state of read-only routing. If enabled, connections that have application intent set to
     readonly in their connection string may be routed to a readonly secondary replica in the same
     region. Not applicable to a Hyperscale database within an elastic pool. Known values are:
     \"Enabled\" and \"Disabled\"."""
    high_availability_replica_count: Optional[int] = rest_field(
        name="highAvailabilityReplicaCount", visibility=["read", "create", "update", "delete", "query"]
    )
    """The number of secondary replicas associated with the Business Critical, Premium, or Hyperscale
     edition database that are used to provide high availability. Not applicable to a Hyperscale
     database within an elastic pool."""
    secondary_type: Optional[Union[str, "_models.SecondaryType"]] = rest_field(
        name="secondaryType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The secondary type of the database if it is a secondary.  Valid values are Geo, Named and
     Standby. Known values are: \"Geo\", \"Named\", and \"Standby\"."""
    current_sku: Optional["_models.Sku"] = rest_field(name="currentSku", visibility=["read"])
    """The name and tier of the SKU."""
    auto_pause_delay: Optional[int] = rest_field(
        name="autoPauseDelay", visibility=["read", "create", "update", "delete", "query"]
    )
    """Time in minutes after which database is automatically paused. A value of -1 means that
     automatic pause is disabled."""
    current_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="currentBackupStorageRedundancy", visibility=["read"]
    )
    """The storage account type used to store backups for this database. Known values are: \"Geo\",
     \"Local\", \"Zone\", and \"GeoZone\"."""
    requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="requestedBackupStorageRedundancy", visibility=["read", "create", "update", "delete", "query"]
    )
    """The storage account type to be used to store backups for this database. Known values are:
     \"Geo\", \"Local\", \"Zone\", and \"GeoZone\"."""
    min_capacity: Optional[float] = rest_field(
        name="minCapacity", visibility=["read", "create", "update", "delete", "query"]
    )
    """Minimal capacity that database will always have allocated, if not paused."""
    paused_date: Optional[datetime.datetime] = rest_field(name="pausedDate", visibility=["read"], format="rfc3339")
    """The date when database was paused by user configuration or action(ISO8601 format). Null if the
     database is ready."""
    resumed_date: Optional[datetime.datetime] = rest_field(name="resumedDate", visibility=["read"], format="rfc3339")
    """The date when database was resumed by user action or database login (ISO8601 format). Null if
     the database is paused."""
    maintenance_configuration_id: Optional[str] = rest_field(
        name="maintenanceConfigurationId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Maintenance configuration id assigned to the database. This configuration defines the period
     when the maintenance updates will occur."""
    is_ledger_on: Optional[bool] = rest_field(
        name="isLedgerOn", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not this database is a ledger database, which means all tables in the database are
     ledger tables. Note: the value of this property cannot be changed after the database has been
     created."""
    is_infra_encryption_enabled: Optional[bool] = rest_field(name="isInfraEncryptionEnabled", visibility=["read"])
    """Infra encryption is enabled for this database."""
    federated_client_id: Optional[str] = rest_field(
        name="federatedClientId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The Client id used for cross tenant per database CMK scenario."""
    keys_property: Optional[dict[str, "_models.DatabaseKey"]] = rest_field(
        name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys"
    )
    """The resource ids of the user assigned identities to use."""
    encryption_protector: Optional[str] = rest_field(
        name="encryptionProtector", visibility=["read", "create", "update", "delete", "query"]
    )
    """The azure key vault URI of the database if it's configured with per Database Customer Managed
     Keys."""
    preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = rest_field(
        name="preferredEnclaveType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of enclave requested on the database i.e. Default or VBS enclaves. Known values are:
     \"Default\" and \"VBS\"."""
    use_free_limit: Optional[bool] = rest_field(
        name="useFreeLimit", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not the database uses free monthly limits. Allowed on one database in a
     subscription."""
    free_limit_exhaustion_behavior: Optional[Union[str, "_models.FreeLimitExhaustionBehavior"]] = rest_field(
        name="freeLimitExhaustionBehavior", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the behavior when monthly free limits are exhausted for the free database.
     
     AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the
     month.
     
     BillForUsage: The database will continue to be online upon exhaustion of free limits and any
     overage will be billed. Known values are: \"AutoPause\" and \"BillOverUsage\"."""
    manual_cutover: Optional[bool] = rest_field(
        name="manualCutover", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not customer controlled manual cutover needs to be done during Update Database
     operation to Hyperscale tier.
     
     This property is only applicable when scaling database from Business Critical/General
     Purpose/Premium/Standard tier to Hyperscale tier.
     
     When manualCutover is specified, the scaling operation will wait for user input to trigger
     cutover to Hyperscale database.
     
     To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in
     Waiting state."""
    perform_cutover: Optional[bool] = rest_field(
        name="performCutover", visibility=["read", "create", "update", "delete", "query"]
    )
    """To trigger customer controlled manual cutover during the wait state while Scaling operation is
     in progress.
     
     This property parameter is only applicable for scaling operations that are initiated along with
     'manualCutover' parameter.
     
     This property is only applicable when scaling database from Business Critical/General
     Purpose/Premium/Standard tier to Hyperscale tier is already in progress.
     
     When performCutover is specified, the scaling operation will trigger cutover and perform
     role-change to Hyperscale database."""
    encryption_protector_auto_rotation: Optional[bool] = rest_field(
        name="encryptionProtectorAutoRotation", visibility=["read", "create", "update", "delete", "query"]
    )
    """The flag to enable or disable auto rotation of database encryption protector AKV key."""

    @overload
    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        create_mode: Optional[Union[str, "_models.CreateMode"]] = None,
        collation: Optional[str] = None,
        max_size_bytes: Optional[int] = None,
        sample_name: Optional[Union[str, "_models.SampleName"]] = None,
        elastic_pool_id: Optional[str] = None,
        source_database_id: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        source_database_deletion_date: Optional[datetime.datetime] = None,
        recovery_services_recovery_point_id: Optional[str] = None,
        long_term_retention_backup_resource_id: Optional[str] = None,
        recoverable_database_id: Optional[str] = None,
        restorable_dropped_database_id: Optional[str] = None,
        catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = None,
        zone_redundant: Optional[bool] = None,
        license_type: Optional[Union[str, "_models.DatabaseLicenseType"]] = None,
        read_scale: Optional[Union[str, "_models.DatabaseReadScale"]] = None,
        high_availability_replica_count: Optional[int] = None,
        secondary_type: Optional[Union[str, "_models.SecondaryType"]] = None,
        auto_pause_delay: Optional[int] = None,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        min_capacity: Optional[float] = None,
        maintenance_configuration_id: Optional[str] = None,
        is_ledger_on: Optional[bool] = None,
        federated_client_id: Optional[str] = None,
        keys_property: Optional[dict[str, "_models.DatabaseKey"]] = None,
        encryption_protector: Optional[str] = None,
        preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = None,
        use_free_limit: Optional[bool] = None,
        free_limit_exhaustion_behavior: Optional[Union[str, "_models.FreeLimitExhaustionBehavior"]] = None,
        manual_cutover: Optional[bool] = None,
        perform_cutover: Optional[bool] = None,
        encryption_protector_auto_rotation: Optional[bool] = 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 DatabaseUsage(ProxyResource):
    """Usage metric of a database.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseUsageProperties
    """

    properties: Optional["_models.DatabaseUsageProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["display_name", "current_value", "limit", "unit"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseUsageProperties"] = 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 DatabaseUsageProperties(_Model):
    """Properties of a database usage.

    :ivar display_name: User-readable name of the metric.
    :vartype display_name: str
    :ivar current_value: Current value of the metric.
    :vartype current_value: float
    :ivar limit: Boundary value of the metric.
    :vartype limit: float
    :ivar unit: Unit of the metric.
    :vartype unit: str
    """

    display_name: Optional[str] = rest_field(name="displayName", visibility=["read"])
    """User-readable name of the metric."""
    current_value: Optional[float] = rest_field(name="currentValue", visibility=["read"])
    """Current value of the metric."""
    limit: Optional[float] = rest_field(visibility=["read"])
    """Boundary value of the metric."""
    unit: Optional[str] = rest_field(visibility=["read"])
    """Unit of the metric."""


class DatabaseUserIdentity(_Model):
    """Azure Active Directory identity configuration for a resource.

    :ivar principal_id: The Azure Active Directory principal id.
    :vartype principal_id: str
    :ivar client_id: The Azure Active Directory client id.
    :vartype client_id: str
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The Azure Active Directory principal id."""
    client_id: Optional[str] = rest_field(name="clientId", visibility=["read"])
    """The Azure Active Directory client id."""


class DatabaseVulnerabilityAssessment(ProxyResource):
    """A database vulnerability assessment.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentProperties
    """

    properties: Optional["_models.DatabaseVulnerabilityAssessmentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "storage_container_path",
        "storage_container_sas_key",
        "storage_account_access_key",
        "recurring_scans",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseVulnerabilityAssessmentProperties"] = 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 DatabaseVulnerabilityAssessmentProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a database Vulnerability Assessment.

    :ivar storage_container_path: A blob storage container path to hold the scan results (e.g.
     `https://myStorage.blob.core.windows.net/VaScans/
     <https://myStorage.blob.core.windows.net/VaScans/>`_).  It is required if server level
     vulnerability assessment policy doesn't set.
    :vartype storage_container_path: str
    :ivar storage_container_sas_key: A shared access signature (SAS Key) that has write access to
     the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey'
     isn't specified, StorageContainerSasKey is required. Applies only if the storage account is not
     behind a Vnet or a firewall.
    :vartype storage_container_sas_key: str
    :ivar storage_account_access_key: Specifies the identifier key of the storage account for
     vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
     storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet
     or a firewall.
    :vartype storage_account_access_key: str
    :ivar recurring_scans: The recurring scans settings.
    :vartype recurring_scans:
     ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
    """

    storage_container_path: Optional[str] = rest_field(name="storageContainerPath", visibility=["create", "update"])
    """A blob storage container path to hold the scan results (e.g.
     `https://myStorage.blob.core.windows.net/VaScans/
     <https://myStorage.blob.core.windows.net/VaScans/>`_).  It is required if server level
     vulnerability assessment policy doesn't set."""
    storage_container_sas_key: Optional[str] = rest_field(
        name="storageContainerSasKey", visibility=["create", "update"]
    )
    """A shared access signature (SAS Key) that has write access to the blob container specified in
     'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified,
     StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or
     a firewall."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["create", "update"]
    )
    """Specifies the identifier key of the storage account for vulnerability assessment scan results.
     If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. Applies only
     if the storage account is not behind a Vnet or a firewall."""
    recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = rest_field(
        name="recurringScans", visibility=["read", "create", "update", "delete", "query"]
    )
    """The recurring scans settings."""

    @overload
    def __init__(
        self,
        *,
        storage_container_path: Optional[str] = None,
        storage_container_sas_key: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = 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 DatabaseVulnerabilityAssessmentRuleBaseline(ProxyResource):  # pylint: disable=name-too-long
    """A database vulnerability assessment rule baseline.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties:
     ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineProperties
    """

    properties: Optional["_models.DatabaseVulnerabilityAssessmentRuleBaselineProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["baseline_results"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseVulnerabilityAssessmentRuleBaselineProperties"] = 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 DatabaseVulnerabilityAssessmentRuleBaselineItem(_Model):  # pylint: disable=name-too-long
    """Properties for an Azure SQL Database Vulnerability Assessment rule baseline's result.

    :ivar result: The rule baseline result. Required.
    :vartype result: list[str]
    """

    result: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The rule baseline result. Required."""

    @overload
    def __init__(
        self,
        *,
        result: list[str],
    ) -> 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 DatabaseVulnerabilityAssessmentRuleBaselineProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a database Vulnerability Assessment rule baseline.

    :ivar baseline_results: The rule baseline result. Required.
    :vartype baseline_results:
     list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem]
    """

    baseline_results: list["_models.DatabaseVulnerabilityAssessmentRuleBaselineItem"] = rest_field(
        name="baselineResults", visibility=["read", "create", "update", "delete", "query"]
    )
    """The rule baseline result. Required."""

    @overload
    def __init__(
        self,
        *,
        baseline_results: list["_models.DatabaseVulnerabilityAssessmentRuleBaselineItem"],
    ) -> 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 DatabaseVulnerabilityAssessmentScanExportProperties(_Model):  # pylint: disable=name-too-long
    """Properties of the export operation's result.

    :ivar exported_report_location: Location of the exported report (e.g.
     `https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx
     <https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx>`_).
    :vartype exported_report_location: str
    """

    exported_report_location: Optional[str] = rest_field(name="exportedReportLocation", visibility=["read"])
    """Location of the exported report (e.g.
     `https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx
     <https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx>`_)."""


class DatabaseVulnerabilityAssessmentScansExport(ProxyResource):  # pylint: disable=name-too-long
    """A database Vulnerability Assessment scan export 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentScanExportProperties
    """

    properties: Optional["_models.DatabaseVulnerabilityAssessmentScanExportProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["exported_report_location"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DatabaseVulnerabilityAssessmentScanExportProperties"] = 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 DataMaskingPolicy(ProxyResource):
    """A database data masking policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DataMaskingPolicyProperties
    :ivar location: The location of the data masking policy.
    :vartype location: str
    :ivar kind: The kind of Data Masking Policy. Metadata, used for Azure portal.
    :vartype kind: str
    """

    properties: Optional["_models.DataMaskingPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    location: Optional[str] = rest_field(visibility=["read"])
    """The location of the data masking policy."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """The kind of Data Masking Policy. Metadata, used for Azure portal."""

    __flattened_items = ["data_masking_state", "exempt_principals", "application_principals", "masking_level"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DataMaskingPolicyProperties"] = 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 DataMaskingPolicyProperties(_Model):
    """The properties of a database data masking policy.

    :ivar data_masking_state: The state of the data masking policy. Required. Known values are:
     "Enabled" and "Disabled".
    :vartype data_masking_state: str or ~azure.mgmt.sql.models.DataMaskingState
    :ivar exempt_principals: The list of the exempt principals. Specifies the semicolon-separated
     list of database users for which the data masking policy does not apply. The specified users
     receive data results without masking for all of the database queries.
    :vartype exempt_principals: str
    :ivar application_principals: The list of the application principals. This is a legacy
     parameter and is no longer used.
    :vartype application_principals: str
    :ivar masking_level: The masking level. This is a legacy parameter and is no longer used.
    :vartype masking_level: str
    """

    data_masking_state: Union[str, "_models.DataMaskingState"] = rest_field(
        name="dataMaskingState", visibility=["read", "create", "update", "delete", "query"]
    )
    """The state of the data masking policy. Required. Known values are: \"Enabled\" and \"Disabled\"."""
    exempt_principals: Optional[str] = rest_field(
        name="exemptPrincipals", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of the exempt principals. Specifies the semicolon-separated list of database users for
     which the data masking policy does not apply. The specified users receive data results without
     masking for all of the database queries."""
    application_principals: Optional[str] = rest_field(name="applicationPrincipals", visibility=["read"])
    """The list of the application principals. This is a legacy parameter and is no longer used."""
    masking_level: Optional[str] = rest_field(name="maskingLevel", visibility=["read"])
    """The masking level. This is a legacy parameter and is no longer used."""

    @overload
    def __init__(
        self,
        *,
        data_masking_state: Union[str, "_models.DataMaskingState"],
        exempt_principals: 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 DataMaskingRule(ProxyResource):
    """A database data masking rule.

    :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.sql.models.SystemData
    :ivar location: The location of the data masking rule.
    :vartype location: str
    :ivar kind: The kind of Data Masking Rule. Metadata, used for Azure portal.
    :vartype kind: str
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DataMaskingRuleProperties
    """

    location: Optional[str] = rest_field(visibility=["read"])
    """The location of the data masking rule."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """The kind of Data Masking Rule. Metadata, used for Azure portal."""
    properties: Optional["_models.DataMaskingRuleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "id",
        "rule_state",
        "schema_name",
        "table_name",
        "column_name",
        "alias_name",
        "masking_function",
        "number_from",
        "number_to",
        "prefix_size",
        "suffix_size",
        "replacement_string",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DataMaskingRuleProperties"] = 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 DataMaskingRuleProperties(_Model):
    """The properties of a database data masking rule.

    :ivar id: The rule Id.
    :vartype id: str
    :ivar rule_state: The rule state. Used to delete a rule. To delete an existing rule, specify
     the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled.
     However, if the rule doesn't already exist, the rule will be created with ruleState set to
     enabled, regardless of the provided value of ruleState. Known values are: "Enabled" and
     "Disabled".
    :vartype rule_state: str or ~azure.mgmt.sql.models.DataMaskingRuleState
    :ivar schema_name: The schema name on which the data masking rule is applied. Required.
    :vartype schema_name: str
    :ivar table_name: The table name on which the data masking rule is applied. Required.
    :vartype table_name: str
    :ivar column_name: The column name on which the data masking rule is applied. Required.
    :vartype column_name: str
    :ivar alias_name: The alias name. This is a legacy parameter and is no longer used.
    :vartype alias_name: str
    :ivar masking_function: The masking function that is used for the data masking rule. Required.
     Known values are: "Default", "CCN", "Email", "Number", "SSN", and "Text".
    :vartype masking_function: str or ~azure.mgmt.sql.models.DataMaskingFunction
    :ivar number_from: The numberFrom property of the masking rule. Required if maskingFunction is
     set to Number, otherwise this parameter will be ignored.
    :vartype number_from: str
    :ivar number_to: The numberTo property of the data masking rule. Required if maskingFunction is
     set to Number, otherwise this parameter will be ignored.
    :vartype number_to: str
    :ivar prefix_size: If maskingFunction is set to Text, the number of characters to show unmasked
     in the beginning of the string. Otherwise, this parameter will be ignored.
    :vartype prefix_size: str
    :ivar suffix_size: If maskingFunction is set to Text, the number of characters to show unmasked
     at the end of the string. Otherwise, this parameter will be ignored.
    :vartype suffix_size: str
    :ivar replacement_string: If maskingFunction is set to Text, the character to use for masking
     the unexposed part of the string. Otherwise, this parameter will be ignored.
    :vartype replacement_string: str
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """The rule Id."""
    rule_state: Optional[Union[str, "_models.DataMaskingRuleState"]] = rest_field(
        name="ruleState", visibility=["read", "create", "update", "delete", "query"]
    )
    """The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName,
     tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule
     doesn't already exist, the rule will be created with ruleState set to enabled, regardless of
     the provided value of ruleState. Known values are: \"Enabled\" and \"Disabled\"."""
    schema_name: str = rest_field(name="schemaName", visibility=["read", "create", "update", "delete", "query"])
    """The schema name on which the data masking rule is applied. Required."""
    table_name: str = rest_field(name="tableName", visibility=["read", "create", "update", "delete", "query"])
    """The table name on which the data masking rule is applied. Required."""
    column_name: str = rest_field(name="columnName", visibility=["read", "create", "update", "delete", "query"])
    """The column name on which the data masking rule is applied. Required."""
    alias_name: Optional[str] = rest_field(name="aliasName", visibility=["read", "create", "update", "delete", "query"])
    """The alias name. This is a legacy parameter and is no longer used."""
    masking_function: Union[str, "_models.DataMaskingFunction"] = rest_field(
        name="maskingFunction", visibility=["read", "create", "update", "delete", "query"]
    )
    """The masking function that is used for the data masking rule. Required. Known values are:
     \"Default\", \"CCN\", \"Email\", \"Number\", \"SSN\", and \"Text\"."""
    number_from: Optional[str] = rest_field(
        name="numberFrom", visibility=["read", "create", "update", "delete", "query"]
    )
    """The numberFrom property of the masking rule. Required if maskingFunction is set to Number,
     otherwise this parameter will be ignored."""
    number_to: Optional[str] = rest_field(name="numberTo", visibility=["read", "create", "update", "delete", "query"])
    """The numberTo property of the data masking rule. Required if maskingFunction is set to Number,
     otherwise this parameter will be ignored."""
    prefix_size: Optional[str] = rest_field(
        name="prefixSize", visibility=["read", "create", "update", "delete", "query"]
    )
    """If maskingFunction is set to Text, the number of characters to show unmasked in the beginning
     of the string. Otherwise, this parameter will be ignored."""
    suffix_size: Optional[str] = rest_field(
        name="suffixSize", visibility=["read", "create", "update", "delete", "query"]
    )
    """If maskingFunction is set to Text, the number of characters to show unmasked at the end of the
     string. Otherwise, this parameter will be ignored."""
    replacement_string: Optional[str] = rest_field(
        name="replacementString", visibility=["read", "create", "update", "delete", "query"]
    )
    """If maskingFunction is set to Text, the character to use for masking the unexposed part of the
     string. Otherwise, this parameter will be ignored."""

    @overload
    def __init__(
        self,
        *,
        schema_name: str,
        table_name: str,
        column_name: str,
        masking_function: Union[str, "_models.DataMaskingFunction"],
        rule_state: Optional[Union[str, "_models.DataMaskingRuleState"]] = None,
        alias_name: Optional[str] = None,
        number_from: Optional[str] = None,
        number_to: Optional[str] = None,
        prefix_size: Optional[str] = None,
        suffix_size: Optional[str] = None,
        replacement_string: 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 DataWarehouseUserActivities(ProxyResource):
    """User activities of a data warehouse.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DataWarehouseUserActivitiesProperties
    """

    properties: Optional["_models.DataWarehouseUserActivitiesProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["active_queries_count"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DataWarehouseUserActivitiesProperties"] = 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 DataWarehouseUserActivitiesProperties(_Model):
    """User activities of a data warehouse. This currently includes the count of running or suspended
    queries. For more information, please view the sys.dm_pdw_exec_requests dynamic management view
    (DMV).

    :ivar active_queries_count: Count of running and suspended queries.
    :vartype active_queries_count: int
    """

    active_queries_count: Optional[int] = rest_field(name="activeQueriesCount", visibility=["read"])
    """Count of running and suspended queries."""


class DeletedServer(ProxyResource):
    """A deleted server.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DeletedServerProperties
    """

    properties: Optional["_models.DeletedServerProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["version", "deletion_time", "original_id", "fully_qualified_domain_name"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DeletedServerProperties"] = 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 DeletedServerProperties(_Model):
    """The properties of a deleted server.

    :ivar version: The version of the deleted server.
    :vartype version: str
    :ivar deletion_time: The deletion time of the deleted server.
    :vartype deletion_time: ~datetime.datetime
    :ivar original_id: The original ID of the server before deletion.
    :vartype original_id: str
    :ivar fully_qualified_domain_name: The fully qualified domain name of the server.
    :vartype fully_qualified_domain_name: str
    """

    version: Optional[str] = rest_field(visibility=["read"])
    """The version of the deleted server."""
    deletion_time: Optional[datetime.datetime] = rest_field(name="deletionTime", visibility=["read"], format="rfc3339")
    """The deletion time of the deleted server."""
    original_id: Optional[str] = rest_field(name="originalId", visibility=["read"])
    """The original ID of the server before deletion."""
    fully_qualified_domain_name: Optional[str] = rest_field(name="fullyQualifiedDomainName", visibility=["read"])
    """The fully qualified domain name of the server."""


class DistributedAvailabilityGroup(ProxyResource):
    """Distributed availability group between box and Sql Managed Instance.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.DistributedAvailabilityGroupProperties
    """

    properties: Optional["_models.DistributedAvailabilityGroupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "distributed_availability_group_name",
        "distributed_availability_group_id",
        "replication_mode",
        "partner_link_role",
        "partner_availability_group_name",
        "partner_endpoint",
        "instance_link_role",
        "instance_availability_group_name",
        "failover_mode",
        "seeding_mode",
        "databases",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.DistributedAvailabilityGroupProperties"] = 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 DistributedAvailabilityGroupDatabase(_Model):
    """Database specific information.

    :ivar database_name: The name of the database in link.
    :vartype database_name: str
    :ivar instance_replica_id: Managed instance replica id.
    :vartype instance_replica_id: str
    :ivar partner_replica_id: SQL server replica id.
    :vartype partner_replica_id: str
    :ivar replica_state: Current link state.
    :vartype replica_state: str
    :ivar seeding_progress: Seeding progress.
    :vartype seeding_progress: str
    :ivar synchronization_health: Link health state. Known values are: "NOT_HEALTHY",
     "PARTIALLY_HEALTHY", and "HEALTHY".
    :vartype synchronization_health: str or ~azure.mgmt.sql.models.ReplicaSynchronizationHealth
    :ivar connected_state: Link connected state. Known values are: "DISCONNECTED" and "CONNECTED".
    :vartype connected_state: str or ~azure.mgmt.sql.models.ReplicaConnectedState
    :ivar last_received_lsn: Last received LSN.
    :vartype last_received_lsn: str
    :ivar last_received_time: Last received LSN time.
    :vartype last_received_time: ~datetime.datetime
    :ivar last_sent_lsn: Last sent LSN.
    :vartype last_sent_lsn: str
    :ivar last_sent_time: Last sent LSN time.
    :vartype last_sent_time: ~datetime.datetime
    :ivar last_commit_lsn: Last commit LSN.
    :vartype last_commit_lsn: str
    :ivar last_commit_time: Last commit LSN time.
    :vartype last_commit_time: ~datetime.datetime
    :ivar last_hardened_lsn: Last hardened LSN.
    :vartype last_hardened_lsn: str
    :ivar last_hardened_time: Last hardened LSN time.
    :vartype last_hardened_time: ~datetime.datetime
    :ivar last_backup_lsn: Last backup LSN.
    :vartype last_backup_lsn: str
    :ivar last_backup_time: Last backup LSN time.
    :vartype last_backup_time: ~datetime.datetime
    :ivar most_recent_link_error: The most recent link connection error description.
    :vartype most_recent_link_error: str
    :ivar partner_auth_cert_validity: SQL server certificate validity.
    :vartype partner_auth_cert_validity: ~azure.mgmt.sql.models.CertificateInfo
    :ivar instance_send_replication_lag_seconds: Replication lag when Managed Instance link side is
     primary.
    :vartype instance_send_replication_lag_seconds: int
    :ivar instance_redo_replication_lag_seconds: Redo lag when Managed Instance link side is
     primary.
    :vartype instance_redo_replication_lag_seconds: int
    """

    database_name: Optional[str] = rest_field(
        name="databaseName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The name of the database in link."""
    instance_replica_id: Optional[str] = rest_field(name="instanceReplicaId", visibility=["read"])
    """Managed instance replica id."""
    partner_replica_id: Optional[str] = rest_field(name="partnerReplicaId", visibility=["read"])
    """SQL server replica id."""
    replica_state: Optional[str] = rest_field(name="replicaState", visibility=["read"])
    """Current link state."""
    seeding_progress: Optional[str] = rest_field(name="seedingProgress", visibility=["read"])
    """Seeding progress."""
    synchronization_health: Optional[Union[str, "_models.ReplicaSynchronizationHealth"]] = rest_field(
        name="synchronizationHealth", visibility=["read"]
    )
    """Link health state. Known values are: \"NOT_HEALTHY\", \"PARTIALLY_HEALTHY\", and \"HEALTHY\"."""
    connected_state: Optional[Union[str, "_models.ReplicaConnectedState"]] = rest_field(
        name="connectedState", visibility=["read"]
    )
    """Link connected state. Known values are: \"DISCONNECTED\" and \"CONNECTED\"."""
    last_received_lsn: Optional[str] = rest_field(name="lastReceivedLsn", visibility=["read"])
    """Last received LSN."""
    last_received_time: Optional[datetime.datetime] = rest_field(
        name="lastReceivedTime", visibility=["read"], format="rfc3339"
    )
    """Last received LSN time."""
    last_sent_lsn: Optional[str] = rest_field(name="lastSentLsn", visibility=["read"])
    """Last sent LSN."""
    last_sent_time: Optional[datetime.datetime] = rest_field(name="lastSentTime", visibility=["read"], format="rfc3339")
    """Last sent LSN time."""
    last_commit_lsn: Optional[str] = rest_field(name="lastCommitLsn", visibility=["read"])
    """Last commit LSN."""
    last_commit_time: Optional[datetime.datetime] = rest_field(
        name="lastCommitTime", visibility=["read"], format="rfc3339"
    )
    """Last commit LSN time."""
    last_hardened_lsn: Optional[str] = rest_field(name="lastHardenedLsn", visibility=["read"])
    """Last hardened LSN."""
    last_hardened_time: Optional[datetime.datetime] = rest_field(
        name="lastHardenedTime", visibility=["read"], format="rfc3339"
    )
    """Last hardened LSN time."""
    last_backup_lsn: Optional[str] = rest_field(name="lastBackupLsn", visibility=["read"])
    """Last backup LSN."""
    last_backup_time: Optional[datetime.datetime] = rest_field(
        name="lastBackupTime", visibility=["read"], format="rfc3339"
    )
    """Last backup LSN time."""
    most_recent_link_error: Optional[str] = rest_field(name="mostRecentLinkError", visibility=["read"])
    """The most recent link connection error description."""
    partner_auth_cert_validity: Optional["_models.CertificateInfo"] = rest_field(
        name="partnerAuthCertValidity", visibility=["read"]
    )
    """SQL server certificate validity."""
    instance_send_replication_lag_seconds: Optional[int] = rest_field(
        name="instanceSendReplicationLagSeconds", visibility=["read"]
    )
    """Replication lag when Managed Instance link side is primary."""
    instance_redo_replication_lag_seconds: Optional[int] = rest_field(
        name="instanceRedoReplicationLagSeconds", visibility=["read"]
    )
    """Redo lag when Managed Instance link side is primary."""

    @overload
    def __init__(
        self,
        *,
        database_name: 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 DistributedAvailabilityGroupProperties(_Model):
    """The properties of a distributed availability group.

    :ivar distributed_availability_group_name: Name of the distributed availability group.
    :vartype distributed_availability_group_name: str
    :ivar distributed_availability_group_id: ID of the distributed availability group.
    :vartype distributed_availability_group_id: str
    :ivar replication_mode: Replication mode of the link. Known values are: "Async" and "Sync".
    :vartype replication_mode: str or ~azure.mgmt.sql.models.ReplicationModeType
    :ivar partner_link_role: SQL server side link role. Known values are: "Primary" and
     "Secondary".
    :vartype partner_link_role: str or ~azure.mgmt.sql.models.LinkRole
    :ivar partner_availability_group_name: SQL server side availability group name.
    :vartype partner_availability_group_name: str
    :ivar partner_endpoint: SQL server side endpoint - IP or DNS resolvable name.
    :vartype partner_endpoint: str
    :ivar instance_link_role: Managed instance side link role. Known values are: "Primary" and
     "Secondary".
    :vartype instance_link_role: str or ~azure.mgmt.sql.models.LinkRole
    :ivar instance_availability_group_name: Managed instance side availability group name.
    :vartype instance_availability_group_name: str
    :ivar failover_mode: The link failover mode - can be Manual if intended to be used for two-way
     failover with a supported SQL Server, or None for one-way failover to Azure. Known values are:
     "None" and "Manual".
    :vartype failover_mode: str or ~azure.mgmt.sql.models.FailoverModeType
    :ivar seeding_mode: Database seeding mode – can be Automatic (default), or Manual for supported
     scenarios. Known values are: "Automatic" and "Manual".
    :vartype seeding_mode: str or ~azure.mgmt.sql.models.SeedingModeType
    :ivar databases: Databases in the distributed availability group.
    :vartype databases: list[~azure.mgmt.sql.models.DistributedAvailabilityGroupDatabase]
    """

    distributed_availability_group_name: Optional[str] = rest_field(
        name="distributedAvailabilityGroupName", visibility=["read"]
    )
    """Name of the distributed availability group."""
    distributed_availability_group_id: Optional[str] = rest_field(
        name="distributedAvailabilityGroupId", visibility=["read"]
    )
    """ID of the distributed availability group."""
    replication_mode: Optional[Union[str, "_models.ReplicationModeType"]] = rest_field(
        name="replicationMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Replication mode of the link. Known values are: \"Async\" and \"Sync\"."""
    partner_link_role: Optional[Union[str, "_models.LinkRole"]] = rest_field(
        name="partnerLinkRole", visibility=["read"]
    )
    """SQL server side link role. Known values are: \"Primary\" and \"Secondary\"."""
    partner_availability_group_name: Optional[str] = rest_field(
        name="partnerAvailabilityGroupName", visibility=["read", "create", "update", "delete", "query"]
    )
    """SQL server side availability group name."""
    partner_endpoint: Optional[str] = rest_field(
        name="partnerEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """SQL server side endpoint - IP or DNS resolvable name."""
    instance_link_role: Optional[Union[str, "_models.LinkRole"]] = rest_field(
        name="instanceLinkRole", visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed instance side link role. Known values are: \"Primary\" and \"Secondary\"."""
    instance_availability_group_name: Optional[str] = rest_field(
        name="instanceAvailabilityGroupName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed instance side availability group name."""
    failover_mode: Optional[Union[str, "_models.FailoverModeType"]] = rest_field(
        name="failoverMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """The link failover mode - can be Manual if intended to be used for two-way failover with a
     supported SQL Server, or None for one-way failover to Azure. Known values are: \"None\" and
     \"Manual\"."""
    seeding_mode: Optional[Union[str, "_models.SeedingModeType"]] = rest_field(
        name="seedingMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Database seeding mode – can be Automatic (default), or Manual for supported scenarios. Known
     values are: \"Automatic\" and \"Manual\"."""
    databases: Optional[list["_models.DistributedAvailabilityGroupDatabase"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Databases in the distributed availability group."""

    @overload
    def __init__(
        self,
        *,
        replication_mode: Optional[Union[str, "_models.ReplicationModeType"]] = None,
        partner_availability_group_name: Optional[str] = None,
        partner_endpoint: Optional[str] = None,
        instance_link_role: Optional[Union[str, "_models.LinkRole"]] = None,
        instance_availability_group_name: Optional[str] = None,
        failover_mode: Optional[Union[str, "_models.FailoverModeType"]] = None,
        seeding_mode: Optional[Union[str, "_models.SeedingModeType"]] = None,
        databases: Optional[list["_models.DistributedAvailabilityGroupDatabase"]] = 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 DistributedAvailabilityGroupSetRole(_Model):
    """Distributed availability group failover request.

    :ivar instance_role: New role of managed instance in a distributed availability group, can be
     Primary or Secondary. Required. Known values are: "Primary" and "Secondary".
    :vartype instance_role: str or ~azure.mgmt.sql.models.InstanceRole
    :ivar role_change_type: The type of the role change, can be Planned or Forced. Required. Known
     values are: "Forced" and "Planned".
    :vartype role_change_type: str or ~azure.mgmt.sql.models.RoleChangeType
    """

    instance_role: Union[str, "_models.InstanceRole"] = rest_field(name="instanceRole", visibility=["create", "update"])
    """New role of managed instance in a distributed availability group, can be Primary or Secondary.
     Required. Known values are: \"Primary\" and \"Secondary\"."""
    role_change_type: Union[str, "_models.RoleChangeType"] = rest_field(
        name="roleChangeType", visibility=["create", "update"]
    )
    """The type of the role change, can be Planned or Forced. Required. Known values are: \"Forced\"
     and \"Planned\"."""

    @overload
    def __init__(
        self,
        *,
        instance_role: Union[str, "_models.InstanceRole"],
        role_change_type: Union[str, "_models.RoleChangeType"],
    ) -> 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 DistributedAvailabilityGroupsFailoverRequest(_Model):  # pylint: disable=name-too-long
    """Distributed availability group failover.

    :ivar failover_type: The failover type, can be ForcedAllowDataLoss or Planned. Required. Known
     values are: "ForcedAllowDataLoss" and "Planned".
    :vartype failover_type: str or ~azure.mgmt.sql.models.FailoverType
    """

    failover_type: Union[str, "_models.FailoverType"] = rest_field(name="failoverType", visibility=["create", "update"])
    """The failover type, can be ForcedAllowDataLoss or Planned. Required. Known values are:
     \"ForcedAllowDataLoss\" and \"Planned\"."""

    @overload
    def __init__(
        self,
        *,
        failover_type: Union[str, "_models.FailoverType"],
    ) -> 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 EditionCapability(_Model):
    """The edition capability.

    :ivar name: The database edition name.
    :vartype name: str
    :ivar supported_service_level_objectives: The list of supported service objectives for the
     edition.
    :vartype supported_service_level_objectives:
     list[~azure.mgmt.sql.models.ServiceObjectiveCapability]
    :ivar zone_redundant: Whether or not zone redundancy is supported for the edition.
    :vartype zone_redundant: bool
    :ivar read_scale: The read scale capability for the edition.
    :vartype read_scale: ~azure.mgmt.sql.models.ReadScaleCapability
    :ivar supported_storage_capabilities: The list of supported storage capabilities for this
     edition.
    :vartype supported_storage_capabilities: list[~azure.mgmt.sql.models.StorageCapability]
    :ivar zone_pinning: Whether or not zone pinning is supported for the edition.
    :vartype zone_pinning: bool
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The database edition name."""
    supported_service_level_objectives: Optional[list["_models.ServiceObjectiveCapability"]] = rest_field(
        name="supportedServiceLevelObjectives", visibility=["read"]
    )
    """The list of supported service objectives for the edition."""
    zone_redundant: Optional[bool] = rest_field(name="zoneRedundant", visibility=["read"])
    """Whether or not zone redundancy is supported for the edition."""
    read_scale: Optional["_models.ReadScaleCapability"] = rest_field(name="readScale", visibility=["read"])
    """The read scale capability for the edition."""
    supported_storage_capabilities: Optional[list["_models.StorageCapability"]] = rest_field(
        name="supportedStorageCapabilities", visibility=["read"]
    )
    """The list of supported storage capabilities for this edition."""
    zone_pinning: Optional[bool] = rest_field(name="zonePinning", visibility=["read"])
    """Whether or not zone pinning is supported for the edition."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ElasticPool(TrackedResource):
    """An elastic pool.

    :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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ElasticPoolProperties
    :ivar sku: The elastic pool SKU.

     The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU
     name, tier/edition, family, and capacity) that are available to your subscription in an Azure
     region, use the ``Capabilities_ListByLocation`` REST API or the following command:



     .. code-block:: azurecli

        az sql elastic-pool list-editions -l <location> -o table
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar kind: Kind of elastic pool. This is metadata used for the Azure portal experience.
    :vartype kind: str
    """

    properties: Optional["_models.ElasticPoolProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The elastic pool SKU.
     
     The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU
     name, tier/edition, family, and capacity) that are available to your subscription in an Azure
     region, use the ``Capabilities_ListByLocation`` REST API or the following command:
     
     
     
     .. code-block:: azurecli
     
        az sql elastic-pool list-editions -l <location> -o table"""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Kind of elastic pool. This is metadata used for the Azure portal experience."""

    __flattened_items = [
        "state",
        "creation_date",
        "max_size_bytes",
        "min_capacity",
        "per_database_settings",
        "zone_redundant",
        "license_type",
        "maintenance_configuration_id",
        "high_availability_replica_count",
        "auto_pause_delay",
        "preferred_enclave_type",
        "availability_zone",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.ElasticPoolProperties"] = None,
        sku: Optional["_models.Sku"] = 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 ElasticPoolEditionCapability(_Model):
    """The elastic pool edition capability.

    :ivar name: The elastic pool edition name.
    :vartype name: str
    :ivar supported_elastic_pool_performance_levels: The list of supported elastic pool DTU levels
     for the edition.
    :vartype supported_elastic_pool_performance_levels:
     list[~azure.mgmt.sql.models.ElasticPoolPerformanceLevelCapability]
    :ivar zone_redundant: Whether or not zone redundancy is supported for the edition.
    :vartype zone_redundant: bool
    :ivar zone_pinning: Whether or not zone pinning is supported for the edition.
    :vartype zone_pinning: bool
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The elastic pool edition name."""
    supported_elastic_pool_performance_levels: Optional[list["_models.ElasticPoolPerformanceLevelCapability"]] = (
        rest_field(name="supportedElasticPoolPerformanceLevels", visibility=["read"])
    )
    """The list of supported elastic pool DTU levels for the edition."""
    zone_redundant: Optional[bool] = rest_field(name="zoneRedundant", visibility=["read"])
    """Whether or not zone redundancy is supported for the edition."""
    zone_pinning: Optional[bool] = rest_field(name="zonePinning", visibility=["read"])
    """Whether or not zone pinning is supported for the edition."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ElasticPoolOperation(ProxyResource):
    """A elastic pool operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ElasticPoolOperationProperties
    """

    properties: Optional["_models.ElasticPoolOperationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "elastic_pool_name",
        "operation",
        "operation_friendly_name",
        "percent_complete",
        "server_name",
        "start_time",
        "state",
        "error_code",
        "error_description",
        "error_severity",
        "is_user_error",
        "estimated_completion_time",
        "description",
        "is_cancellable",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ElasticPoolOperationProperties"] = 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 ElasticPoolOperationProperties(_Model):
    """The properties of a elastic pool operation.

    :ivar elastic_pool_name: The name of the elastic pool the operation is being performed on.
    :vartype elastic_pool_name: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar server_name: The name of the server.
    :vartype server_name: str
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state.
    :vartype state: str
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    """

    elastic_pool_name: Optional[str] = rest_field(name="elasticPoolName", visibility=["read"])
    """The name of the elastic pool the operation is being performed on."""
    operation: Optional[str] = rest_field(visibility=["read"])
    """The name of operation."""
    operation_friendly_name: Optional[str] = rest_field(name="operationFriendlyName", visibility=["read"])
    """The friendly name of operation."""
    percent_complete: Optional[int] = rest_field(name="percentComplete", visibility=["read"])
    """The percentage of the operation completed."""
    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """The name of the server."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The operation start time."""
    state: Optional[str] = rest_field(visibility=["read"])
    """The operation state."""
    error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"])
    """The operation error code."""
    error_description: Optional[str] = rest_field(name="errorDescription", visibility=["read"])
    """The operation error description."""
    error_severity: Optional[int] = rest_field(name="errorSeverity", visibility=["read"])
    """The operation error severity."""
    is_user_error: Optional[bool] = rest_field(name="isUserError", visibility=["read"])
    """Whether or not the error is a user error."""
    estimated_completion_time: Optional[datetime.datetime] = rest_field(
        name="estimatedCompletionTime", visibility=["read"], format="rfc3339"
    )
    """The estimated completion time of the operation."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The operation description."""
    is_cancellable: Optional[bool] = rest_field(name="isCancellable", visibility=["read"])
    """Whether the operation can be cancelled."""


class ElasticPoolPerDatabaseMaxPerformanceLevelCapability(_Model):  # pylint: disable=name-too-long
    """The max per-database performance level capability.

    :ivar limit: The maximum performance level per database.
    :vartype limit: float
    :ivar unit: Unit type used to measure performance level. Known values are: "DTU" and "VCores".
    :vartype unit: str or ~azure.mgmt.sql.models.PerformanceLevelUnit
    :ivar supported_per_database_min_performance_levels: The list of supported min database
     performance levels.
    :vartype supported_per_database_min_performance_levels:
     list[~azure.mgmt.sql.models.ElasticPoolPerDatabaseMinPerformanceLevelCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    limit: Optional[float] = rest_field(visibility=["read"])
    """The maximum performance level per database."""
    unit: Optional[Union[str, "_models.PerformanceLevelUnit"]] = rest_field(visibility=["read"])
    """Unit type used to measure performance level. Known values are: \"DTU\" and \"VCores\"."""
    supported_per_database_min_performance_levels: Optional[
        list["_models.ElasticPoolPerDatabaseMinPerformanceLevelCapability"]
    ] = rest_field(name="supportedPerDatabaseMinPerformanceLevels", visibility=["read"])
    """The list of supported min database performance levels."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ElasticPoolPerDatabaseMinPerformanceLevelCapability(_Model):  # pylint: disable=name-too-long
    """The minimum per-database performance level capability.

    :ivar limit: The minimum performance level per database.
    :vartype limit: float
    :ivar unit: Unit type used to measure performance level. Known values are: "DTU" and "VCores".
    :vartype unit: str or ~azure.mgmt.sql.models.PerformanceLevelUnit
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    limit: Optional[float] = rest_field(visibility=["read"])
    """The minimum performance level per database."""
    unit: Optional[Union[str, "_models.PerformanceLevelUnit"]] = rest_field(visibility=["read"])
    """Unit type used to measure performance level. Known values are: \"DTU\" and \"VCores\"."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ElasticPoolPerDatabaseSettings(_Model):
    """Per database settings of an elastic pool.

    :ivar min_capacity: The minimum capacity all databases are guaranteed.
    :vartype min_capacity: float
    :ivar max_capacity: The maximum capacity any one database can consume.
    :vartype max_capacity: float
    :ivar auto_pause_delay: Auto Pause Delay for per database within pool.
    :vartype auto_pause_delay: int
    """

    min_capacity: Optional[float] = rest_field(
        name="minCapacity", visibility=["read", "create", "update", "delete", "query"]
    )
    """The minimum capacity all databases are guaranteed."""
    max_capacity: Optional[float] = rest_field(
        name="maxCapacity", visibility=["read", "create", "update", "delete", "query"]
    )
    """The maximum capacity any one database can consume."""
    auto_pause_delay: Optional[int] = rest_field(
        name="autoPauseDelay", visibility=["read", "create", "update", "delete", "query"]
    )
    """Auto Pause Delay for per database within pool."""

    @overload
    def __init__(
        self,
        *,
        min_capacity: Optional[float] = None,
        max_capacity: Optional[float] = None,
        auto_pause_delay: 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 ElasticPoolPerformanceLevelCapability(_Model):
    """The Elastic Pool performance level capability.

    :ivar performance_level: The performance level for the pool.
    :vartype performance_level: ~azure.mgmt.sql.models.PerformanceLevelCapability
    :ivar sku: The sku.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar supported_license_types: List of supported license types.
    :vartype supported_license_types: list[~azure.mgmt.sql.models.LicenseTypeCapability]
    :ivar max_database_count: The maximum number of databases supported.
    :vartype max_database_count: int
    :ivar included_max_size: The included (free) max size for this performance level.
    :vartype included_max_size: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar supported_max_sizes: The list of supported max sizes.
    :vartype supported_max_sizes: list[~azure.mgmt.sql.models.MaxSizeRangeCapability]
    :ivar supported_per_database_max_sizes: The list of supported per database max sizes.
    :vartype supported_per_database_max_sizes: list[~azure.mgmt.sql.models.MaxSizeRangeCapability]
    :ivar supported_per_database_max_performance_levels: The list of supported per database max
     performance levels.
    :vartype supported_per_database_max_performance_levels:
     list[~azure.mgmt.sql.models.ElasticPoolPerDatabaseMaxPerformanceLevelCapability]
    :ivar zone_redundant: Whether or not zone redundancy is supported for the performance level.
    :vartype zone_redundant: bool
    :ivar supported_maintenance_configurations: List of supported maintenance configurations.
    :vartype supported_maintenance_configurations:
     list[~azure.mgmt.sql.models.MaintenanceConfigurationCapability]
    :ivar supported_min_capacities: List of supported min capacities.
    :vartype supported_min_capacities: list[~azure.mgmt.sql.models.MinCapacityCapability]
    :ivar supported_auto_pause_delay: Supported time range for auto pause delay.
    :vartype supported_auto_pause_delay: ~azure.mgmt.sql.models.AutoPauseDelayTimeRange
    :ivar supported_per_database_auto_pause_delay: Supported time range for per database auto pause
     delay.
    :vartype supported_per_database_auto_pause_delay:
     ~azure.mgmt.sql.models.PerDatabaseAutoPauseDelayTimeRange
    :ivar supported_zones: List of supported availability zones.
    :vartype supported_zones: list[~azure.mgmt.sql.models.ZonePinningCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    performance_level: Optional["_models.PerformanceLevelCapability"] = rest_field(
        name="performanceLevel", visibility=["read"]
    )
    """The performance level for the pool."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read"])
    """The sku."""
    supported_license_types: Optional[list["_models.LicenseTypeCapability"]] = rest_field(
        name="supportedLicenseTypes", visibility=["read"]
    )
    """List of supported license types."""
    max_database_count: Optional[int] = rest_field(name="maxDatabaseCount", visibility=["read"])
    """The maximum number of databases supported."""
    included_max_size: Optional["_models.MaxSizeCapability"] = rest_field(name="includedMaxSize", visibility=["read"])
    """The included (free) max size for this performance level."""
    supported_max_sizes: Optional[list["_models.MaxSizeRangeCapability"]] = rest_field(
        name="supportedMaxSizes", visibility=["read"]
    )
    """The list of supported max sizes."""
    supported_per_database_max_sizes: Optional[list["_models.MaxSizeRangeCapability"]] = rest_field(
        name="supportedPerDatabaseMaxSizes", visibility=["read"]
    )
    """The list of supported per database max sizes."""
    supported_per_database_max_performance_levels: Optional[
        list["_models.ElasticPoolPerDatabaseMaxPerformanceLevelCapability"]
    ] = rest_field(name="supportedPerDatabaseMaxPerformanceLevels", visibility=["read"])
    """The list of supported per database max performance levels."""
    zone_redundant: Optional[bool] = rest_field(name="zoneRedundant", visibility=["read"])
    """Whether or not zone redundancy is supported for the performance level."""
    supported_maintenance_configurations: Optional[list["_models.MaintenanceConfigurationCapability"]] = rest_field(
        name="supportedMaintenanceConfigurations", visibility=["read"]
    )
    """List of supported maintenance configurations."""
    supported_min_capacities: Optional[list["_models.MinCapacityCapability"]] = rest_field(
        name="supportedMinCapacities", visibility=["read"]
    )
    """List of supported min capacities."""
    supported_auto_pause_delay: Optional["_models.AutoPauseDelayTimeRange"] = rest_field(
        name="supportedAutoPauseDelay", visibility=["read"]
    )
    """Supported time range for auto pause delay."""
    supported_per_database_auto_pause_delay: Optional["_models.PerDatabaseAutoPauseDelayTimeRange"] = rest_field(
        name="supportedPerDatabaseAutoPauseDelay", visibility=["read"]
    )
    """Supported time range for per database auto pause delay."""
    supported_zones: Optional[list["_models.ZonePinningCapability"]] = rest_field(
        name="supportedZones", visibility=["read"]
    )
    """List of supported availability zones."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ElasticPoolProperties(_Model):
    """Properties of an elastic pool.

    :ivar state: The state of the elastic pool. Known values are: "Creating", "Ready", and
     "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.ElasticPoolState
    :ivar creation_date: The creation date of the elastic pool (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar max_size_bytes: The storage limit for the database elastic pool in bytes.
    :vartype max_size_bytes: int
    :ivar min_capacity: Minimal capacity that serverless pool will not shrink below, if not paused.
    :vartype min_capacity: float
    :ivar per_database_settings: The per database settings for the elastic pool.
    :vartype per_database_settings: ~azure.mgmt.sql.models.ElasticPoolPerDatabaseSettings
    :ivar zone_redundant: Whether or not this elastic pool is zone redundant, which means the
     replicas of this elastic pool will be spread across multiple availability zones.
    :vartype zone_redundant: bool
    :ivar license_type: The license type to apply for this elastic pool. Known values are:
     "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.ElasticPoolLicenseType
    :ivar maintenance_configuration_id: Maintenance configuration id assigned to the elastic pool.
     This configuration defines the period when the maintenance updates will will occur.
    :vartype maintenance_configuration_id: str
    :ivar high_availability_replica_count: The number of secondary replicas associated with the
     Business Critical, Premium, or Hyperscale edition elastic pool that are used to provide high
     availability. Applicable only to Hyperscale elastic pools.
    :vartype high_availability_replica_count: int
    :ivar auto_pause_delay: Time in minutes after which elastic pool is automatically paused. A
     value of -1 means that automatic pause is disabled.
    :vartype auto_pause_delay: int
    :ivar preferred_enclave_type: Type of enclave requested on the elastic pool. Known values are:
     "Default" and "VBS".
    :vartype preferred_enclave_type: str or ~azure.mgmt.sql.models.AlwaysEncryptedEnclaveType
    :ivar availability_zone: Specifies the availability zone the pool's primary replica is pinned
     to. Known values are: "NoPreference", "1", "2", and "3".
    :vartype availability_zone: str or ~azure.mgmt.sql.models.AvailabilityZoneType
    """

    state: Optional[Union[str, "_models.ElasticPoolState"]] = rest_field(visibility=["read"])
    """The state of the elastic pool. Known values are: \"Creating\", \"Ready\", and \"Disabled\"."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """The creation date of the elastic pool (ISO8601 format)."""
    max_size_bytes: Optional[int] = rest_field(
        name="maxSizeBytes", visibility=["read", "create", "update", "delete", "query"]
    )
    """The storage limit for the database elastic pool in bytes."""
    min_capacity: Optional[float] = rest_field(
        name="minCapacity", visibility=["read", "create", "update", "delete", "query"]
    )
    """Minimal capacity that serverless pool will not shrink below, if not paused."""
    per_database_settings: Optional["_models.ElasticPoolPerDatabaseSettings"] = rest_field(
        name="perDatabaseSettings", visibility=["read", "create", "update", "delete", "query"]
    )
    """The per database settings for the elastic pool."""
    zone_redundant: Optional[bool] = rest_field(
        name="zoneRedundant", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not this elastic pool is zone redundant, which means the replicas of this elastic
     pool will be spread across multiple availability zones."""
    license_type: Optional[Union[str, "_models.ElasticPoolLicenseType"]] = rest_field(
        name="licenseType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The license type to apply for this elastic pool. Known values are: \"LicenseIncluded\" and
     \"BasePrice\"."""
    maintenance_configuration_id: Optional[str] = rest_field(
        name="maintenanceConfigurationId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Maintenance configuration id assigned to the elastic pool. This configuration defines the
     period when the maintenance updates will will occur."""
    high_availability_replica_count: Optional[int] = rest_field(
        name="highAvailabilityReplicaCount", visibility=["read", "create", "update", "delete", "query"]
    )
    """The number of secondary replicas associated with the Business Critical, Premium, or Hyperscale
     edition elastic pool that are used to provide high availability. Applicable only to Hyperscale
     elastic pools."""
    auto_pause_delay: Optional[int] = rest_field(
        name="autoPauseDelay", visibility=["read", "create", "update", "delete", "query"]
    )
    """Time in minutes after which elastic pool is automatically paused. A value of -1 means that
     automatic pause is disabled."""
    preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = rest_field(
        name="preferredEnclaveType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of enclave requested on the elastic pool. Known values are: \"Default\" and \"VBS\"."""
    availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = rest_field(
        name="availabilityZone", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the availability zone the pool's primary replica is pinned to. Known values are:
     \"NoPreference\", \"1\", \"2\", and \"3\"."""

    @overload
    def __init__(
        self,
        *,
        max_size_bytes: Optional[int] = None,
        min_capacity: Optional[float] = None,
        per_database_settings: Optional["_models.ElasticPoolPerDatabaseSettings"] = None,
        zone_redundant: Optional[bool] = None,
        license_type: Optional[Union[str, "_models.ElasticPoolLicenseType"]] = None,
        maintenance_configuration_id: Optional[str] = None,
        high_availability_replica_count: Optional[int] = None,
        auto_pause_delay: Optional[int] = None,
        preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = None,
        availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = 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 ElasticPoolUpdate(_Model):
    """An elastic pool update.

    :ivar sku: An ARM Resource SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ElasticPoolUpdateProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """An ARM Resource SKU."""
    properties: Optional["_models.ElasticPoolUpdateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = [
        "max_size_bytes",
        "min_capacity",
        "per_database_settings",
        "zone_redundant",
        "license_type",
        "maintenance_configuration_id",
        "high_availability_replica_count",
        "auto_pause_delay",
        "preferred_enclave_type",
        "availability_zone",
    ]

    @overload
    def __init__(
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        properties: Optional["_models.ElasticPoolUpdateProperties"] = 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 ElasticPoolUpdateProperties(_Model):
    """Properties of an elastic pool.

    :ivar max_size_bytes: The storage limit for the database elastic pool in bytes.
    :vartype max_size_bytes: int
    :ivar min_capacity: Minimal capacity that serverless pool will not shrink below, if not paused.
    :vartype min_capacity: float
    :ivar per_database_settings: The per database settings for the elastic pool.
    :vartype per_database_settings: ~azure.mgmt.sql.models.ElasticPoolPerDatabaseSettings
    :ivar zone_redundant: Whether or not this elastic pool is zone redundant, which means the
     replicas of this elastic pool will be spread across multiple availability zones.
    :vartype zone_redundant: bool
    :ivar license_type: The license type to apply for this elastic pool. Known values are:
     "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.ElasticPoolLicenseType
    :ivar maintenance_configuration_id: Maintenance configuration id assigned to the elastic pool.
     This configuration defines the period when the maintenance updates will will occur.
    :vartype maintenance_configuration_id: str
    :ivar high_availability_replica_count: The number of secondary replicas associated with the
     Business Critical, Premium, or Hyperscale edition elastic pool that are used to provide high
     availability. Applicable only to Hyperscale elastic pools.
    :vartype high_availability_replica_count: int
    :ivar auto_pause_delay: Time in minutes after which elastic pool is automatically paused. A
     value of -1 means that automatic pause is disabled.
    :vartype auto_pause_delay: int
    :ivar preferred_enclave_type: Type of enclave requested on the elastic pool. Known values are:
     "Default" and "VBS".
    :vartype preferred_enclave_type: str or ~azure.mgmt.sql.models.AlwaysEncryptedEnclaveType
    :ivar availability_zone: Specifies the availability zone the pool's primary replica is pinned
     to. Known values are: "NoPreference", "1", "2", and "3".
    :vartype availability_zone: str or ~azure.mgmt.sql.models.AvailabilityZoneType
    """

    max_size_bytes: Optional[int] = rest_field(
        name="maxSizeBytes", visibility=["read", "create", "update", "delete", "query"]
    )
    """The storage limit for the database elastic pool in bytes."""
    min_capacity: Optional[float] = rest_field(
        name="minCapacity", visibility=["read", "create", "update", "delete", "query"]
    )
    """Minimal capacity that serverless pool will not shrink below, if not paused."""
    per_database_settings: Optional["_models.ElasticPoolPerDatabaseSettings"] = rest_field(
        name="perDatabaseSettings", visibility=["read", "create", "update", "delete", "query"]
    )
    """The per database settings for the elastic pool."""
    zone_redundant: Optional[bool] = rest_field(
        name="zoneRedundant", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not this elastic pool is zone redundant, which means the replicas of this elastic
     pool will be spread across multiple availability zones."""
    license_type: Optional[Union[str, "_models.ElasticPoolLicenseType"]] = rest_field(
        name="licenseType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The license type to apply for this elastic pool. Known values are: \"LicenseIncluded\" and
     \"BasePrice\"."""
    maintenance_configuration_id: Optional[str] = rest_field(
        name="maintenanceConfigurationId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Maintenance configuration id assigned to the elastic pool. This configuration defines the
     period when the maintenance updates will will occur."""
    high_availability_replica_count: Optional[int] = rest_field(
        name="highAvailabilityReplicaCount", visibility=["read", "create", "update", "delete", "query"]
    )
    """The number of secondary replicas associated with the Business Critical, Premium, or Hyperscale
     edition elastic pool that are used to provide high availability. Applicable only to Hyperscale
     elastic pools."""
    auto_pause_delay: Optional[int] = rest_field(
        name="autoPauseDelay", visibility=["read", "create", "update", "delete", "query"]
    )
    """Time in minutes after which elastic pool is automatically paused. A value of -1 means that
     automatic pause is disabled."""
    preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = rest_field(
        name="preferredEnclaveType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of enclave requested on the elastic pool. Known values are: \"Default\" and \"VBS\"."""
    availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = rest_field(
        name="availabilityZone", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the availability zone the pool's primary replica is pinned to. Known values are:
     \"NoPreference\", \"1\", \"2\", and \"3\"."""

    @overload
    def __init__(
        self,
        *,
        max_size_bytes: Optional[int] = None,
        min_capacity: Optional[float] = None,
        per_database_settings: Optional["_models.ElasticPoolPerDatabaseSettings"] = None,
        zone_redundant: Optional[bool] = None,
        license_type: Optional[Union[str, "_models.ElasticPoolLicenseType"]] = None,
        maintenance_configuration_id: Optional[str] = None,
        high_availability_replica_count: Optional[int] = None,
        auto_pause_delay: Optional[int] = None,
        preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = None,
        availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = 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 EncryptionProtector(ProxyResource):
    """The server encryption protector.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.EncryptionProtectorProperties
    :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal
     experience.
    :vartype kind: str
    :ivar location: Resource location.
    :vartype location: str
    """

    properties: Optional["_models.EncryptionProtectorProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Kind of encryption protector. This is metadata used for the Azure portal experience."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Resource location."""

    __flattened_items = [
        "subregion",
        "server_key_name",
        "server_key_type",
        "uri",
        "thumbprint",
        "auto_rotation_enabled",
        "key_version",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.EncryptionProtectorProperties"] = 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 EncryptionProtectorProperties(_Model):
    """Properties for an encryption protector execution.

    :ivar subregion: Subregion of the encryption protector.
    :vartype subregion: str
    :ivar server_key_name: The name of the server key.
    :vartype server_key_name: str
    :ivar server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'.
     Required. Known values are: "ServiceManaged" and "AzureKeyVault".
    :vartype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
    :ivar uri: The URI of the server key.
    :vartype uri: str
    :ivar thumbprint: Thumbprint of the server key.
    :vartype thumbprint: str
    :ivar auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
    :vartype auto_rotation_enabled: bool
    :ivar key_version: The version of the server key being used as encryption protector.
    :vartype key_version: str
    """

    subregion: Optional[str] = rest_field(visibility=["read"])
    """Subregion of the encryption protector."""
    server_key_name: Optional[str] = rest_field(
        name="serverKeyName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The name of the server key."""
    server_key_type: Union[str, "_models.ServerKeyType"] = rest_field(
        name="serverKeyType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Required. Known values
     are: \"ServiceManaged\" and \"AzureKeyVault\"."""
    uri: Optional[str] = rest_field(visibility=["read"])
    """The URI of the server key."""
    thumbprint: Optional[str] = rest_field(visibility=["read"])
    """Thumbprint of the server key."""
    auto_rotation_enabled: Optional[bool] = rest_field(
        name="autoRotationEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Key auto rotation opt-in flag. Either true or false."""
    key_version: Optional[str] = rest_field(name="keyVersion", visibility=["read"])
    """The version of the server key being used as encryption protector."""

    @overload
    def __init__(
        self,
        *,
        server_key_type: Union[str, "_models.ServerKeyType"],
        server_key_name: Optional[str] = None,
        auto_rotation_enabled: Optional[bool] = 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 EndpointCertificate(ProxyResource):
    """Certificate used on an endpoint on the Managed Instance.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.EndpointCertificateProperties
    """

    properties: Optional["_models.EndpointCertificateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["public_blob"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.EndpointCertificateProperties"] = 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 EndpointCertificateProperties(_Model):
    """The properties of an endpoint certificate.

    :ivar public_blob: The certificate public blob.
    :vartype public_blob: str
    """

    public_blob: Optional[str] = rest_field(
        name="publicBlob", visibility=["read", "create", "update", "delete", "query"]
    )
    """The certificate public blob."""

    @overload
    def __init__(
        self,
        *,
        public_blob: 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 EndpointDependency(_Model):
    """A domain name that the managed instance service needs to communicate with, along with
    additional details.

    :ivar domain_name: The domain name of the dependency.
    :vartype domain_name: str
    :ivar endpoint_details: The IP Addresses and Ports used when connecting to DomainName.
    :vartype endpoint_details: list[~azure.mgmt.sql.models.EndpointDetail]
    """

    domain_name: Optional[str] = rest_field(name="domainName", visibility=["read"])
    """The domain name of the dependency."""
    endpoint_details: Optional[list["_models.EndpointDetail"]] = rest_field(name="endpointDetails", visibility=["read"])
    """The IP Addresses and Ports used when connecting to DomainName."""


class EndpointDetail(_Model):
    """A domain name that the managed instance service needs to communicate with, along with
    additional details.

    :ivar port: The port an endpoint is connected to.
    :vartype port: int
    """

    port: Optional[int] = rest_field(visibility=["read"])
    """The port an endpoint is connected to."""


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.sql.models.ErrorDetail]
    :ivar additional_info: The error additional info.
    :vartype additional_info: list[~azure.mgmt.sql.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.sql.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 ExportDatabaseDefinition(_Model):
    """Contains the information necessary to perform export database operation.

    :ivar storage_key_type: Storage key type: StorageAccessKey, SharedAccessKey, or
     ManagedIdentity. Required. Known values are: "SharedAccessKey", "StorageAccessKey", and
     "ManagedIdentity".
    :vartype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
    :ivar storage_key: Storage key for the storage account. If StorageKeyType is ManagedIdentity,
     this field should specify the Managed Identity's resource ID. Required.
    :vartype storage_key: str
    :ivar storage_uri: Storage Uri. Required.
    :vartype storage_uri: str
    :ivar administrator_login: Administrator login name. If AuthenticationType is ManagedIdentity,
     this field should specify the Managed Identity's resource ID. Required.
    :vartype administrator_login: str
    :ivar administrator_login_password: Administrator login password. If AuthenticationType is
     ManagedIdentity, this field should not be specified.
    :vartype administrator_login_password: str
    :ivar authentication_type: Type of credentials provided for access to the target SQL server:
     SQL, ADPassword or ManagedIdentity.
    :vartype authentication_type: str
    :ivar network_isolation: Optional resource information to enable network isolation for request.
    :vartype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
    """

    storage_key_type: Union[str, "_models.StorageKeyType"] = rest_field(name="storageKeyType", visibility=["create"])
    """Storage key type: StorageAccessKey, SharedAccessKey, or ManagedIdentity. Required. Known values
     are: \"SharedAccessKey\", \"StorageAccessKey\", and \"ManagedIdentity\"."""
    storage_key: str = rest_field(name="storageKey", visibility=["create"])
    """Storage key for the storage account. If StorageKeyType is ManagedIdentity, this field should
     specify the Managed Identity's resource ID. Required."""
    storage_uri: str = rest_field(name="storageUri", visibility=["create"])
    """Storage Uri. Required."""
    administrator_login: str = rest_field(name="administratorLogin", visibility=["create"])
    """Administrator login name. If AuthenticationType is ManagedIdentity, this field should specify
     the Managed Identity's resource ID. Required."""
    administrator_login_password: Optional[str] = rest_field(name="administratorLoginPassword", visibility=["create"])
    """Administrator login password. If AuthenticationType is ManagedIdentity, this field should not
     be specified."""
    authentication_type: Optional[str] = rest_field(name="authenticationType", visibility=["create"])
    """Type of credentials provided for access to the target SQL server: SQL, ADPassword or
     ManagedIdentity."""
    network_isolation: Optional["_models.NetworkIsolationSettings"] = rest_field(
        name="networkIsolation", visibility=["create"]
    )
    """Optional resource information to enable network isolation for request."""

    @overload
    def __init__(
        self,
        *,
        storage_key_type: Union[str, "_models.StorageKeyType"],
        storage_key: str,
        storage_uri: str,
        administrator_login: str,
        administrator_login_password: Optional[str] = None,
        authentication_type: Optional[str] = None,
        network_isolation: Optional["_models.NetworkIsolationSettings"] = 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 ExtendedDatabaseBlobAuditingPolicy(ProxyResource):
    """An extended database blob auditing policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicyProperties
    """

    properties: Optional["_models.ExtendedDatabaseBlobAuditingPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "predicate_expression",
        "retention_days",
        "audit_actions_and_groups",
        "is_storage_secondary_key_in_use",
        "is_azure_monitor_target_enabled",
        "queue_delay_ms",
        "is_managed_identity_in_use",
        "state",
        "storage_endpoint",
        "storage_account_access_key",
        "storage_account_subscription_id",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ExtendedDatabaseBlobAuditingPolicyProperties"] = 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 ExtendedDatabaseBlobAuditingPolicyProperties(_Model):  # pylint: disable=name-too-long
    """Properties of an extended database blob auditing policy.

    :ivar predicate_expression: Specifies condition of where clause when creating an audit.
    :vartype predicate_expression: str
    :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage
     account.
    :vartype retention_days: int
    :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:

     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.

     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.

     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP

     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.

     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES

     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}

     Note that <object> in the above format can refer to an object like a table, view, or stored
     procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name}
     and SCHEMA::{schema_name} are used, respectively.

     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public

     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
    :vartype audit_actions_and_groups: list[str]
    :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the
     storage's secondary key.
    :vartype is_storage_secondary_key_in_use: bool
    :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.

     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit
     actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum
     is 2,147,483,647.
    :vartype queue_delay_ms: int
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     `https://MyAccount.blob.core.windows.net <https://MyAccount.blob.core.windows.net>`_). If state
     is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:

     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355).
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    predicate_expression: Optional[str] = rest_field(
        name="predicateExpression", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies condition of where clause when creating an audit."""
    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the number of days to keep in the audit logs in the storage account."""
    audit_actions_and_groups: Optional[list[str]] = rest_field(
        name="auditActionsAndGroups", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the Actions-Groups and Actions to audit.
     
     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:
     
     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.
     
     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.
     
     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):
     
     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP
     
     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.
     
     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.
     
     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES
     
     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}
     
     Note that <object> in the above format can refer to an object like a table, view, or stored
     procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name}
     and SCHEMA::{schema_name} are used, respectively.
     
     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public
     
     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_."""
    is_storage_secondary_key_in_use: Optional[bool] = rest_field(
        name="isStorageSecondaryKeyInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether storageAccountAccessKey value is the storage's secondary key."""
    is_azure_monitor_target_enabled: Optional[bool] = rest_field(
        name="isAzureMonitorTargetEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether audit events are sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.
     
     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.
     
     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_
     
     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_."""
    queue_delay_ms: Optional[int] = rest_field(
        name="queueDelayMs", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the amount of time in milliseconds that can elapse before audit actions are forced to
     be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647."""
    is_managed_identity_in_use: Optional[bool] = rest_field(
        name="isManagedIdentityInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether Managed Identity is used to access blob storage."""
    state: Union[str, "_models.BlobAuditingPolicyState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: \"Enabled\" and
     \"Disabled\"."""
    storage_endpoint: Optional[str] = rest_field(
        name="storageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage endpoint (e.g. `https://MyAccount.blob.core.windows.net
     <https://MyAccount.blob.core.windows.net>`_). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["create", "update"]
    )
    """Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:
     
     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355)."""
    storage_account_subscription_id: Optional[str] = rest_field(
        name="storageAccountSubscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage subscription Id."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.BlobAuditingPolicyState"],
        predicate_expression: Optional[str] = None,
        retention_days: Optional[int] = None,
        audit_actions_and_groups: Optional[list[str]] = None,
        is_storage_secondary_key_in_use: Optional[bool] = None,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        queue_delay_ms: Optional[int] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: 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 ExtendedServerBlobAuditingPolicy(ProxyResource):
    """An extended server blob auditing policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicyProperties
    """

    properties: Optional["_models.ExtendedServerBlobAuditingPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "is_devops_audit_enabled",
        "predicate_expression",
        "retention_days",
        "audit_actions_and_groups",
        "is_storage_secondary_key_in_use",
        "is_azure_monitor_target_enabled",
        "queue_delay_ms",
        "is_managed_identity_in_use",
        "state",
        "storage_endpoint",
        "storage_account_access_key",
        "storage_account_subscription_id",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ExtendedServerBlobAuditingPolicyProperties"] = 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 ExtendedServerBlobAuditingPolicyProperties(_Model):  # pylint: disable=name-too-long
    """Properties of an extended server blob auditing policy.

    :ivar is_devops_audit_enabled: Specifies the state of devops audit. If state is Enabled, devops
     logs will be sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled',
     'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true

     When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit'
     diagnostic logs category on the master database should also be created.

     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_devops_audit_enabled: bool
    :ivar predicate_expression: Specifies condition of where clause when creating an audit.
    :vartype predicate_expression: str
    :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage
     account.
    :vartype retention_days: int
    :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:

     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.

     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.

     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP

     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.

     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES

     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}

     Note that <object> in the above format can refer to an object like a table, view, or stored
     procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name}
     and SCHEMA::{schema_name} are used, respectively.

     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public

     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
    :vartype audit_actions_and_groups: list[str]
    :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the
     storage's secondary key.
    :vartype is_storage_secondary_key_in_use: bool
    :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.

     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit
     actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum
     is 2,147,483,647.
    :vartype queue_delay_ms: int
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     `https://MyAccount.blob.core.windows.net <https://MyAccount.blob.core.windows.net>`_). If state
     is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:

     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355).
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    is_devops_audit_enabled: Optional[bool] = rest_field(
        name="isDevopsAuditEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled',
     'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true
     
     When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit'
     diagnostic logs category on the master database should also be created.
     
     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_
     
     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_."""
    predicate_expression: Optional[str] = rest_field(
        name="predicateExpression", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies condition of where clause when creating an audit."""
    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the number of days to keep in the audit logs in the storage account."""
    audit_actions_and_groups: Optional[list[str]] = rest_field(
        name="auditActionsAndGroups", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the Actions-Groups and Actions to audit.
     
     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:
     
     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.
     
     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.
     
     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):
     
     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP
     
     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.
     
     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.
     
     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES
     
     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}
     
     Note that <object> in the above format can refer to an object like a table, view, or stored
     procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name}
     and SCHEMA::{schema_name} are used, respectively.
     
     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public
     
     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_."""
    is_storage_secondary_key_in_use: Optional[bool] = rest_field(
        name="isStorageSecondaryKeyInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether storageAccountAccessKey value is the storage's secondary key."""
    is_azure_monitor_target_enabled: Optional[bool] = rest_field(
        name="isAzureMonitorTargetEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether audit events are sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.
     
     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.
     
     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_
     
     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_."""
    queue_delay_ms: Optional[int] = rest_field(
        name="queueDelayMs", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the amount of time in milliseconds that can elapse before audit actions are forced to
     be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647."""
    is_managed_identity_in_use: Optional[bool] = rest_field(
        name="isManagedIdentityInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether Managed Identity is used to access blob storage."""
    state: Union[str, "_models.BlobAuditingPolicyState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: \"Enabled\" and
     \"Disabled\"."""
    storage_endpoint: Optional[str] = rest_field(
        name="storageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage endpoint (e.g. `https://MyAccount.blob.core.windows.net
     <https://MyAccount.blob.core.windows.net>`_). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["create", "update"]
    )
    """Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:
     
     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355)."""
    storage_account_subscription_id: Optional[str] = rest_field(
        name="storageAccountSubscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage subscription Id."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.BlobAuditingPolicyState"],
        is_devops_audit_enabled: Optional[bool] = None,
        predicate_expression: Optional[str] = None,
        retention_days: Optional[int] = None,
        audit_actions_and_groups: Optional[list[str]] = None,
        is_storage_secondary_key_in_use: Optional[bool] = None,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        queue_delay_ms: Optional[int] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: 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 FailoverGroup(ProxyResource):
    """A failover group.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.FailoverGroupProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: Resource location.
    :vartype location: str
    """

    properties: Optional["_models.FailoverGroupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Resource location."""

    __flattened_items = [
        "read_write_endpoint",
        "read_only_endpoint",
        "replication_role",
        "replication_state",
        "partner_servers",
        "databases",
        "secondary_type",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.FailoverGroupProperties"] = 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 FailoverGroupProperties(_Model):
    """Properties of a failover group.

    :ivar read_write_endpoint: Read-write endpoint of the failover group instance. Required.
    :vartype read_write_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadWriteEndpoint
    :ivar read_only_endpoint: Read-only endpoint of the failover group instance.
    :vartype read_only_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadOnlyEndpoint
    :ivar replication_role: Local replication role of the failover group instance. Known values
     are: "Primary" and "Secondary".
    :vartype replication_role: str or ~azure.mgmt.sql.models.FailoverGroupReplicationRole
    :ivar replication_state: Replication state of the failover group instance.
    :vartype replication_state: str
    :ivar partner_servers: List of partner server information for the failover group. Required.
    :vartype partner_servers: list[~azure.mgmt.sql.models.PartnerInfo]
    :ivar databases: List of databases in the failover group.
    :vartype databases: list[str]
    :ivar secondary_type: Databases secondary type on partner server. Known values are: "Geo" and
     "Standby".
    :vartype secondary_type: str or ~azure.mgmt.sql.models.FailoverGroupDatabasesSecondaryType
    """

    read_write_endpoint: "_models.FailoverGroupReadWriteEndpoint" = rest_field(
        name="readWriteEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Read-write endpoint of the failover group instance. Required."""
    read_only_endpoint: Optional["_models.FailoverGroupReadOnlyEndpoint"] = rest_field(
        name="readOnlyEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Read-only endpoint of the failover group instance."""
    replication_role: Optional[Union[str, "_models.FailoverGroupReplicationRole"]] = rest_field(
        name="replicationRole", visibility=["read"]
    )
    """Local replication role of the failover group instance. Known values are: \"Primary\" and
     \"Secondary\"."""
    replication_state: Optional[str] = rest_field(name="replicationState", visibility=["read"])
    """Replication state of the failover group instance."""
    partner_servers: list["_models.PartnerInfo"] = rest_field(
        name="partnerServers", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of partner server information for the failover group. Required."""
    databases: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """List of databases in the failover group."""
    secondary_type: Optional[Union[str, "_models.FailoverGroupDatabasesSecondaryType"]] = rest_field(
        name="secondaryType", visibility=["create", "update"]
    )
    """Databases secondary type on partner server. Known values are: \"Geo\" and \"Standby\"."""

    @overload
    def __init__(
        self,
        *,
        read_write_endpoint: "_models.FailoverGroupReadWriteEndpoint",
        partner_servers: list["_models.PartnerInfo"],
        read_only_endpoint: Optional["_models.FailoverGroupReadOnlyEndpoint"] = None,
        databases: Optional[list[str]] = None,
        secondary_type: Optional[Union[str, "_models.FailoverGroupDatabasesSecondaryType"]] = 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 FailoverGroupReadOnlyEndpoint(_Model):
    """Read-only endpoint of the failover group instance.

    :ivar failover_policy: Failover policy of the read-only endpoint for the failover group. Known
     values are: "Disabled" and "Enabled".
    :vartype failover_policy: str or ~azure.mgmt.sql.models.ReadOnlyEndpointFailoverPolicy
    :ivar target_server: The target partner server where the read-only endpoint points to.
    :vartype target_server: str
    """

    failover_policy: Optional[Union[str, "_models.ReadOnlyEndpointFailoverPolicy"]] = rest_field(
        name="failoverPolicy", visibility=["read", "create", "update", "delete", "query"]
    )
    """Failover policy of the read-only endpoint for the failover group. Known values are:
     \"Disabled\" and \"Enabled\"."""
    target_server: Optional[str] = rest_field(
        name="targetServer", visibility=["read", "create", "update", "delete", "query"]
    )
    """The target partner server where the read-only endpoint points to."""

    @overload
    def __init__(
        self,
        *,
        failover_policy: Optional[Union[str, "_models.ReadOnlyEndpointFailoverPolicy"]] = None,
        target_server: 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 FailoverGroupReadWriteEndpoint(_Model):
    """Read-write endpoint of the failover group instance.

    :ivar failover_policy: Failover policy of the read-write endpoint for the failover group. If
     failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Required.
     Known values are: "Manual" and "Automatic".
    :vartype failover_policy: str or ~azure.mgmt.sql.models.ReadWriteEndpointFailoverPolicy
    :ivar failover_with_data_loss_grace_period_minutes: Grace period before failover with data loss
     is attempted for the read-write endpoint. If failoverPolicy is Automatic then
     failoverWithDataLossGracePeriodMinutes is required.
    :vartype failover_with_data_loss_grace_period_minutes: int
    """

    failover_policy: Union[str, "_models.ReadWriteEndpointFailoverPolicy"] = rest_field(
        name="failoverPolicy", visibility=["read", "create", "update", "delete", "query"]
    )
    """Failover policy of the read-write endpoint for the failover group. If failoverPolicy is
     Automatic then failoverWithDataLossGracePeriodMinutes is required. Required. Known values are:
     \"Manual\" and \"Automatic\"."""
    failover_with_data_loss_grace_period_minutes: Optional[int] = rest_field(
        name="failoverWithDataLossGracePeriodMinutes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Grace period before failover with data loss is attempted for the read-write endpoint. If
     failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required."""

    @overload
    def __init__(
        self,
        *,
        failover_policy: Union[str, "_models.ReadWriteEndpointFailoverPolicy"],
        failover_with_data_loss_grace_period_minutes: 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 FailoverGroupUpdate(_Model):
    """A failover group update request.

    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.FailoverGroupUpdateProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    properties: Optional["_models.FailoverGroupUpdateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = ["read_write_endpoint", "read_only_endpoint", "databases", "partner_servers", "secondary_type"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.FailoverGroupUpdateProperties"] = 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 FailoverGroupUpdateProperties(_Model):
    """Properties of a failover group update.

    :ivar read_write_endpoint: Read-write endpoint of the failover group instance.
    :vartype read_write_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadWriteEndpoint
    :ivar read_only_endpoint: Read-only endpoint of the failover group instance.
    :vartype read_only_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadOnlyEndpoint
    :ivar databases: List of databases in the failover group.
    :vartype databases: list[str]
    :ivar partner_servers: List of partner server information for the failover group.
    :vartype partner_servers: list[~azure.mgmt.sql.models.PartnerInfo]
    :ivar secondary_type: Databases secondary type on partner server. Known values are: "Geo" and
     "Standby".
    :vartype secondary_type: str or ~azure.mgmt.sql.models.FailoverGroupDatabasesSecondaryType
    """

    read_write_endpoint: Optional["_models.FailoverGroupReadWriteEndpoint"] = rest_field(
        name="readWriteEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Read-write endpoint of the failover group instance."""
    read_only_endpoint: Optional["_models.FailoverGroupReadOnlyEndpoint"] = rest_field(
        name="readOnlyEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Read-only endpoint of the failover group instance."""
    databases: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """List of databases in the failover group."""
    partner_servers: Optional[list["_models.PartnerInfo"]] = rest_field(
        name="partnerServers", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of partner server information for the failover group."""
    secondary_type: Optional[Union[str, "_models.FailoverGroupDatabasesSecondaryType"]] = rest_field(
        name="secondaryType", visibility=["create", "update"]
    )
    """Databases secondary type on partner server. Known values are: \"Geo\" and \"Standby\"."""

    @overload
    def __init__(
        self,
        *,
        read_write_endpoint: Optional["_models.FailoverGroupReadWriteEndpoint"] = None,
        read_only_endpoint: Optional["_models.FailoverGroupReadOnlyEndpoint"] = None,
        databases: Optional[list[str]] = None,
        partner_servers: Optional[list["_models.PartnerInfo"]] = None,
        secondary_type: Optional[Union[str, "_models.FailoverGroupDatabasesSecondaryType"]] = 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 ResourceWithWritableName(_Model):
    """ARM resource.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """Resource ID."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource name."""
    type: Optional[str] = rest_field(visibility=["read"])
    """Resource type."""

    @overload
    def __init__(
        self,
        *,
        name: 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 ProxyResourceWithWritableName(ResourceWithWritableName):
    """ARM proxy resource.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    """

    @overload
    def __init__(
        self,
        *,
        name: 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 FirewallRule(ProxyResourceWithWritableName):
    """A server firewall rule.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerFirewallRuleProperties
    """

    properties: Optional["_models.ServerFirewallRuleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["start_ip_address", "end_ip_address"]

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        properties: Optional["_models.ServerFirewallRuleProperties"] = 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 FirewallRuleList(_Model):
    """A list of server firewall rules.

    :ivar values_property:
    :vartype values_property: list[~azure.mgmt.sql.models.FirewallRule]
    """

    values_property: Optional[list["_models.FirewallRule"]] = rest_field(
        name="values", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="values"
    )

    @overload
    def __init__(
        self,
        *,
        values_property: Optional[list["_models.FirewallRule"]] = 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 FreeLimitExhaustionBehaviorCapability(_Model):
    """Supported free limit exhaustion behavior options.

    :ivar exhaustion_behavior_type: Free limit exhaustion behavior type. Known values are:
     "AutoPause" and "BillOverUsage".
    :vartype exhaustion_behavior_type: str or ~azure.mgmt.sql.models.FreeLimitExhaustionBehavior
    :ivar status: Free limit exhaustion behavior status. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    """

    exhaustion_behavior_type: Optional[Union[str, "_models.FreeLimitExhaustionBehavior"]] = rest_field(
        name="exhaustionBehaviorType", visibility=["read"]
    )
    """Free limit exhaustion behavior type. Known values are: \"AutoPause\" and \"BillOverUsage\"."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """Free limit exhaustion behavior status. Known values are: \"Visible\", \"Available\",
     \"Default\", and \"Disabled\"."""


class GeoBackupPolicy(ProxyResource):
    """A Geo backup policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.GeoBackupPolicyProperties
    :ivar location: Backup policy location.
    :vartype location: str
    :ivar kind: Kind of geo backup policy.  This is metadata used for the Azure portal experience.
    :vartype kind: str
    """

    properties: Optional["_models.GeoBackupPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Backup policy location."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Kind of geo backup policy.  This is metadata used for the Azure portal experience."""

    __flattened_items = ["state", "storage_type"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.GeoBackupPolicyProperties"] = 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 GeoBackupPolicyProperties(_Model):
    """The properties of the geo backup policy.

    :ivar state: The state of the geo backup policy. Required. Known values are: "Enabled" and
     "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.GeoBackupPolicyState
    :ivar storage_type: The storage type of the geo backup policy.
    :vartype storage_type: str
    """

    state: Union[str, "_models.GeoBackupPolicyState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The state of the geo backup policy. Required. Known values are: \"Enabled\" and \"Disabled\"."""
    storage_type: Optional[str] = rest_field(name="storageType", visibility=["read"])
    """The storage type of the geo backup policy."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.GeoBackupPolicyState"],
    ) -> 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 ImportExistingDatabaseDefinition(_Model):
    """Contains the information necessary to perform import operation for existing database.

    :ivar storage_key_type: Storage key type: StorageAccessKey, SharedAccessKey, or
     ManagedIdentity. Required. Known values are: "SharedAccessKey", "StorageAccessKey", and
     "ManagedIdentity".
    :vartype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
    :ivar storage_key: Storage key for the storage account. If StorageKeyType is ManagedIdentity,
     this field should specify the Managed Identity's resource ID. Required.
    :vartype storage_key: str
    :ivar storage_uri: Storage Uri. Required.
    :vartype storage_uri: str
    :ivar administrator_login: Administrator login name. If AuthenticationType is ManagedIdentity,
     this field should specify the Managed Identity's resource ID. Required.
    :vartype administrator_login: str
    :ivar administrator_login_password: Administrator login password. If AuthenticationType is
     ManagedIdentity, this field should not be specified.
    :vartype administrator_login_password: str
    :ivar authentication_type: Type of credentials provided for access to the target SQL server:
     SQL, ADPassword or ManagedIdentity.
    :vartype authentication_type: str
    :ivar network_isolation: Optional resource information to enable network isolation for request.
    :vartype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
    """

    storage_key_type: Union[str, "_models.StorageKeyType"] = rest_field(name="storageKeyType", visibility=["create"])
    """Storage key type: StorageAccessKey, SharedAccessKey, or ManagedIdentity. Required. Known values
     are: \"SharedAccessKey\", \"StorageAccessKey\", and \"ManagedIdentity\"."""
    storage_key: str = rest_field(name="storageKey", visibility=["create"])
    """Storage key for the storage account. If StorageKeyType is ManagedIdentity, this field should
     specify the Managed Identity's resource ID. Required."""
    storage_uri: str = rest_field(name="storageUri", visibility=["create"])
    """Storage Uri. Required."""
    administrator_login: str = rest_field(name="administratorLogin", visibility=["create"])
    """Administrator login name. If AuthenticationType is ManagedIdentity, this field should specify
     the Managed Identity's resource ID. Required."""
    administrator_login_password: Optional[str] = rest_field(name="administratorLoginPassword", visibility=["create"])
    """Administrator login password. If AuthenticationType is ManagedIdentity, this field should not
     be specified."""
    authentication_type: Optional[str] = rest_field(name="authenticationType", visibility=["create"])
    """Type of credentials provided for access to the target SQL server: SQL, ADPassword or
     ManagedIdentity."""
    network_isolation: Optional["_models.NetworkIsolationSettings"] = rest_field(
        name="networkIsolation", visibility=["create"]
    )
    """Optional resource information to enable network isolation for request."""

    @overload
    def __init__(
        self,
        *,
        storage_key_type: Union[str, "_models.StorageKeyType"],
        storage_key: str,
        storage_uri: str,
        administrator_login: str,
        administrator_login_password: Optional[str] = None,
        authentication_type: Optional[str] = None,
        network_isolation: Optional["_models.NetworkIsolationSettings"] = 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 ImportExportExtensionsOperationResult(ProxyResource):
    """An Extension operation result 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ImportExportExtensionsOperationResultProperties
    """

    properties: Optional["_models.ImportExportExtensionsOperationResultProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "request_id",
        "request_type",
        "last_modified_time",
        "server_name",
        "database_name",
        "status",
        "error_message",
        "queued_time",
        "blob_uri",
        "private_endpoint_connections",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ImportExportExtensionsOperationResultProperties"] = 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 ImportExportExtensionsOperationResultProperties(_Model):  # pylint: disable=name-too-long
    """Contains the operation result properties for import/export operation.

    :ivar request_id: Request Id.
    :vartype request_id: str
    :ivar request_type: Request type.
    :vartype request_type: str
    :ivar last_modified_time: Last modified time.
    :vartype last_modified_time: str
    :ivar server_name: Server name.
    :vartype server_name: str
    :ivar database_name: Database name.
    :vartype database_name: str
    :ivar status: Operation status.
    :vartype status: str
    :ivar error_message: Error message.
    :vartype error_message: str
    :ivar queued_time: Queued time.
    :vartype queued_time: str
    :ivar blob_uri: Blob URI.
    :vartype blob_uri: str
    :ivar private_endpoint_connections: Gets the status of private endpoints associated with this
     request.
    :vartype private_endpoint_connections:
     list[~azure.mgmt.sql.models.PrivateEndpointConnectionRequestStatus]
    """

    request_id: Optional[str] = rest_field(name="requestId", visibility=["read"])
    """Request Id."""
    request_type: Optional[str] = rest_field(name="requestType", visibility=["read"])
    """Request type."""
    last_modified_time: Optional[str] = rest_field(name="lastModifiedTime", visibility=["read"])
    """Last modified time."""
    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """Server name."""
    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """Database name."""
    status: Optional[str] = rest_field(visibility=["read"])
    """Operation status."""
    error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"])
    """Error message."""
    queued_time: Optional[str] = rest_field(name="queuedTime", visibility=["read"])
    """Queued time."""
    blob_uri: Optional[str] = rest_field(name="blobUri", visibility=["read"])
    """Blob URI."""
    private_endpoint_connections: Optional[list["_models.PrivateEndpointConnectionRequestStatus"]] = rest_field(
        name="privateEndpointConnections", visibility=["read"]
    )
    """Gets the status of private endpoints associated with this request."""


class ImportExportOperationResult(ProxyResource):
    """An ImportExport operation result 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ImportExportOperationResultProperties
    """

    properties: Optional["_models.ImportExportOperationResultProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "request_id",
        "request_type",
        "queued_time",
        "last_modified_time",
        "blob_uri",
        "server_name",
        "database_name",
        "status",
        "error_message",
        "private_endpoint_connections",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ImportExportOperationResultProperties"] = 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 ImportExportOperationResultProperties(_Model):
    """Contains the operation result properties for import/export operation.

    :ivar request_id: Request Id.
    :vartype request_id: str
    :ivar request_type: Request type.
    :vartype request_type: str
    :ivar queued_time: Queued time.
    :vartype queued_time: str
    :ivar last_modified_time: Last modified time.
    :vartype last_modified_time: str
    :ivar blob_uri: Blob Uri.
    :vartype blob_uri: str
    :ivar server_name: Server name.
    :vartype server_name: str
    :ivar database_name: Database name.
    :vartype database_name: str
    :ivar status: Operation status.
    :vartype status: str
    :ivar error_message: Error message.
    :vartype error_message: str
    :ivar private_endpoint_connections: Gets the status of private endpoints associated with this
     request.
    :vartype private_endpoint_connections:
     list[~azure.mgmt.sql.models.PrivateEndpointConnectionRequestStatus]
    """

    request_id: Optional[str] = rest_field(name="requestId", visibility=["read"])
    """Request Id."""
    request_type: Optional[str] = rest_field(name="requestType", visibility=["read"])
    """Request type."""
    queued_time: Optional[str] = rest_field(name="queuedTime", visibility=["read"])
    """Queued time."""
    last_modified_time: Optional[str] = rest_field(name="lastModifiedTime", visibility=["read"])
    """Last modified time."""
    blob_uri: Optional[str] = rest_field(name="blobUri", visibility=["read"])
    """Blob Uri."""
    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """Server name."""
    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """Database name."""
    status: Optional[str] = rest_field(visibility=["read"])
    """Operation status."""
    error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"])
    """Error message."""
    private_endpoint_connections: Optional[list["_models.PrivateEndpointConnectionRequestStatus"]] = rest_field(
        name="privateEndpointConnections", visibility=["read"]
    )
    """Gets the status of private endpoints associated with this request."""


class ImportNewDatabaseDefinition(_Model):
    """Contains the information necessary to perform import operation for new database.

    :ivar database_name: Name of the import database.
    :vartype database_name: str
    :ivar edition: Edition of the import database.
    :vartype edition: str
    :ivar service_objective_name: Service level objective name of the import database.
    :vartype service_objective_name: str
    :ivar max_size_bytes: Max size in bytes for the import database.
    :vartype max_size_bytes: str
    :ivar storage_key_type: Storage key type: StorageAccessKey, SharedAccessKey, or
     ManagedIdentity. Required. Known values are: "SharedAccessKey", "StorageAccessKey", and
     "ManagedIdentity".
    :vartype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
    :ivar storage_key: Storage key for the storage account. If StorageKeyType is ManagedIdentity,
     this field should specify the Managed Identity's resource ID. Required.
    :vartype storage_key: str
    :ivar storage_uri: Storage Uri. Required.
    :vartype storage_uri: str
    :ivar administrator_login: Administrator login name. If AuthenticationType is ManagedIdentity,
     this field should specify the Managed Identity's resource ID. Required.
    :vartype administrator_login: str
    :ivar administrator_login_password: Administrator login password. If AuthenticationType is
     ManagedIdentity, this field should not be specified.
    :vartype administrator_login_password: str
    :ivar authentication_type: Type of credentials provided for access to the target SQL server:
     SQL, ADPassword or ManagedIdentity.
    :vartype authentication_type: str
    :ivar network_isolation: Optional resource information to enable network isolation for request.
    :vartype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
    """

    database_name: Optional[str] = rest_field(name="databaseName", visibility=["create"])
    """Name of the import database."""
    edition: Optional[str] = rest_field(visibility=["create"])
    """Edition of the import database."""
    service_objective_name: Optional[str] = rest_field(name="serviceObjectiveName", visibility=["create"])
    """Service level objective name of the import database."""
    max_size_bytes: Optional[str] = rest_field(name="maxSizeBytes", visibility=["create"])
    """Max size in bytes for the import database."""
    storage_key_type: Union[str, "_models.StorageKeyType"] = rest_field(name="storageKeyType", visibility=["create"])
    """Storage key type: StorageAccessKey, SharedAccessKey, or ManagedIdentity. Required. Known values
     are: \"SharedAccessKey\", \"StorageAccessKey\", and \"ManagedIdentity\"."""
    storage_key: str = rest_field(name="storageKey", visibility=["create"])
    """Storage key for the storage account. If StorageKeyType is ManagedIdentity, this field should
     specify the Managed Identity's resource ID. Required."""
    storage_uri: str = rest_field(name="storageUri", visibility=["create"])
    """Storage Uri. Required."""
    administrator_login: str = rest_field(name="administratorLogin", visibility=["create"])
    """Administrator login name. If AuthenticationType is ManagedIdentity, this field should specify
     the Managed Identity's resource ID. Required."""
    administrator_login_password: Optional[str] = rest_field(name="administratorLoginPassword", visibility=["create"])
    """Administrator login password. If AuthenticationType is ManagedIdentity, this field should not
     be specified."""
    authentication_type: Optional[str] = rest_field(name="authenticationType", visibility=["create"])
    """Type of credentials provided for access to the target SQL server: SQL, ADPassword or
     ManagedIdentity."""
    network_isolation: Optional["_models.NetworkIsolationSettings"] = rest_field(
        name="networkIsolation", visibility=["create"]
    )
    """Optional resource information to enable network isolation for request."""

    @overload
    def __init__(
        self,
        *,
        storage_key_type: Union[str, "_models.StorageKeyType"],
        storage_key: str,
        storage_uri: str,
        administrator_login: str,
        database_name: Optional[str] = None,
        edition: Optional[str] = None,
        service_objective_name: Optional[str] = None,
        max_size_bytes: Optional[str] = None,
        administrator_login_password: Optional[str] = None,
        authentication_type: Optional[str] = None,
        network_isolation: Optional["_models.NetworkIsolationSettings"] = 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 InstanceFailoverGroup(ProxyResource):
    """An instance failover group.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.InstanceFailoverGroupProperties
    """

    properties: Optional["_models.InstanceFailoverGroupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "secondary_type",
        "read_write_endpoint",
        "read_only_endpoint",
        "replication_role",
        "replication_state",
        "partner_regions",
        "managed_instance_pairs",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.InstanceFailoverGroupProperties"] = 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 InstanceFailoverGroupProperties(_Model):
    """Properties of a instance failover group.

    :ivar secondary_type: Type of the geo-secondary instance. Set 'Standby' if the instance is used
     as a DR option only. Known values are: "Geo" and "Standby".
    :vartype secondary_type: str or ~azure.mgmt.sql.models.SecondaryInstanceType
    :ivar read_write_endpoint: Read-write endpoint of the failover group instance. Required.
    :vartype read_write_endpoint: ~azure.mgmt.sql.models.InstanceFailoverGroupReadWriteEndpoint
    :ivar read_only_endpoint: Read-only endpoint of the failover group instance.
    :vartype read_only_endpoint: ~azure.mgmt.sql.models.InstanceFailoverGroupReadOnlyEndpoint
    :ivar replication_role: Local replication role of the failover group instance. Known values
     are: "Primary" and "Secondary".
    :vartype replication_role: str or ~azure.mgmt.sql.models.InstanceFailoverGroupReplicationRole
    :ivar replication_state: Replication state of the failover group instance.
    :vartype replication_state: str
    :ivar partner_regions: Partner region information for the failover group. Required.
    :vartype partner_regions: list[~azure.mgmt.sql.models.PartnerRegionInfo]
    :ivar managed_instance_pairs: List of managed instance pairs in the failover group. Required.
    :vartype managed_instance_pairs: list[~azure.mgmt.sql.models.ManagedInstancePairInfo]
    """

    secondary_type: Optional[Union[str, "_models.SecondaryInstanceType"]] = rest_field(
        name="secondaryType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the geo-secondary instance. Set 'Standby' if the instance is used as a DR option only.
     Known values are: \"Geo\" and \"Standby\"."""
    read_write_endpoint: "_models.InstanceFailoverGroupReadWriteEndpoint" = rest_field(
        name="readWriteEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Read-write endpoint of the failover group instance. Required."""
    read_only_endpoint: Optional["_models.InstanceFailoverGroupReadOnlyEndpoint"] = rest_field(
        name="readOnlyEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Read-only endpoint of the failover group instance."""
    replication_role: Optional[Union[str, "_models.InstanceFailoverGroupReplicationRole"]] = rest_field(
        name="replicationRole", visibility=["read"]
    )
    """Local replication role of the failover group instance. Known values are: \"Primary\" and
     \"Secondary\"."""
    replication_state: Optional[str] = rest_field(name="replicationState", visibility=["read"])
    """Replication state of the failover group instance."""
    partner_regions: list["_models.PartnerRegionInfo"] = rest_field(
        name="partnerRegions", visibility=["read", "create"]
    )
    """Partner region information for the failover group. Required."""
    managed_instance_pairs: list["_models.ManagedInstancePairInfo"] = rest_field(
        name="managedInstancePairs", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of managed instance pairs in the failover group. Required."""

    @overload
    def __init__(
        self,
        *,
        read_write_endpoint: "_models.InstanceFailoverGroupReadWriteEndpoint",
        partner_regions: list["_models.PartnerRegionInfo"],
        managed_instance_pairs: list["_models.ManagedInstancePairInfo"],
        secondary_type: Optional[Union[str, "_models.SecondaryInstanceType"]] = None,
        read_only_endpoint: Optional["_models.InstanceFailoverGroupReadOnlyEndpoint"] = 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 InstanceFailoverGroupReadOnlyEndpoint(_Model):
    """Read-only endpoint of the failover group instance.

    :ivar failover_policy: Failover policy of the read-only endpoint for the failover group. Known
     values are: "Disabled" and "Enabled".
    :vartype failover_policy: str or ~azure.mgmt.sql.models.ReadOnlyEndpointFailoverPolicy
    """

    failover_policy: Optional[Union[str, "_models.ReadOnlyEndpointFailoverPolicy"]] = rest_field(
        name="failoverPolicy", visibility=["read", "create", "update", "delete", "query"]
    )
    """Failover policy of the read-only endpoint for the failover group. Known values are:
     \"Disabled\" and \"Enabled\"."""

    @overload
    def __init__(
        self,
        *,
        failover_policy: Optional[Union[str, "_models.ReadOnlyEndpointFailoverPolicy"]] = 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 InstanceFailoverGroupReadWriteEndpoint(_Model):
    """Read-write endpoint of the failover group instance.

    :ivar failover_policy: Failover policy of the read-write endpoint for the failover group. If
     failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Required.
     Known values are: "Manual" and "Automatic".
    :vartype failover_policy: str or ~azure.mgmt.sql.models.ReadWriteEndpointFailoverPolicy
    :ivar failover_with_data_loss_grace_period_minutes: Grace period before failover with data loss
     is attempted for the read-write endpoint. If failoverPolicy is Automatic then
     failoverWithDataLossGracePeriodMinutes is required.
    :vartype failover_with_data_loss_grace_period_minutes: int
    """

    failover_policy: Union[str, "_models.ReadWriteEndpointFailoverPolicy"] = rest_field(
        name="failoverPolicy", visibility=["read", "create", "update", "delete", "query"]
    )
    """Failover policy of the read-write endpoint for the failover group. If failoverPolicy is
     Automatic then failoverWithDataLossGracePeriodMinutes is required. Required. Known values are:
     \"Manual\" and \"Automatic\"."""
    failover_with_data_loss_grace_period_minutes: Optional[int] = rest_field(
        name="failoverWithDataLossGracePeriodMinutes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Grace period before failover with data loss is attempted for the read-write endpoint. If
     failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required."""

    @overload
    def __init__(
        self,
        *,
        failover_policy: Union[str, "_models.ReadWriteEndpointFailoverPolicy"],
        failover_with_data_loss_grace_period_minutes: 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 InstancePool(TrackedResource):
    """An Azure SQL instance pool.

    :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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.InstancePoolProperties
    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    """

    properties: Optional["_models.InstancePoolProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name and tier of the SKU."""

    __flattened_items = ["subnet_id", "v_cores", "license_type", "dns_zone", "maintenance_configuration_id"]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.InstancePoolProperties"] = None,
        sku: Optional["_models.Sku"] = 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 InstancePoolEditionCapability(_Model):
    """The instance pool capability.

    :ivar name: The instance pool version name.
    :vartype name: str
    :ivar supported_families: The supported families.
    :vartype supported_families: list[~azure.mgmt.sql.models.InstancePoolFamilyCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The instance pool version name."""
    supported_families: Optional[list["_models.InstancePoolFamilyCapability"]] = rest_field(
        name="supportedFamilies", visibility=["read"]
    )
    """The supported families."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 InstancePoolFamilyCapability(_Model):
    """The instance pool family capability.

    :ivar name: Family name.
    :vartype name: str
    :ivar supported_license_types: List of supported license types.
    :vartype supported_license_types: list[~azure.mgmt.sql.models.LicenseTypeCapability]
    :ivar supported_vcores_values: List of supported virtual cores values.
    :vartype supported_vcores_values: list[~azure.mgmt.sql.models.InstancePoolVcoresCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """Family name."""
    supported_license_types: Optional[list["_models.LicenseTypeCapability"]] = rest_field(
        name="supportedLicenseTypes", visibility=["read"]
    )
    """List of supported license types."""
    supported_vcores_values: Optional[list["_models.InstancePoolVcoresCapability"]] = rest_field(
        name="supportedVcoresValues", visibility=["read"]
    )
    """List of supported virtual cores values."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 InstancePoolOperation(ProxyResource):
    """A instance pool operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.InstancePoolOperationProperties
    """

    properties: Optional["_models.InstancePoolOperationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "instance_pool_name",
        "operation",
        "operation_friendly_name",
        "percent_complete",
        "start_time",
        "state",
        "error_code",
        "error_description",
        "error_severity",
        "error_type",
        "estimated_completion_time",
        "description",
        "is_cancellable",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.InstancePoolOperationProperties"] = 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 InstancePoolOperationProperties(_Model):
    """The properties of a instance pool operation.

    :ivar instance_pool_name: The name of the instance pool the operation is being performed on.
    :vartype instance_pool_name: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar error_type: Error type (e.g. None, User). Known values are: "None" and "User".
    :vartype error_type: str or ~azure.mgmt.sql.models.ErrorType
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    """

    instance_pool_name: Optional[str] = rest_field(name="instancePoolName", visibility=["read"])
    """The name of the instance pool the operation is being performed on."""
    operation: Optional[str] = rest_field(visibility=["read"])
    """The name of operation."""
    operation_friendly_name: Optional[str] = rest_field(name="operationFriendlyName", visibility=["read"])
    """The friendly name of operation."""
    percent_complete: Optional[int] = rest_field(name="percentComplete", visibility=["read"])
    """The percentage of the operation completed."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The operation start time."""
    state: Optional[Union[str, "_models.ManagementOperationState"]] = rest_field(visibility=["read"])
    """The operation state. Known values are: \"Pending\", \"InProgress\", \"Succeeded\", \"Failed\",
     \"CancelInProgress\", and \"Cancelled\"."""
    error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"])
    """The operation error code."""
    error_description: Optional[str] = rest_field(name="errorDescription", visibility=["read"])
    """The operation error description."""
    error_severity: Optional[int] = rest_field(name="errorSeverity", visibility=["read"])
    """The operation error severity."""
    error_type: Optional[Union[str, "_models.ErrorType"]] = rest_field(name="errorType", visibility=["read"])
    """Error type (e.g. None, User). Known values are: \"None\" and \"User\"."""
    estimated_completion_time: Optional[datetime.datetime] = rest_field(
        name="estimatedCompletionTime", visibility=["read"], format="rfc3339"
    )
    """The estimated completion time of the operation."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The operation description."""
    is_cancellable: Optional[bool] = rest_field(name="isCancellable", visibility=["read"])
    """Whether the operation can be cancelled."""


class InstancePoolProperties(_Model):
    """Properties of an instance pool.

    :ivar subnet_id: Resource ID of the subnet to place this instance pool in. Required.
    :vartype subnet_id: str
    :ivar v_cores: Count of vCores belonging to this instance pool. Required.
    :vartype v_cores: int
    :ivar license_type: The license type. Possible values are 'LicenseIncluded' (price for SQL
     license is included) and 'BasePrice' (without SQL license price). Required. Known values are:
     "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.InstancePoolLicenseType
    :ivar dns_zone: The Dns Zone that the managed instance pool is in.
    :vartype dns_zone: str
    :ivar maintenance_configuration_id: Specifies maintenance configuration id to apply to this
     managed instance.
    :vartype maintenance_configuration_id: str
    """

    subnet_id: str = rest_field(name="subnetId", visibility=["read", "create"])
    """Resource ID of the subnet to place this instance pool in. Required."""
    v_cores: int = rest_field(name="vCores", visibility=["read", "create", "update", "delete", "query"])
    """Count of vCores belonging to this instance pool. Required."""
    license_type: Union[str, "_models.InstancePoolLicenseType"] = rest_field(
        name="licenseType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and
     'BasePrice' (without SQL license price). Required. Known values are: \"LicenseIncluded\" and
     \"BasePrice\"."""
    dns_zone: Optional[str] = rest_field(name="dnsZone", visibility=["read"])
    """The Dns Zone that the managed instance pool is in."""
    maintenance_configuration_id: Optional[str] = rest_field(
        name="maintenanceConfigurationId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies maintenance configuration id to apply to this managed instance."""

    @overload
    def __init__(
        self,
        *,
        subnet_id: str,
        v_cores: int,
        license_type: Union[str, "_models.InstancePoolLicenseType"],
        maintenance_configuration_id: 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 InstancePoolUpdate(_Model):
    """An update to an Instance pool.

    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.InstancePoolProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name and tier of the SKU."""
    properties: Optional["_models.InstancePoolProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = ["subnet_id", "v_cores", "license_type", "dns_zone", "maintenance_configuration_id"]

    @overload
    def __init__(
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        properties: Optional["_models.InstancePoolProperties"] = 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 InstancePoolVcoresCapability(_Model):
    """The managed instance virtual cores capability.

    :ivar name: The virtual cores identifier.
    :vartype name: str
    :ivar value: The virtual cores value.
    :vartype value: int
    :ivar storage_limit: Storage limit.
    :vartype storage_limit: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The virtual cores identifier."""
    value: Optional[int] = rest_field(visibility=["read"])
    """The virtual cores value."""
    storage_limit: Optional["_models.MaxSizeCapability"] = rest_field(name="storageLimit", visibility=["read"])
    """Storage limit."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 IPv6FirewallRule(ProxyResourceWithWritableName):
    """An IPv6 server firewall rule.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.IPv6ServerFirewallRuleProperties
    """

    properties: Optional["_models.IPv6ServerFirewallRuleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["start_i_pv6_address", "end_i_pv6_address"]

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        properties: Optional["_models.IPv6ServerFirewallRuleProperties"] = 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 IPv6ServerFirewallRuleProperties(_Model):
    """The properties of an IPv6 server firewall rule.

    :ivar start_i_pv6_address: The start IP address of the firewall rule. Must be IPv6 format.
    :vartype start_i_pv6_address: str
    :ivar end_i_pv6_address: The end IP address of the firewall rule. Must be IPv6 format. Must be
     greater than or equal to startIpv6Address.
    :vartype end_i_pv6_address: str
    """

    start_i_pv6_address: Optional[str] = rest_field(
        name="startIPv6Address", visibility=["read", "create", "update", "delete", "query"]
    )
    """The start IP address of the firewall rule. Must be IPv6 format."""
    end_i_pv6_address: Optional[str] = rest_field(
        name="endIPv6Address", visibility=["read", "create", "update", "delete", "query"]
    )
    """The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to
     startIpv6Address."""

    @overload
    def __init__(
        self,
        *,
        start_i_pv6_address: Optional[str] = None,
        end_i_pv6_address: 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 Job(ProxyResource):
    """A job.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.JobProperties
    """

    properties: Optional["_models.JobProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["description", "version", "schedule"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.JobProperties"] = 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 JobAgent(TrackedResource):
    """An Azure SQL job agent.

    :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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.JobAgentProperties
    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar identity: The identity of the job agent.
    :vartype identity: ~azure.mgmt.sql.models.JobAgentIdentity
    """

    properties: Optional["_models.JobAgentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name and tier of the SKU."""
    identity: Optional["_models.JobAgentIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The identity of the job agent."""

    __flattened_items = ["database_id", "state"]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.JobAgentProperties"] = None,
        sku: Optional["_models.Sku"] = None,
        identity: Optional["_models.JobAgentIdentity"] = 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 JobAgentEditionCapability(_Model):
    """The job agent edition capability.

    :ivar name: The job agent edition name.
    :vartype name: str
    :ivar supported_service_level_objectives: The list of supported service level objectives for
     the edition.
    :vartype supported_service_level_objectives:
     list[~azure.mgmt.sql.models.JobAgentServiceLevelObjectiveCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The job agent edition name."""
    supported_service_level_objectives: Optional[list["_models.JobAgentServiceLevelObjectiveCapability"]] = rest_field(
        name="supportedServiceLevelObjectives", visibility=["read"]
    )
    """The list of supported service level objectives for the edition."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 JobAgentIdentity(_Model):
    """Azure Active Directory identity configuration for a resource.

    :ivar tenant_id: The job agent identity tenant id.
    :vartype tenant_id: str
    :ivar type: The job agent identity type. Required. Known values are: "None", "SystemAssigned",
     "UserAssigned", and "SystemAssignedUserAssigned".
    :vartype type: str or ~azure.mgmt.sql.models.JobAgentIdentityType
    :ivar user_assigned_identities: The resource ids of the user assigned identities to use.
    :vartype user_assigned_identities: dict[str,
     ~azure.mgmt.sql.models.JobAgentUserAssignedIdentity]
    """

    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"])
    """The job agent identity tenant id."""
    type: Union[str, "_models.JobAgentIdentityType"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The job agent identity type. Required. Known values are: \"None\", \"SystemAssigned\",
     \"UserAssigned\", and \"SystemAssignedUserAssigned\"."""
    user_assigned_identities: Optional[dict[str, "_models.JobAgentUserAssignedIdentity"]] = rest_field(
        name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource ids of the user assigned identities to use."""

    @overload
    def __init__(
        self,
        *,
        type: Union[str, "_models.JobAgentIdentityType"],
        tenant_id: Optional[str] = None,
        user_assigned_identities: Optional[dict[str, "_models.JobAgentUserAssignedIdentity"]] = 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 JobAgentProperties(_Model):
    """Properties of a job agent.

    :ivar database_id: Resource ID of the database to store job metadata in. Required.
    :vartype database_id: str
    :ivar state: The state of the job agent. Known values are: "Creating", "Ready", "Updating",
     "Deleting", and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.JobAgentState
    """

    database_id: str = rest_field(name="databaseId", visibility=["read", "create"])
    """Resource ID of the database to store job metadata in. Required."""
    state: Optional[Union[str, "_models.JobAgentState"]] = rest_field(visibility=["read"])
    """The state of the job agent. Known values are: \"Creating\", \"Ready\", \"Updating\",
     \"Deleting\", and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        database_id: str,
    ) -> 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 JobAgentServiceLevelObjectiveCapability(_Model):
    """The job agent service level objective capability.

    :ivar name: The service objective name.
    :vartype name: str
    :ivar sku: The sku.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The service objective name."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read"])
    """The sku."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 JobAgentUpdate(_Model):
    """An update to an Azure SQL job agent.

    :ivar identity: Managed identity assigned to job agent.
    :vartype identity: ~azure.mgmt.sql.models.JobAgentIdentity
    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    identity: Optional["_models.JobAgentIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed identity assigned to job agent."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name and tier of the SKU."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    @overload
    def __init__(
        self,
        *,
        identity: Optional["_models.JobAgentIdentity"] = None,
        sku: Optional["_models.Sku"] = 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:
        super().__init__(*args, **kwargs)


class JobAgentUserAssignedIdentity(_Model):
    """Azure Active Directory identity configuration for a resource.

    :ivar principal_id: The Azure Active Directory principal id.
    :vartype principal_id: str
    :ivar client_id: The Azure Active Directory client id.
    :vartype client_id: str
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The Azure Active Directory principal id."""
    client_id: Optional[str] = rest_field(name="clientId", visibility=["read"])
    """The Azure Active Directory client id."""


class JobAgentVersionCapability(_Model):
    """The job agent version capability.

    :ivar name: The job agent version name.
    :vartype name: str
    :ivar supported_editions: The list of supported editions.
    :vartype supported_editions: list[~azure.mgmt.sql.models.JobAgentEditionCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The job agent version name."""
    supported_editions: Optional[list["_models.JobAgentEditionCapability"]] = rest_field(
        name="supportedEditions", visibility=["read"]
    )
    """The list of supported editions."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 JobCredential(ProxyResource):
    """A stored credential that can be used by a job to connect to target databases.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.JobCredentialProperties
    """

    properties: Optional["_models.JobCredentialProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["username", "password"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.JobCredentialProperties"] = 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 JobCredentialProperties(_Model):
    """Properties of a job credential.

    :ivar username: The credential user name. Required.
    :vartype username: str
    :ivar password: The credential password. Required.
    :vartype password: str
    """

    username: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The credential user name. Required."""
    password: str = rest_field(visibility=["create", "update"])
    """The credential password. Required."""

    @overload
    def __init__(
        self,
        *,
        username: str,
        password: str,
    ) -> 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 JobExecution(ProxyResource):
    """An execution of a job.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.JobExecutionProperties
    """

    properties: Optional["_models.JobExecutionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "job_version",
        "step_name",
        "step_id",
        "job_execution_id",
        "lifecycle",
        "provisioning_state",
        "create_time",
        "start_time",
        "end_time",
        "current_attempts",
        "current_attempt_start_time",
        "last_message",
        "target",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.JobExecutionProperties"] = 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 JobExecutionProperties(_Model):
    """Properties for an Azure SQL Database Elastic job execution.

    :ivar job_version: The job version number.
    :vartype job_version: int
    :ivar step_name: The job step name.
    :vartype step_name: str
    :ivar step_id: The job step id.
    :vartype step_id: int
    :ivar job_execution_id: The unique identifier of the job execution.
    :vartype job_execution_id: str
    :ivar lifecycle: The detailed state of the job execution. Known values are: "Created",
     "InProgress", "WaitingForChildJobExecutions", "WaitingForRetry", "Succeeded",
     "SucceededWithSkipped", "Failed", "TimedOut", "Canceled", and "Skipped".
    :vartype lifecycle: str or ~azure.mgmt.sql.models.JobExecutionLifecycle
    :ivar provisioning_state: The ARM provisioning state of the job execution. Known values are:
     "Created", "InProgress", "Succeeded", "Failed", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.ProvisioningState
    :ivar create_time: The time that the job execution was created.
    :vartype create_time: ~datetime.datetime
    :ivar start_time: The time that the job execution started.
    :vartype start_time: ~datetime.datetime
    :ivar end_time: The time that the job execution completed.
    :vartype end_time: ~datetime.datetime
    :ivar current_attempts: Number of times the job execution has been attempted.
    :vartype current_attempts: int
    :ivar current_attempt_start_time: Start time of the current attempt.
    :vartype current_attempt_start_time: ~datetime.datetime
    :ivar last_message: The last status or error message.
    :vartype last_message: str
    :ivar target: The target that this execution is executed on.
    :vartype target: ~azure.mgmt.sql.models.JobExecutionTarget
    """

    job_version: Optional[int] = rest_field(name="jobVersion", visibility=["read"])
    """The job version number."""
    step_name: Optional[str] = rest_field(name="stepName", visibility=["read"])
    """The job step name."""
    step_id: Optional[int] = rest_field(name="stepId", visibility=["read"])
    """The job step id."""
    job_execution_id: Optional[str] = rest_field(name="jobExecutionId", visibility=["read"])
    """The unique identifier of the job execution."""
    lifecycle: Optional[Union[str, "_models.JobExecutionLifecycle"]] = rest_field(visibility=["read"])
    """The detailed state of the job execution. Known values are: \"Created\", \"InProgress\",
     \"WaitingForChildJobExecutions\", \"WaitingForRetry\", \"Succeeded\", \"SucceededWithSkipped\",
     \"Failed\", \"TimedOut\", \"Canceled\", and \"Skipped\"."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """The ARM provisioning state of the job execution. Known values are: \"Created\", \"InProgress\",
     \"Succeeded\", \"Failed\", and \"Canceled\"."""
    create_time: Optional[datetime.datetime] = rest_field(name="createTime", visibility=["read"], format="rfc3339")
    """The time that the job execution was created."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The time that the job execution started."""
    end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339")
    """The time that the job execution completed."""
    current_attempts: Optional[int] = rest_field(
        name="currentAttempts", visibility=["read", "create", "update", "delete", "query"]
    )
    """Number of times the job execution has been attempted."""
    current_attempt_start_time: Optional[datetime.datetime] = rest_field(
        name="currentAttemptStartTime", visibility=["read"], format="rfc3339"
    )
    """Start time of the current attempt."""
    last_message: Optional[str] = rest_field(name="lastMessage", visibility=["read"])
    """The last status or error message."""
    target: Optional["_models.JobExecutionTarget"] = rest_field(visibility=["read"])
    """The target that this execution is executed on."""

    @overload
    def __init__(
        self,
        *,
        current_attempts: 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 JobExecutionTarget(_Model):
    """The target that a job execution is executed on.

    :ivar type: The type of the target. Known values are: "TargetGroup", "SqlDatabase",
     "SqlElasticPool", "SqlShardMap", and "SqlServer".
    :vartype type: str or ~azure.mgmt.sql.models.JobTargetType
    :ivar server_name: The server name.
    :vartype server_name: str
    :ivar database_name: The database name.
    :vartype database_name: str
    """

    type: Optional[Union[str, "_models.JobTargetType"]] = rest_field(visibility=["read"])
    """The type of the target. Known values are: \"TargetGroup\", \"SqlDatabase\", \"SqlElasticPool\",
     \"SqlShardMap\", and \"SqlServer\"."""
    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """The server name."""
    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """The database name."""


class JobPrivateEndpoint(ProxyResource):
    """A job agent private endpoint.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.JobPrivateEndpointProperties
    """

    properties: Optional["_models.JobPrivateEndpointProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["target_server_azure_resource_id", "private_endpoint_id"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.JobPrivateEndpointProperties"] = 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 JobPrivateEndpointProperties(_Model):
    """Properties of job agent private endpoint.

    :ivar target_server_azure_resource_id: ARM resource id of the server the private endpoint will
     target. Required.
    :vartype target_server_azure_resource_id: str
    :ivar private_endpoint_id: Private endpoint id of the private endpoint.
    :vartype private_endpoint_id: str
    """

    target_server_azure_resource_id: str = rest_field(
        name="targetServerAzureResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """ARM resource id of the server the private endpoint will target. Required."""
    private_endpoint_id: Optional[str] = rest_field(name="privateEndpointId", visibility=["read"])
    """Private endpoint id of the private endpoint."""

    @overload
    def __init__(
        self,
        *,
        target_server_azure_resource_id: str,
    ) -> 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 JobProperties(_Model):
    """Properties of a job.

    :ivar description: User-defined description of the job.
    :vartype description: str
    :ivar version: The job version number.
    :vartype version: int
    :ivar schedule: Schedule properties of the job.
    :vartype schedule: ~azure.mgmt.sql.models.JobSchedule
    """

    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """User-defined description of the job."""
    version: Optional[int] = rest_field(visibility=["read"])
    """The job version number."""
    schedule: Optional["_models.JobSchedule"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Schedule properties of the job."""

    @overload
    def __init__(
        self,
        *,
        description: Optional[str] = None,
        schedule: Optional["_models.JobSchedule"] = 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 JobSchedule(_Model):
    """Scheduling properties of a job.

    :ivar start_time: Schedule start time.
    :vartype start_time: ~datetime.datetime
    :ivar end_time: Schedule end time.
    :vartype end_time: ~datetime.datetime
    :ivar type: Schedule interval type. Known values are: "Once" and "Recurring".
    :vartype type: str or ~azure.mgmt.sql.models.JobScheduleType
    :ivar enabled: Whether or not the schedule is enabled.
    :vartype enabled: bool
    :ivar interval: Value of the schedule's recurring interval, if the ScheduleType is recurring.
     ISO8601 duration format.
    :vartype interval: str
    """

    start_time: Optional[datetime.datetime] = rest_field(
        name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Schedule start time."""
    end_time: Optional[datetime.datetime] = rest_field(
        name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Schedule end time."""
    type: Optional[Union[str, "_models.JobScheduleType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Schedule interval type. Known values are: \"Once\" and \"Recurring\"."""
    enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Whether or not the schedule is enabled."""
    interval: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Value of the schedule's recurring interval, if the ScheduleType is recurring. ISO8601 duration
     format."""

    @overload
    def __init__(
        self,
        *,
        start_time: Optional[datetime.datetime] = None,
        end_time: Optional[datetime.datetime] = None,
        type: Optional[Union[str, "_models.JobScheduleType"]] = None,
        enabled: Optional[bool] = None,
        interval: 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 JobStep(ProxyResource):
    """A job step.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.JobStepProperties
    """

    properties: Optional["_models.JobStepProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["step_id", "target_group", "credential", "action", "output", "execution_options"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.JobStepProperties"] = 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 JobStepAction(_Model):
    """The action to be executed by a job step.

    :ivar type: Type of action being executed by the job step. "TSql"
    :vartype type: str or ~azure.mgmt.sql.models.JobStepActionType
    :ivar source: The source of the action to execute. "Inline"
    :vartype source: str or ~azure.mgmt.sql.models.JobStepActionSource
    :ivar value: The action value, for example the text of the T-SQL script to execute. Required.
    :vartype value: str
    """

    type: Optional[Union[str, "_models.JobStepActionType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of action being executed by the job step. \"TSql\""""
    source: Optional[Union[str, "_models.JobStepActionSource"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The source of the action to execute. \"Inline\""""
    value: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The action value, for example the text of the T-SQL script to execute. Required."""

    @overload
    def __init__(
        self,
        *,
        value: str,
        type: Optional[Union[str, "_models.JobStepActionType"]] = None,
        source: Optional[Union[str, "_models.JobStepActionSource"]] = 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 JobStepExecutionOptions(_Model):
    """The execution options of a job step.

    :ivar timeout_seconds: Execution timeout for the job step.
    :vartype timeout_seconds: int
    :ivar retry_attempts: Maximum number of times the job step will be reattempted if the first
     attempt fails.
    :vartype retry_attempts: int
    :ivar initial_retry_interval_seconds: Initial delay between retries for job step execution.
    :vartype initial_retry_interval_seconds: int
    :ivar maximum_retry_interval_seconds: The maximum amount of time to wait between retries for
     job step execution.
    :vartype maximum_retry_interval_seconds: int
    :ivar retry_interval_backoff_multiplier: The backoff multiplier for the time between retries.
    :vartype retry_interval_backoff_multiplier: float
    """

    timeout_seconds: Optional[int] = rest_field(
        name="timeoutSeconds", visibility=["read", "create", "update", "delete", "query"]
    )
    """Execution timeout for the job step."""
    retry_attempts: Optional[int] = rest_field(
        name="retryAttempts", visibility=["read", "create", "update", "delete", "query"]
    )
    """Maximum number of times the job step will be reattempted if the first attempt fails."""
    initial_retry_interval_seconds: Optional[int] = rest_field(
        name="initialRetryIntervalSeconds", visibility=["read", "create", "update", "delete", "query"]
    )
    """Initial delay between retries for job step execution."""
    maximum_retry_interval_seconds: Optional[int] = rest_field(
        name="maximumRetryIntervalSeconds", visibility=["read", "create", "update", "delete", "query"]
    )
    """The maximum amount of time to wait between retries for job step execution."""
    retry_interval_backoff_multiplier: Optional[float] = rest_field(
        name="retryIntervalBackoffMultiplier", visibility=["read", "create", "update", "delete", "query"]
    )
    """The backoff multiplier for the time between retries."""

    @overload
    def __init__(
        self,
        *,
        timeout_seconds: Optional[int] = None,
        retry_attempts: Optional[int] = None,
        initial_retry_interval_seconds: Optional[int] = None,
        maximum_retry_interval_seconds: Optional[int] = None,
        retry_interval_backoff_multiplier: 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 JobStepOutput(_Model):
    """The output configuration of a job step.

    :ivar type: The output destination type. "SqlDatabase"
    :vartype type: str or ~azure.mgmt.sql.models.JobStepOutputType
    :ivar subscription_id: The output destination subscription id.
    :vartype subscription_id: str
    :ivar resource_group_name: The output destination resource group.
    :vartype resource_group_name: str
    :ivar server_name: The output destination server name. Required.
    :vartype server_name: str
    :ivar database_name: The output destination database. Required.
    :vartype database_name: str
    :ivar schema_name: The output destination schema.
    :vartype schema_name: str
    :ivar table_name: The output destination table. Required.
    :vartype table_name: str
    :ivar credential: The resource ID of the credential to use to connect to the output
     destination.
    :vartype credential: str
    """

    type: Optional[Union[str, "_models.JobStepOutputType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The output destination type. \"SqlDatabase\""""
    subscription_id: Optional[str] = rest_field(
        name="subscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The output destination subscription id."""
    resource_group_name: Optional[str] = rest_field(
        name="resourceGroupName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The output destination resource group."""
    server_name: str = rest_field(name="serverName", visibility=["read", "create", "update", "delete", "query"])
    """The output destination server name. Required."""
    database_name: str = rest_field(name="databaseName", visibility=["read", "create", "update", "delete", "query"])
    """The output destination database. Required."""
    schema_name: Optional[str] = rest_field(
        name="schemaName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The output destination schema."""
    table_name: str = rest_field(name="tableName", visibility=["read", "create", "update", "delete", "query"])
    """The output destination table. Required."""
    credential: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource ID of the credential to use to connect to the output destination."""

    @overload
    def __init__(
        self,
        *,
        server_name: str,
        database_name: str,
        table_name: str,
        type: Optional[Union[str, "_models.JobStepOutputType"]] = None,
        subscription_id: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        schema_name: Optional[str] = None,
        credential: 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 JobStepProperties(_Model):
    """Properties of a job step.

    :ivar step_id: The job step's index within the job. If not specified when creating the job
     step, it will be created as the last step. If not specified when updating the job step, the
     step id is not modified.
    :vartype step_id: int
    :ivar target_group: The resource ID of the target group that the job step will be executed on.
     Required.
    :vartype target_group: str
    :ivar credential: The resource ID of the job credential that will be used to connect to the
     targets.
    :vartype credential: str
    :ivar action: The action payload of the job step. Required.
    :vartype action: ~azure.mgmt.sql.models.JobStepAction
    :ivar output: Output destination properties of the job step.
    :vartype output: ~azure.mgmt.sql.models.JobStepOutput
    :ivar execution_options: Execution options for the job step.
    :vartype execution_options: ~azure.mgmt.sql.models.JobStepExecutionOptions
    """

    step_id: Optional[int] = rest_field(name="stepId", visibility=["read", "create", "update", "delete", "query"])
    """The job step's index within the job. If not specified when creating the job step, it will be
     created as the last step. If not specified when updating the job step, the step id is not
     modified."""
    target_group: str = rest_field(name="targetGroup", visibility=["read", "create", "update", "delete", "query"])
    """The resource ID of the target group that the job step will be executed on. Required."""
    credential: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource ID of the job credential that will be used to connect to the targets."""
    action: "_models.JobStepAction" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The action payload of the job step. Required."""
    output: Optional["_models.JobStepOutput"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Output destination properties of the job step."""
    execution_options: Optional["_models.JobStepExecutionOptions"] = rest_field(
        name="executionOptions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Execution options for the job step."""

    @overload
    def __init__(
        self,
        *,
        target_group: str,
        action: "_models.JobStepAction",
        step_id: Optional[int] = None,
        credential: Optional[str] = None,
        output: Optional["_models.JobStepOutput"] = None,
        execution_options: Optional["_models.JobStepExecutionOptions"] = 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 JobTarget(_Model):
    """A job target, for example a specific database or a container of databases that is evaluated
    during job execution.

    :ivar membership_type: Whether the target is included or excluded from the group. Known values
     are: "Include" and "Exclude".
    :vartype membership_type: str or ~azure.mgmt.sql.models.JobTargetGroupMembershipType
    :ivar type: The target type. Required. Known values are: "TargetGroup", "SqlDatabase",
     "SqlElasticPool", "SqlShardMap", and "SqlServer".
    :vartype type: str or ~azure.mgmt.sql.models.JobTargetType
    :ivar server_name: The target server name.
    :vartype server_name: str
    :ivar database_name: The target database name.
    :vartype database_name: str
    :ivar elastic_pool_name: The target elastic pool name.
    :vartype elastic_pool_name: str
    :ivar shard_map_name: The target shard map.
    :vartype shard_map_name: str
    :ivar refresh_credential: The resource ID of the credential that is used during job execution
     to connect to the target and determine the list of databases inside the target.
    :vartype refresh_credential: str
    """

    membership_type: Optional[Union[str, "_models.JobTargetGroupMembershipType"]] = rest_field(
        name="membershipType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether the target is included or excluded from the group. Known values are: \"Include\" and
     \"Exclude\"."""
    type: Union[str, "_models.JobTargetType"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The target type. Required. Known values are: \"TargetGroup\", \"SqlDatabase\",
     \"SqlElasticPool\", \"SqlShardMap\", and \"SqlServer\"."""
    server_name: Optional[str] = rest_field(
        name="serverName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The target server name."""
    database_name: Optional[str] = rest_field(
        name="databaseName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The target database name."""
    elastic_pool_name: Optional[str] = rest_field(
        name="elasticPoolName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The target elastic pool name."""
    shard_map_name: Optional[str] = rest_field(
        name="shardMapName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The target shard map."""
    refresh_credential: Optional[str] = rest_field(
        name="refreshCredential", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource ID of the credential that is used during job execution to connect to the target
     and determine the list of databases inside the target."""

    @overload
    def __init__(
        self,
        *,
        type: Union[str, "_models.JobTargetType"],
        membership_type: Optional[Union[str, "_models.JobTargetGroupMembershipType"]] = None,
        server_name: Optional[str] = None,
        database_name: Optional[str] = None,
        elastic_pool_name: Optional[str] = None,
        shard_map_name: Optional[str] = None,
        refresh_credential: 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 JobTargetGroup(ProxyResource):
    """A group of job targets.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.JobTargetGroupProperties
    """

    properties: Optional["_models.JobTargetGroupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["members"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.JobTargetGroupProperties"] = 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 JobTargetGroupProperties(_Model):
    """Properties of job target group.

    :ivar members: Members of the target group. Required.
    :vartype members: list[~azure.mgmt.sql.models.JobTarget]
    """

    members: list["_models.JobTarget"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Members of the target group. Required."""

    @overload
    def __init__(
        self,
        *,
        members: list["_models.JobTarget"],
    ) -> 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 JobVersion(ProxyResource):
    """A job version.

    :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.sql.models.SystemData
    """


class LedgerDigestUploads(ProxyResource):
    """Azure SQL Database ledger digest upload settings.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.LedgerDigestUploadsProperties
    """

    properties: Optional["_models.LedgerDigestUploadsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["digest_storage_endpoint", "state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.LedgerDigestUploadsProperties"] = 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 LedgerDigestUploadsProperties(_Model):
    """The properties of a database ledger digest upload settings.

    :ivar digest_storage_endpoint: The digest storage endpoint, which must be either an Azure blob
     storage endpoint or an URI for Azure Confidential Ledger.
    :vartype digest_storage_endpoint: str
    :ivar state: Specifies the state of ledger digest upload. Known values are: "Enabled" and
     "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.LedgerDigestUploadsState
    """

    digest_storage_endpoint: Optional[str] = rest_field(
        name="digestStorageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for
     Azure Confidential Ledger."""
    state: Optional[Union[str, "_models.LedgerDigestUploadsState"]] = rest_field(visibility=["read"])
    """Specifies the state of ledger digest upload. Known values are: \"Enabled\" and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        digest_storage_endpoint: 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 LicenseTypeCapability(_Model):
    """The license type capability.

    :ivar name: License type identifier.
    :vartype name: str
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """License type identifier."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 LocationCapabilities(_Model):
    """The location capability.

    :ivar name: The location name.
    :vartype name: str
    :ivar supported_server_versions: The list of supported server versions.
    :vartype supported_server_versions: list[~azure.mgmt.sql.models.ServerVersionCapability]
    :ivar supported_managed_instance_versions: The list of supported managed instance versions.
    :vartype supported_managed_instance_versions:
     list[~azure.mgmt.sql.models.ManagedInstanceVersionCapability]
    :ivar supported_job_agent_versions: The list of supported job agent versions.
    :vartype supported_job_agent_versions: list[~azure.mgmt.sql.models.JobAgentVersionCapability]
    :ivar is_zone_resilient_provisioning_allowed: Whether or not the subscription is allowed to
     provision zone resilient resources.
    :vartype is_zone_resilient_provisioning_allowed: bool
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The location name."""
    supported_server_versions: Optional[list["_models.ServerVersionCapability"]] = rest_field(
        name="supportedServerVersions", visibility=["read"]
    )
    """The list of supported server versions."""
    supported_managed_instance_versions: Optional[list["_models.ManagedInstanceVersionCapability"]] = rest_field(
        name="supportedManagedInstanceVersions", visibility=["read"]
    )
    """The list of supported managed instance versions."""
    supported_job_agent_versions: Optional[list["_models.JobAgentVersionCapability"]] = rest_field(
        name="supportedJobAgentVersions", visibility=["read"]
    )
    """The list of supported job agent versions."""
    is_zone_resilient_provisioning_allowed: Optional[bool] = rest_field(
        name="isZoneResilientProvisioningAllowed", visibility=["read"]
    )
    """Whether or not the subscription is allowed to provision zone resilient resources."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 LogicalDatabaseTransparentDataEncryption(ProxyResource):
    """A logical database transparent data encryption scan state.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.TransparentDataEncryptionProperties
    """

    properties: Optional["_models.TransparentDataEncryptionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["state", "scan_state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.TransparentDataEncryptionProperties"] = 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 LogSizeCapability(_Model):
    """The log size capability.

    :ivar limit: The log size limit (see 'unit' for the units).
    :vartype limit: int
    :ivar unit: The units that the limit is expressed in. Known values are: "Megabytes",
     "Gigabytes", "Terabytes", "Petabytes", and "Percent".
    :vartype unit: str or ~azure.mgmt.sql.models.LogSizeUnit
    """

    limit: Optional[int] = rest_field(visibility=["read"])
    """The log size limit (see 'unit' for the units)."""
    unit: Optional[Union[str, "_models.LogSizeUnit"]] = rest_field(visibility=["read"])
    """The units that the limit is expressed in. Known values are: \"Megabytes\", \"Gigabytes\",
     \"Terabytes\", \"Petabytes\", and \"Percent\"."""


class LongTermRetentionBackup(ProxyResource):
    """A long term retention backup.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.LongTermRetentionBackupProperties
    """

    properties: Optional["_models.LongTermRetentionBackupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "server_name",
        "server_create_time",
        "database_name",
        "database_deletion_time",
        "backup_time",
        "backup_expiration_time",
        "backup_storage_redundancy",
        "requested_backup_storage_redundancy",
        "is_backup_immutable",
        "time_based_immutability",
        "time_based_immutability_mode",
        "legal_hold_immutability",
        "backup_storage_access_tier",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.LongTermRetentionBackupProperties"] = 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 LongTermRetentionBackupOperationResult(ProxyResource):
    """A LongTermRetentionBackup operation result 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.LongTermRetentionOperationResultProperties
    """

    properties: Optional["_models.LongTermRetentionOperationResultProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "request_id",
        "operation_type",
        "from_backup_resource_id",
        "to_backup_resource_id",
        "target_backup_storage_redundancy",
        "status",
        "message",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.LongTermRetentionOperationResultProperties"] = 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 LongTermRetentionBackupProperties(_Model):
    """Properties of a long term retention backup.

    :ivar server_name: The server name that the backup database belong to.
    :vartype server_name: str
    :ivar server_create_time: The create time of the server.
    :vartype server_create_time: ~datetime.datetime
    :ivar database_name: The name of the database the backup belong to.
    :vartype database_name: str
    :ivar database_deletion_time: The delete time of the database.
    :vartype database_deletion_time: ~datetime.datetime
    :ivar backup_time: The time the backup was taken.
    :vartype backup_time: ~datetime.datetime
    :ivar backup_expiration_time: The time the long term retention backup will expire.
    :vartype backup_expiration_time: ~datetime.datetime
    :ivar backup_storage_redundancy: The storage redundancy type of the backup. Known values are:
     "Geo", "Local", "Zone", and "GeoZone".
    :vartype backup_storage_redundancy: str or ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage redundancy type of the backup. Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar is_backup_immutable: The setting whether the LTR backup is immutable.
    :vartype is_backup_immutable: bool
    :ivar time_based_immutability: The setting for whether or not time-based immutability is
     enabled for the LTR backup. When time-based immutability is enabled and locked, the backup
     cannot be deleted until BackupExpirationTime. Known values are: "Enabled" and "Disabled".
    :vartype time_based_immutability: str or ~azure.mgmt.sql.models.TimeBasedImmutability
    :ivar time_based_immutability_mode: The time-based immutability mode. Only applicable if
     time-based immutability is enabled. Known values are: "Locked" and "Unlocked".
    :vartype time_based_immutability_mode: str or ~azure.mgmt.sql.models.TimeBasedImmutabilityMode
    :ivar legal_hold_immutability: The setting for whether LegalHold is enabled or disabled on the
     LTR backup. When LegalHold is enabled, the backup cannot be deleted until the LegalHold is
     removed. Known values are: "Enabled" and "Disabled".
    :vartype legal_hold_immutability: str or ~azure.mgmt.sql.models.SetLegalHoldImmutability
    :ivar backup_storage_access_tier: The BackupStorageAccessTier for the LTR backup. Known values
     are: "Hot" and "Archive".
    :vartype backup_storage_access_tier: str or ~azure.mgmt.sql.models.BackupStorageAccessTier
    """

    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """The server name that the backup database belong to."""
    server_create_time: Optional[datetime.datetime] = rest_field(
        name="serverCreateTime", visibility=["read"], format="rfc3339"
    )
    """The create time of the server."""
    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """The name of the database the backup belong to."""
    database_deletion_time: Optional[datetime.datetime] = rest_field(
        name="databaseDeletionTime", visibility=["read"], format="rfc3339"
    )
    """The delete time of the database."""
    backup_time: Optional[datetime.datetime] = rest_field(name="backupTime", visibility=["read"], format="rfc3339")
    """The time the backup was taken."""
    backup_expiration_time: Optional[datetime.datetime] = rest_field(
        name="backupExpirationTime", visibility=["read"], format="rfc3339"
    )
    """The time the long term retention backup will expire."""
    backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="backupStorageRedundancy", visibility=["read"]
    )
    """The storage redundancy type of the backup. Known values are: \"Geo\", \"Local\", \"Zone\", and
     \"GeoZone\"."""
    requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="requestedBackupStorageRedundancy", visibility=["create", "update"]
    )
    """The storage redundancy type of the backup. Known values are: \"Geo\", \"Local\", \"Zone\", and
     \"GeoZone\"."""
    is_backup_immutable: Optional[bool] = rest_field(
        name="isBackupImmutable", visibility=["read", "create", "update", "delete", "query"]
    )
    """The setting whether the LTR backup is immutable."""
    time_based_immutability: Optional[Union[str, "_models.TimeBasedImmutability"]] = rest_field(
        name="timeBasedImmutability", visibility=["read", "create", "update", "delete", "query"]
    )
    """The setting for whether or not time-based immutability is enabled for the LTR backup. When
     time-based immutability is enabled and locked, the backup cannot be deleted until
     BackupExpirationTime. Known values are: \"Enabled\" and \"Disabled\"."""
    time_based_immutability_mode: Optional[Union[str, "_models.TimeBasedImmutabilityMode"]] = rest_field(
        name="timeBasedImmutabilityMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """The time-based immutability mode. Only applicable if time-based immutability is enabled. Known
     values are: \"Locked\" and \"Unlocked\"."""
    legal_hold_immutability: Optional[Union[str, "_models.SetLegalHoldImmutability"]] = rest_field(
        name="legalHoldImmutability", visibility=["read", "create", "update", "delete", "query"]
    )
    """The setting for whether LegalHold is enabled or disabled on the LTR backup. When LegalHold is
     enabled, the backup cannot be deleted until the LegalHold is removed. Known values are:
     \"Enabled\" and \"Disabled\"."""
    backup_storage_access_tier: Optional[Union[str, "_models.BackupStorageAccessTier"]] = rest_field(
        name="backupStorageAccessTier", visibility=["read"]
    )
    """The BackupStorageAccessTier for the LTR backup. Known values are: \"Hot\" and \"Archive\"."""

    @overload
    def __init__(
        self,
        *,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        is_backup_immutable: Optional[bool] = None,
        time_based_immutability: Optional[Union[str, "_models.TimeBasedImmutability"]] = None,
        time_based_immutability_mode: Optional[Union[str, "_models.TimeBasedImmutabilityMode"]] = None,
        legal_hold_immutability: Optional[Union[str, "_models.SetLegalHoldImmutability"]] = 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 LongTermRetentionOperationResultProperties(_Model):  # pylint: disable=name-too-long
    """Contains the operation result properties for long term retention backup operation.

    :ivar request_id: Request Id.
    :vartype request_id: str
    :ivar operation_type: Operation type.
    :vartype operation_type: str
    :ivar from_backup_resource_id: Source backup resource id.
    :vartype from_backup_resource_id: str
    :ivar to_backup_resource_id: Target backup resource id.
    :vartype to_backup_resource_id: str
    :ivar target_backup_storage_redundancy: The storage redundancy type of the copied backup. Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype target_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar status: Operation status.
    :vartype status: str
    :ivar message: Progress message.
    :vartype message: str
    """

    request_id: Optional[str] = rest_field(name="requestId", visibility=["read"])
    """Request Id."""
    operation_type: Optional[str] = rest_field(name="operationType", visibility=["read"])
    """Operation type."""
    from_backup_resource_id: Optional[str] = rest_field(name="fromBackupResourceId", visibility=["read"])
    """Source backup resource id."""
    to_backup_resource_id: Optional[str] = rest_field(name="toBackupResourceId", visibility=["read"])
    """Target backup resource id."""
    target_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="targetBackupStorageRedundancy", visibility=["read"]
    )
    """The storage redundancy type of the copied backup. Known values are: \"Geo\", \"Local\",
     \"Zone\", and \"GeoZone\"."""
    status: Optional[str] = rest_field(visibility=["read"])
    """Operation status."""
    message: Optional[str] = rest_field(visibility=["read"])
    """Progress message."""


class LongTermRetentionPolicy(ProxyResource):
    """A long term retention policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.LongTermRetentionPolicyProperties
    """

    properties: Optional["_models.LongTermRetentionPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "time_based_immutability",
        "time_based_immutability_mode",
        "weekly_retention",
        "monthly_retention",
        "yearly_retention",
        "week_of_year",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.LongTermRetentionPolicyProperties"] = 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 LongTermRetentionPolicyProperties(_Model):
    """Properties of a long term retention policy.

    :ivar time_based_immutability: The setting for whether to enable time-based immutability for
     future backups. When set, future backups will have TimeBasedImmutability enabled. Known values
     are: "Enabled" and "Disabled".
    :vartype time_based_immutability: str or ~azure.mgmt.sql.models.TimeBasedImmutability
    :ivar time_based_immutability_mode: The setting for time-based immutability mode for future
     backup (Value can be either Locked or UnLocked. Only effective if TimeBasedImmutability is
     enabled). Caution: Immutability of LTR backup cannot be removed if TimeBasedImmutabilityMode is
     Locked. Known values are: "Locked" and "Unlocked".
    :vartype time_based_immutability_mode: str or ~azure.mgmt.sql.models.TimeBasedImmutabilityMode
    :ivar weekly_retention: The weekly retention policy for an LTR backup in an ISO 8601 format.
    :vartype weekly_retention: str
    :ivar monthly_retention: The monthly retention policy for an LTR backup in an ISO 8601 format.
    :vartype monthly_retention: str
    :ivar yearly_retention: The yearly retention policy for an LTR backup in an ISO 8601 format.
    :vartype yearly_retention: str
    :ivar week_of_year: The week of year to take the yearly backup in an ISO 8601 format.
    :vartype week_of_year: int
    """

    time_based_immutability: Optional[Union[str, "_models.TimeBasedImmutability"]] = rest_field(
        name="timeBasedImmutability", visibility=["read", "create", "update", "delete", "query"]
    )
    """The setting for whether to enable time-based immutability for future backups. When set, future
     backups will have TimeBasedImmutability enabled. Known values are: \"Enabled\" and
     \"Disabled\"."""
    time_based_immutability_mode: Optional[Union[str, "_models.TimeBasedImmutabilityMode"]] = rest_field(
        name="timeBasedImmutabilityMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """The setting for time-based immutability mode for future backup (Value can be either Locked or
     UnLocked. Only effective if TimeBasedImmutability is enabled). Caution: Immutability of LTR
     backup cannot be removed if TimeBasedImmutabilityMode is Locked. Known values are: \"Locked\"
     and \"Unlocked\"."""
    weekly_retention: Optional[str] = rest_field(
        name="weeklyRetention", visibility=["read", "create", "update", "delete", "query"]
    )
    """The weekly retention policy for an LTR backup in an ISO 8601 format."""
    monthly_retention: Optional[str] = rest_field(
        name="monthlyRetention", visibility=["read", "create", "update", "delete", "query"]
    )
    """The monthly retention policy for an LTR backup in an ISO 8601 format."""
    yearly_retention: Optional[str] = rest_field(
        name="yearlyRetention", visibility=["read", "create", "update", "delete", "query"]
    )
    """The yearly retention policy for an LTR backup in an ISO 8601 format."""
    week_of_year: Optional[int] = rest_field(
        name="weekOfYear", visibility=["read", "create", "update", "delete", "query"]
    )
    """The week of year to take the yearly backup in an ISO 8601 format."""

    @overload
    def __init__(
        self,
        *,
        time_based_immutability: Optional[Union[str, "_models.TimeBasedImmutability"]] = None,
        time_based_immutability_mode: Optional[Union[str, "_models.TimeBasedImmutabilityMode"]] = None,
        weekly_retention: Optional[str] = None,
        monthly_retention: Optional[str] = None,
        yearly_retention: Optional[str] = None,
        week_of_year: 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 MaintenanceConfigurationCapability(_Model):
    """The maintenance configuration capability.

    :ivar name: Maintenance configuration name.
    :vartype name: str
    :ivar zone_redundant: Whether or not zone redundancy is supported for the maintenance
     configuration.
    :vartype zone_redundant: bool
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """Maintenance configuration name."""
    zone_redundant: Optional[bool] = rest_field(name="zoneRedundant", visibility=["read"])
    """Whether or not zone redundancy is supported for the maintenance configuration."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 MaintenanceWindowOptions(ProxyResource):
    """Maintenance window options.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.MaintenanceWindowOptionsProperties
    """

    properties: Optional["_models.MaintenanceWindowOptionsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "is_enabled",
        "maintenance_window_cycles",
        "min_duration_in_minutes",
        "default_duration_in_minutes",
        "min_cycles",
        "time_granularity_in_minutes",
        "allow_multiple_maintenance_windows_per_cycle",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.MaintenanceWindowOptionsProperties"] = 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 MaintenanceWindowOptionsProperties(_Model):
    """Maintenance window options properties.

    :ivar is_enabled: Whether maintenance windows are enabled for the database.
    :vartype is_enabled: bool
    :ivar maintenance_window_cycles: Available maintenance cycles e.g. {Saturday, 0, 48*60},
     {Wednesday, 0, 24*60}.
    :vartype maintenance_window_cycles: list[~azure.mgmt.sql.models.MaintenanceWindowTimeRange]
    :ivar min_duration_in_minutes: Minimum duration of maintenance window.
    :vartype min_duration_in_minutes: int
    :ivar default_duration_in_minutes: Default duration for maintenance window.
    :vartype default_duration_in_minutes: int
    :ivar min_cycles: Minimum number of maintenance windows cycles to be set on the database.
    :vartype min_cycles: int
    :ivar time_granularity_in_minutes: Time granularity in minutes for maintenance windows.
    :vartype time_granularity_in_minutes: int
    :ivar allow_multiple_maintenance_windows_per_cycle: Whether we allow multiple maintenance
     windows per cycle.
    :vartype allow_multiple_maintenance_windows_per_cycle: bool
    """

    is_enabled: Optional[bool] = rest_field(
        name="isEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether maintenance windows are enabled for the database."""
    maintenance_window_cycles: Optional[list["_models.MaintenanceWindowTimeRange"]] = rest_field(
        name="maintenanceWindowCycles", visibility=["read", "create", "update", "delete", "query"]
    )
    """Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, 24*60}."""
    min_duration_in_minutes: Optional[int] = rest_field(
        name="minDurationInMinutes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Minimum duration of maintenance window."""
    default_duration_in_minutes: Optional[int] = rest_field(
        name="defaultDurationInMinutes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Default duration for maintenance window."""
    min_cycles: Optional[int] = rest_field(name="minCycles", visibility=["read", "create", "update", "delete", "query"])
    """Minimum number of maintenance windows cycles to be set on the database."""
    time_granularity_in_minutes: Optional[int] = rest_field(
        name="timeGranularityInMinutes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Time granularity in minutes for maintenance windows."""
    allow_multiple_maintenance_windows_per_cycle: Optional[bool] = rest_field(
        name="allowMultipleMaintenanceWindowsPerCycle", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether we allow multiple maintenance windows per cycle."""

    @overload
    def __init__(
        self,
        *,
        is_enabled: Optional[bool] = None,
        maintenance_window_cycles: Optional[list["_models.MaintenanceWindowTimeRange"]] = None,
        min_duration_in_minutes: Optional[int] = None,
        default_duration_in_minutes: Optional[int] = None,
        min_cycles: Optional[int] = None,
        time_granularity_in_minutes: Optional[int] = None,
        allow_multiple_maintenance_windows_per_cycle: Optional[bool] = 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 MaintenanceWindows(ProxyResource):
    """Maintenance windows.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.MaintenanceWindowsProperties
    """

    properties: Optional["_models.MaintenanceWindowsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["time_ranges"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.MaintenanceWindowsProperties"] = 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 MaintenanceWindowsProperties(_Model):
    """Maintenance windows resource properties.

    :ivar time_ranges:
    :vartype time_ranges: list[~azure.mgmt.sql.models.MaintenanceWindowTimeRange]
    """

    time_ranges: Optional[list["_models.MaintenanceWindowTimeRange"]] = rest_field(
        name="timeRanges", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        time_ranges: Optional[list["_models.MaintenanceWindowTimeRange"]] = 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 MaintenanceWindowTimeRange(_Model):
    """Maintenance window time range.

    :ivar day_of_week: Day of maintenance window. Known values are: "Sunday", "Monday", "Tuesday",
     "Wednesday", "Thursday", "Friday", and "Saturday".
    :vartype day_of_week: str or ~azure.mgmt.sql.models.DayOfWeek
    :ivar start_time: Start time minutes offset from 12am.
    :vartype start_time: str
    :ivar duration: Duration of maintenance window in minutes.
    :vartype duration: str
    """

    day_of_week: Optional[Union[str, "_models.DayOfWeek"]] = rest_field(
        name="dayOfWeek", visibility=["read", "create", "update", "delete", "query"]
    )
    """Day of maintenance window. Known values are: \"Sunday\", \"Monday\", \"Tuesday\",
     \"Wednesday\", \"Thursday\", \"Friday\", and \"Saturday\"."""
    start_time: Optional[str] = rest_field(name="startTime", visibility=["read", "create", "update", "delete", "query"])
    """Start time minutes offset from 12am."""
    duration: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Duration of maintenance window in minutes."""

    @overload
    def __init__(
        self,
        *,
        day_of_week: Optional[Union[str, "_models.DayOfWeek"]] = None,
        start_time: Optional[str] = None,
        duration: 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 ManagedBackupShortTermRetentionPolicy(ProxyResource):
    """A short term retention policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicyProperties
    """

    properties: Optional["_models.ManagedBackupShortTermRetentionPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["retention_days"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedBackupShortTermRetentionPolicyProperties"] = 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 ManagedBackupShortTermRetentionPolicyProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a short term retention policy.

    :ivar retention_days: The backup retention period in days. This is how many days Point-in-Time
     Restore will be supported.
    :vartype retention_days: int
    """

    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """The backup retention period in days. This is how many days Point-in-Time Restore will be
     supported."""

    @overload
    def __init__(
        self,
        *,
        retention_days: 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 ManagedDatabase(TrackedResource):
    """A managed database 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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedDatabaseProperties
    """

    properties: Optional["_models.ManagedDatabaseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "collation",
        "status",
        "creation_date",
        "earliest_restore_point",
        "restore_point_in_time",
        "default_secondary_location",
        "catalog_collation",
        "create_mode",
        "storage_container_uri",
        "source_database_id",
        "cross_subscription_source_database_id",
        "restorable_dropped_database_id",
        "cross_subscription_restorable_dropped_database_id",
        "storage_container_identity",
        "storage_container_sas_token",
        "failover_group_id",
        "recoverable_database_id",
        "long_term_retention_backup_resource_id",
        "auto_complete_restore",
        "last_backup_name",
        "cross_subscription_target_managed_instance_id",
        "is_ledger_on",
        "extended_accessibility_info",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.ManagedDatabaseProperties"] = 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 ManagedDatabaseAdvancedThreatProtection(ProxyResource):
    """A managed database Advanced Threat Protection.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.AdvancedThreatProtectionProperties
    """

    properties: Optional["_models.AdvancedThreatProtectionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["state", "creation_time"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.AdvancedThreatProtectionProperties"] = 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 ManagedDatabaseExtendedAccessibilityInfo(_Model):
    """Managed Database Extended Accessibility Information.

    :ivar inaccessibility_reason_error_code: SQL Server error code connected to the inaccessibility
     root cause. Required.
    :vartype inaccessibility_reason_error_code: str
    :ivar inaccessibility_reason_description: Root cause explanation and mitigation action.
     Required.
    :vartype inaccessibility_reason_description: str
    :ivar inaccessibility_reason_kind: Root cause kind. Allowed values are
     “TransparentDataEncryption”, “DatabaseReplication”, and “Unknown”. Required. Known values are:
     "Unknown", "TransparentDataEncryption", and "DatabaseReplication".
    :vartype inaccessibility_reason_kind: str or ~azure.mgmt.sql.models.InaccessibilityReason
    :ivar inaccessibility_reason_tde_key_uri: For the root cause kind “TransparentDataEncryption”,
     the CMK URI.
    :vartype inaccessibility_reason_tde_key_uri: str
    """

    inaccessibility_reason_error_code: str = rest_field(name="inaccessibilityReasonErrorCode", visibility=["read"])
    """SQL Server error code connected to the inaccessibility root cause. Required."""
    inaccessibility_reason_description: str = rest_field(name="inaccessibilityReasonDescription", visibility=["read"])
    """Root cause explanation and mitigation action. Required."""
    inaccessibility_reason_kind: Union[str, "_models.InaccessibilityReason"] = rest_field(
        name="inaccessibilityReasonKind", visibility=["read"]
    )
    """Root cause kind. Allowed values are “TransparentDataEncryption”, “DatabaseReplication”, and
     “Unknown”. Required. Known values are: \"Unknown\", \"TransparentDataEncryption\", and
     \"DatabaseReplication\"."""
    inaccessibility_reason_tde_key_uri: Optional[str] = rest_field(
        name="inaccessibilityReasonTdeKeyUri", visibility=["read"]
    )
    """For the root cause kind “TransparentDataEncryption”, the CMK URI."""


class ManagedDatabaseMoveDefinition(_Model):
    """Contains the information necessary to perform a managed database move.

    :ivar destination_managed_database_id: The destination managed database ID. Required.
    :vartype destination_managed_database_id: str
    """

    destination_managed_database_id: str = rest_field(
        name="destinationManagedDatabaseId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The destination managed database ID. Required."""

    @overload
    def __init__(
        self,
        *,
        destination_managed_database_id: str,
    ) -> 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 ManagedDatabaseMoveOperationResult(ProxyResource):
    """A managed database move operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedDatabaseMoveOperationResultProperties
    """

    properties: Optional["_models.ManagedDatabaseMoveOperationResultProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "operation",
        "operation_friendly_name",
        "start_time",
        "state",
        "operation_mode",
        "source_managed_instance_name",
        "target_managed_instance_name",
        "source_managed_instance_id",
        "target_managed_instance_id",
        "source_database_name",
        "target_database_name",
        "is_cancellable",
        "error_code",
        "error_description",
        "error_severity",
        "is_user_error",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedDatabaseMoveOperationResultProperties"] = 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 ManagedDatabaseMoveOperationResultProperties(_Model):  # pylint: disable=name-too-long
    """Contains the operation result properties for managed database move operation.

    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar operation_mode: Operation mode. Known values are: "Move" and "Copy".
    :vartype operation_mode: str or ~azure.mgmt.sql.models.MoveOperationMode
    :ivar source_managed_instance_name: Source Managed Instance name.
    :vartype source_managed_instance_name: str
    :ivar target_managed_instance_name: Target Managed Instance name.
    :vartype target_managed_instance_name: str
    :ivar source_managed_instance_id: Source Managed Instance resource id.
    :vartype source_managed_instance_id: str
    :ivar target_managed_instance_id: Target Managed instance resource id.
    :vartype target_managed_instance_id: str
    :ivar source_database_name: Source database name.
    :vartype source_database_name: str
    :ivar target_database_name: Target database name.
    :vartype target_database_name: str
    :ivar is_cancellable: Is move operation cancellable.
    :vartype is_cancellable: bool
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    """

    operation: Optional[str] = rest_field(visibility=["read"])
    """The name of operation."""
    operation_friendly_name: Optional[str] = rest_field(name="operationFriendlyName", visibility=["read"])
    """The friendly name of operation."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The operation start time."""
    state: Optional[Union[str, "_models.ManagementOperationState"]] = rest_field(visibility=["read"])
    """The operation state. Known values are: \"Pending\", \"InProgress\", \"Succeeded\", \"Failed\",
     \"CancelInProgress\", and \"Cancelled\"."""
    operation_mode: Optional[Union[str, "_models.MoveOperationMode"]] = rest_field(
        name="operationMode", visibility=["read"]
    )
    """Operation mode. Known values are: \"Move\" and \"Copy\"."""
    source_managed_instance_name: Optional[str] = rest_field(name="sourceManagedInstanceName", visibility=["read"])
    """Source Managed Instance name."""
    target_managed_instance_name: Optional[str] = rest_field(name="targetManagedInstanceName", visibility=["read"])
    """Target Managed Instance name."""
    source_managed_instance_id: Optional[str] = rest_field(name="sourceManagedInstanceId", visibility=["read"])
    """Source Managed Instance resource id."""
    target_managed_instance_id: Optional[str] = rest_field(name="targetManagedInstanceId", visibility=["read"])
    """Target Managed instance resource id."""
    source_database_name: Optional[str] = rest_field(name="sourceDatabaseName", visibility=["read"])
    """Source database name."""
    target_database_name: Optional[str] = rest_field(name="targetDatabaseName", visibility=["read"])
    """Target database name."""
    is_cancellable: Optional[bool] = rest_field(name="isCancellable", visibility=["read"])
    """Is move operation cancellable."""
    error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"])
    """The operation error code."""
    error_description: Optional[str] = rest_field(name="errorDescription", visibility=["read"])
    """The operation error description."""
    error_severity: Optional[int] = rest_field(name="errorSeverity", visibility=["read"])
    """The operation error severity."""
    is_user_error: Optional[bool] = rest_field(name="isUserError", visibility=["read"])
    """Whether or not the error is a user error."""


class ManagedDatabaseProperties(_Model):
    """The managed database's properties.

    :ivar collation: Collation of the managed database.
    :vartype collation: str
    :ivar status: Status of the database. Known values are: "Online", "Offline", "Shutdown",
     "Creating", "Inaccessible", "Restoring", "Updating", "Stopping", "Stopped", "Starting",
     "DbMoving", and "DbCopying".
    :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus
    :ivar creation_date: Creation date of the database.
    :vartype creation_date: ~datetime.datetime
    :ivar earliest_restore_point: Earliest restore point in time for point in time restore.
    :vartype earliest_restore_point: ~datetime.datetime
    :ivar restore_point_in_time: Conditional. If createMode is PointInTimeRestore, this value is
     required. Specifies the point in time (ISO8601 format) of the source database that will be
     restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar default_secondary_location: Geo paired region.
    :vartype default_secondary_location: str
    :ivar catalog_collation: Collation of the metadata catalog. Known values are:
     "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
    :vartype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
    :ivar create_mode: Managed database create mode. PointInTimeRestore: Create a database by
     restoring a point in time backup of an existing database. SourceDatabaseName,
     SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a
     database by restoring from external backup files. Collation, StorageContainerUri and
     StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a
     geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database
     resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a
     long term retention backup (longTermRetentionBackupResourceId required). Known values are:
     "Default", "RestoreExternalBackup", "PointInTimeRestore", "Recovery", and
     "RestoreLongTermRetentionBackup".
    :vartype create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode
    :ivar storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is
     required. Specifies the uri of the storage container where backups for this restore are stored.
    :vartype storage_container_uri: str
    :ivar source_database_id: The resource identifier of the source database associated with create
     operation of this database.
    :vartype source_database_id: str
    :ivar cross_subscription_source_database_id: The resource identifier of the cross-subscription
     source database associated with create operation of this database.
    :vartype cross_subscription_source_database_id: str
    :ivar restorable_dropped_database_id: The restorable dropped database resource id to restore
     when creating this database.
    :vartype restorable_dropped_database_id: str
    :ivar cross_subscription_restorable_dropped_database_id: The restorable cross-subscription
     dropped database resource id to restore when creating this database.
    :vartype cross_subscription_restorable_dropped_database_id: str
    :ivar storage_container_identity: Conditional. If createMode is RestoreExternalBackup, this
     value is used. Specifies the identity used for storage container authentication. Can be
     'SharedAccessSignature' or 'ManagedIdentity'; if not specified 'SharedAccessSignature' is
     assumed.
    :vartype storage_container_identity: str
    :ivar storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup and
     storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage
     container sas token.
    :vartype storage_container_sas_token: str
    :ivar failover_group_id: Instance Failover Group resource identifier that this managed database
     belongs to.
    :vartype failover_group_id: str
    :ivar recoverable_database_id: The resource identifier of the recoverable database associated
     with create operation of this database.
    :vartype recoverable_database_id: str
    :ivar long_term_retention_backup_resource_id: The name of the Long Term Retention backup to be
     used for restore of this managed database.
    :vartype long_term_retention_backup_resource_id: str
    :ivar auto_complete_restore: Whether to auto complete restore of this managed database.
    :vartype auto_complete_restore: bool
    :ivar last_backup_name: Last backup file name for restore of this managed database.
    :vartype last_backup_name: str
    :ivar cross_subscription_target_managed_instance_id: Target managed instance id used in
     cross-subscription restore.
    :vartype cross_subscription_target_managed_instance_id: str
    :ivar is_ledger_on: Whether or not this database is a ledger database, which means all tables
     in the database are ledger tables. Note: the value of this property cannot be changed after the
     database has been created.
    :vartype is_ledger_on: bool
    :ivar extended_accessibility_info: Additional observability and troubleshooting information for
     databases in ‘Inaccessible’ state.
    :vartype extended_accessibility_info:
     ~azure.mgmt.sql.models.ManagedDatabaseExtendedAccessibilityInfo
    """

    collation: Optional[str] = rest_field(visibility=["read", "create"])
    """Collation of the managed database."""
    status: Optional[Union[str, "_models.ManagedDatabaseStatus"]] = rest_field(visibility=["read"])
    """Status of the database. Known values are: \"Online\", \"Offline\", \"Shutdown\", \"Creating\",
     \"Inaccessible\", \"Restoring\", \"Updating\", \"Stopping\", \"Stopped\", \"Starting\",
     \"DbMoving\", and \"DbCopying\"."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """Creation date of the database."""
    earliest_restore_point: Optional[datetime.datetime] = rest_field(
        name="earliestRestorePoint", visibility=["read"], format="rfc3339"
    )
    """Earliest restore point in time for point in time restore."""
    restore_point_in_time: Optional[datetime.datetime] = rest_field(
        name="restorePointInTime", visibility=["create"], format="rfc3339"
    )
    """Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point
     in time (ISO8601 format) of the source database that will be restored to create the new
     database."""
    default_secondary_location: Optional[str] = rest_field(name="defaultSecondaryLocation", visibility=["read"])
    """Geo paired region."""
    catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = rest_field(
        name="catalogCollation", visibility=["read", "create"]
    )
    """Collation of the metadata catalog. Known values are: \"DATABASE_DEFAULT\" and
     \"SQL_Latin1_General_CP1_CI_AS\"."""
    create_mode: Optional[Union[str, "_models.ManagedDatabaseCreateMode"]] = rest_field(
        name="createMode", visibility=["create"]
    )
    """Managed database create mode. PointInTimeRestore: Create a database by restoring a point in
     time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and
     PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from
     external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be
     specified. Recovery: Creates a database by restoring a geo-replicated backup.
     RecoverableDatabaseId must be specified as the recoverable database resource ID to restore.
     RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention
     backup (longTermRetentionBackupResourceId required). Known values are: \"Default\",
     \"RestoreExternalBackup\", \"PointInTimeRestore\", \"Recovery\", and
     \"RestoreLongTermRetentionBackup\"."""
    storage_container_uri: Optional[str] = rest_field(name="storageContainerUri", visibility=["create"])
    """Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri
     of the storage container where backups for this restore are stored."""
    source_database_id: Optional[str] = rest_field(name="sourceDatabaseId", visibility=["create"])
    """The resource identifier of the source database associated with create operation of this
     database."""
    cross_subscription_source_database_id: Optional[str] = rest_field(
        name="crossSubscriptionSourceDatabaseId", visibility=["create"]
    )
    """The resource identifier of the cross-subscription source database associated with create
     operation of this database."""
    restorable_dropped_database_id: Optional[str] = rest_field(
        name="restorableDroppedDatabaseId", visibility=["create"]
    )
    """The restorable dropped database resource id to restore when creating this database."""
    cross_subscription_restorable_dropped_database_id: Optional[str] = rest_field(
        name="crossSubscriptionRestorableDroppedDatabaseId", visibility=["create"]
    )
    """The restorable cross-subscription dropped database resource id to restore when creating this
     database."""
    storage_container_identity: Optional[str] = rest_field(name="storageContainerIdentity", visibility=["create"])
    """Conditional. If createMode is RestoreExternalBackup, this value is used. Specifies the identity
     used for storage container authentication. Can be 'SharedAccessSignature' or 'ManagedIdentity';
     if not specified 'SharedAccessSignature' is assumed."""
    storage_container_sas_token: Optional[str] = rest_field(name="storageContainerSasToken", visibility=["create"])
    """Conditional. If createMode is RestoreExternalBackup and storageContainerIdentity is not
     ManagedIdentity, this value is required. Specifies the storage container sas token."""
    failover_group_id: Optional[str] = rest_field(name="failoverGroupId", visibility=["read"])
    """Instance Failover Group resource identifier that this managed database belongs to."""
    recoverable_database_id: Optional[str] = rest_field(name="recoverableDatabaseId", visibility=["create"])
    """The resource identifier of the recoverable database associated with create operation of this
     database."""
    long_term_retention_backup_resource_id: Optional[str] = rest_field(
        name="longTermRetentionBackupResourceId", visibility=["create"]
    )
    """The name of the Long Term Retention backup to be used for restore of this managed database."""
    auto_complete_restore: Optional[bool] = rest_field(name="autoCompleteRestore", visibility=["create"])
    """Whether to auto complete restore of this managed database."""
    last_backup_name: Optional[str] = rest_field(name="lastBackupName", visibility=["create"])
    """Last backup file name for restore of this managed database."""
    cross_subscription_target_managed_instance_id: Optional[str] = rest_field(
        name="crossSubscriptionTargetManagedInstanceId", visibility=["create"]
    )
    """Target managed instance id used in cross-subscription restore."""
    is_ledger_on: Optional[bool] = rest_field(name="isLedgerOn", visibility=["read", "create"])
    """Whether or not this database is a ledger database, which means all tables in the database are
     ledger tables. Note: the value of this property cannot be changed after the database has been
     created."""
    extended_accessibility_info: Optional["_models.ManagedDatabaseExtendedAccessibilityInfo"] = rest_field(
        name="extendedAccessibilityInfo", visibility=["read"]
    )
    """Additional observability and troubleshooting information for databases in ‘Inaccessible’ state."""

    @overload
    def __init__(
        self,
        *,
        collation: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = None,
        create_mode: Optional[Union[str, "_models.ManagedDatabaseCreateMode"]] = None,
        storage_container_uri: Optional[str] = None,
        source_database_id: Optional[str] = None,
        cross_subscription_source_database_id: Optional[str] = None,
        restorable_dropped_database_id: Optional[str] = None,
        cross_subscription_restorable_dropped_database_id: Optional[str] = None,
        storage_container_identity: Optional[str] = None,
        storage_container_sas_token: Optional[str] = None,
        recoverable_database_id: Optional[str] = None,
        long_term_retention_backup_resource_id: Optional[str] = None,
        auto_complete_restore: Optional[bool] = None,
        last_backup_name: Optional[str] = None,
        cross_subscription_target_managed_instance_id: Optional[str] = None,
        is_ledger_on: Optional[bool] = 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 ManagedDatabaseRestoreDetailsBackupSetProperties(_Model):  # pylint: disable=name-too-long
    """The managed database's restore details backup set properties.

    :ivar status: Backup set status.
    :vartype status: str
    :ivar first_stripe_name: First stripe name.
    :vartype first_stripe_name: str
    :ivar number_of_stripes: Number of stripes.
    :vartype number_of_stripes: int
    :ivar backup_size_mb: Backup size.
    :vartype backup_size_mb: int
    :ivar restore_started_timestamp_utc: Last restored file time.
    :vartype restore_started_timestamp_utc: ~datetime.datetime
    :ivar restore_finished_timestamp_utc: Last restored file time.
    :vartype restore_finished_timestamp_utc: ~datetime.datetime
    """

    status: Optional[str] = rest_field(visibility=["read"])
    """Backup set status."""
    first_stripe_name: Optional[str] = rest_field(name="firstStripeName", visibility=["read"])
    """First stripe name."""
    number_of_stripes: Optional[int] = rest_field(name="numberOfStripes", visibility=["read"])
    """Number of stripes."""
    backup_size_mb: Optional[int] = rest_field(name="backupSizeMB", visibility=["read"])
    """Backup size."""
    restore_started_timestamp_utc: Optional[datetime.datetime] = rest_field(
        name="restoreStartedTimestampUtc", visibility=["read"], format="rfc3339"
    )
    """Last restored file time."""
    restore_finished_timestamp_utc: Optional[datetime.datetime] = rest_field(
        name="restoreFinishedTimestampUtc", visibility=["read"], format="rfc3339"
    )
    """Last restored file time."""


class ManagedDatabaseRestoreDetailsProperties(_Model):
    """The managed database's restore details properties.

    :ivar type: Restore type.
    :vartype type: str
    :ivar status: Restore status.
    :vartype status: str
    :ivar block_reason: The reason why restore is in Blocked state.
    :vartype block_reason: str
    :ivar last_uploaded_file_name: Last uploaded file name.
    :vartype last_uploaded_file_name: str
    :ivar last_uploaded_file_time: Last uploaded file time.
    :vartype last_uploaded_file_time: ~datetime.datetime
    :ivar last_restored_file_name: Last restored file name.
    :vartype last_restored_file_name: str
    :ivar last_restored_file_time: Last restored file time.
    :vartype last_restored_file_time: ~datetime.datetime
    :ivar percent_completed: Percent completed.
    :vartype percent_completed: int
    :ivar current_restored_size_mb: Current restored size MB.
    :vartype current_restored_size_mb: int
    :ivar current_restore_plan_size_mb: Current restore plan size MB.
    :vartype current_restore_plan_size_mb: int
    :ivar current_backup_type: Current backup type.
    :vartype current_backup_type: str
    :ivar current_restoring_file_name: Current restoring file name.
    :vartype current_restoring_file_name: str
    :ivar number_of_files_detected: Number of files detected.
    :vartype number_of_files_detected: int
    :ivar number_of_files_queued: Number of files queued.
    :vartype number_of_files_queued: int
    :ivar number_of_files_skipped: Number of files skipped.
    :vartype number_of_files_skipped: int
    :ivar number_of_files_restoring: Number of files restoring.
    :vartype number_of_files_restoring: int
    :ivar number_of_files_restored: Number of files restored.
    :vartype number_of_files_restored: int
    :ivar number_of_files_unrestorable: Number of files unrestorable.
    :vartype number_of_files_unrestorable: int
    :ivar full_backup_sets: Full backup sets.
    :vartype full_backup_sets:
     list[~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsBackupSetProperties]
    :ivar diff_backup_sets: Diff backup sets.
    :vartype diff_backup_sets:
     list[~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsBackupSetProperties]
    :ivar log_backup_sets: Log backup sets.
    :vartype log_backup_sets:
     list[~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsBackupSetProperties]
    :ivar unrestorable_files: Unrestorable files.
    :vartype unrestorable_files:
     list[~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsUnrestorableFileProperties]
    """

    type: Optional[str] = rest_field(visibility=["read"])
    """Restore type."""
    status: Optional[str] = rest_field(visibility=["read"])
    """Restore status."""
    block_reason: Optional[str] = rest_field(name="blockReason", visibility=["read"])
    """The reason why restore is in Blocked state."""
    last_uploaded_file_name: Optional[str] = rest_field(name="lastUploadedFileName", visibility=["read"])
    """Last uploaded file name."""
    last_uploaded_file_time: Optional[datetime.datetime] = rest_field(
        name="lastUploadedFileTime", visibility=["read"], format="rfc3339"
    )
    """Last uploaded file time."""
    last_restored_file_name: Optional[str] = rest_field(name="lastRestoredFileName", visibility=["read"])
    """Last restored file name."""
    last_restored_file_time: Optional[datetime.datetime] = rest_field(
        name="lastRestoredFileTime", visibility=["read"], format="rfc3339"
    )
    """Last restored file time."""
    percent_completed: Optional[int] = rest_field(name="percentCompleted", visibility=["read"])
    """Percent completed."""
    current_restored_size_mb: Optional[int] = rest_field(name="currentRestoredSizeMB", visibility=["read"])
    """Current restored size MB."""
    current_restore_plan_size_mb: Optional[int] = rest_field(name="currentRestorePlanSizeMB", visibility=["read"])
    """Current restore plan size MB."""
    current_backup_type: Optional[str] = rest_field(name="currentBackupType", visibility=["read"])
    """Current backup type."""
    current_restoring_file_name: Optional[str] = rest_field(name="currentRestoringFileName", visibility=["read"])
    """Current restoring file name."""
    number_of_files_detected: Optional[int] = rest_field(name="numberOfFilesDetected", visibility=["read"])
    """Number of files detected."""
    number_of_files_queued: Optional[int] = rest_field(name="numberOfFilesQueued", visibility=["read"])
    """Number of files queued."""
    number_of_files_skipped: Optional[int] = rest_field(name="numberOfFilesSkipped", visibility=["read"])
    """Number of files skipped."""
    number_of_files_restoring: Optional[int] = rest_field(name="numberOfFilesRestoring", visibility=["read"])
    """Number of files restoring."""
    number_of_files_restored: Optional[int] = rest_field(name="numberOfFilesRestored", visibility=["read"])
    """Number of files restored."""
    number_of_files_unrestorable: Optional[int] = rest_field(name="numberOfFilesUnrestorable", visibility=["read"])
    """Number of files unrestorable."""
    full_backup_sets: Optional[list["_models.ManagedDatabaseRestoreDetailsBackupSetProperties"]] = rest_field(
        name="fullBackupSets", visibility=["read"]
    )
    """Full backup sets."""
    diff_backup_sets: Optional[list["_models.ManagedDatabaseRestoreDetailsBackupSetProperties"]] = rest_field(
        name="diffBackupSets", visibility=["read"]
    )
    """Diff backup sets."""
    log_backup_sets: Optional[list["_models.ManagedDatabaseRestoreDetailsBackupSetProperties"]] = rest_field(
        name="logBackupSets", visibility=["read"]
    )
    """Log backup sets."""
    unrestorable_files: Optional[list["_models.ManagedDatabaseRestoreDetailsUnrestorableFileProperties"]] = rest_field(
        name="unrestorableFiles", visibility=["read"]
    )
    """Unrestorable files."""


class ManagedDatabaseRestoreDetailsResult(ProxyResource):
    """A managed database restore details.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsProperties
    """

    properties: Optional["_models.ManagedDatabaseRestoreDetailsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "type",
        "status",
        "block_reason",
        "last_uploaded_file_name",
        "last_uploaded_file_time",
        "last_restored_file_name",
        "last_restored_file_time",
        "percent_completed",
        "current_restored_size_mb",
        "current_restore_plan_size_mb",
        "current_backup_type",
        "current_restoring_file_name",
        "number_of_files_detected",
        "number_of_files_queued",
        "number_of_files_skipped",
        "number_of_files_restoring",
        "number_of_files_restored",
        "number_of_files_unrestorable",
        "full_backup_sets",
        "diff_backup_sets",
        "log_backup_sets",
        "unrestorable_files",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedDatabaseRestoreDetailsProperties"] = 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 ManagedDatabaseRestoreDetailsUnrestorableFileProperties(_Model):  # pylint: disable=name-too-long
    """The managed database's restore details unrestorable file properties.

    :ivar name: File name.
    :vartype name: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """File name."""


class ManagedDatabaseSecurityAlertPolicy(ProxyResource):
    """A managed database security alert policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SecurityAlertPolicyProperties
    """

    properties: Optional["_models.SecurityAlertPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "state",
        "disabled_alerts",
        "email_addresses",
        "email_account_admins",
        "storage_endpoint",
        "storage_account_access_key",
        "retention_days",
        "creation_time",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SecurityAlertPolicyProperties"] = 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 ManagedDatabaseStartMoveDefinition(_Model):
    """Contains the information necessary to start a managed database move.

    :ivar destination_managed_database_id: The destination managed database ID. Required.
    :vartype destination_managed_database_id: str
    :ivar operation_mode: The move operation mode. Known values are: "Move" and "Copy".
    :vartype operation_mode: str or ~azure.mgmt.sql.models.MoveOperationMode
    """

    destination_managed_database_id: str = rest_field(
        name="destinationManagedDatabaseId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The destination managed database ID. Required."""
    operation_mode: Optional[Union[str, "_models.MoveOperationMode"]] = rest_field(
        name="operationMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """The move operation mode. Known values are: \"Move\" and \"Copy\"."""

    @overload
    def __init__(
        self,
        *,
        destination_managed_database_id: str,
        operation_mode: Optional[Union[str, "_models.MoveOperationMode"]] = 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 ManagedDatabaseUpdate(_Model):
    """An managed database update.

    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedDatabaseProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    properties: Optional["_models.ManagedDatabaseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = [
        "collation",
        "status",
        "creation_date",
        "earliest_restore_point",
        "restore_point_in_time",
        "default_secondary_location",
        "catalog_collation",
        "create_mode",
        "storage_container_uri",
        "source_database_id",
        "cross_subscription_source_database_id",
        "restorable_dropped_database_id",
        "cross_subscription_restorable_dropped_database_id",
        "storage_container_identity",
        "storage_container_sas_token",
        "failover_group_id",
        "recoverable_database_id",
        "long_term_retention_backup_resource_id",
        "auto_complete_restore",
        "last_backup_name",
        "cross_subscription_target_managed_instance_id",
        "is_ledger_on",
        "extended_accessibility_info",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedDatabaseProperties"] = 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 ManagedInstance(TrackedResource):
    """An Azure SQL managed instance.

    :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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceProperties
    :ivar identity: The Azure Active Directory identity of the managed instance.
    :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity
    :ivar sku: Managed instance SKU. Allowed values for sku.name: GP_Gen5 (General Purpose,
     Standard-series); GP_G8IM (General Purpose, Premium-series); GP_G8IH (General Purpose,
     Premium-series memory optimized); BC_Gen5 (Business Critical, Standard-Series); BC_G8IM
     (Business Critical, Premium-series); BC_G8IH (Business Critical, Premium-series memory
     optimized).
    :vartype sku: ~azure.mgmt.sql.models.Sku
    """

    properties: Optional["_models.ManagedInstanceProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    identity: Optional["_models.ResourceIdentity"] = rest_field(visibility=["read", "create"])
    """The Azure Active Directory identity of the managed instance."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Managed instance SKU. Allowed values for sku.name: GP_Gen5 (General Purpose, Standard-series);
     GP_G8IM (General Purpose, Premium-series); GP_G8IH (General Purpose, Premium-series memory
     optimized); BC_Gen5 (Business Critical, Standard-Series); BC_G8IM (Business Critical,
     Premium-series); BC_G8IH (Business Critical, Premium-series memory optimized)."""

    __flattened_items = [
        "provisioning_state",
        "managed_instance_create_mode",
        "fully_qualified_domain_name",
        "is_general_purpose_v2",
        "administrator_login",
        "administrator_login_password",
        "subnet_id",
        "state",
        "license_type",
        "hybrid_secondary_usage",
        "hybrid_secondary_usage_detected",
        "v_cores",
        "storage_size_in_gb",
        "storage_i_ops",
        "storage_throughput_m_bps",
        "memory_size_in_gb",
        "collation",
        "dns_zone",
        "dns_zone_partner",
        "public_data_endpoint_enabled",
        "source_managed_instance_id",
        "restore_point_in_time",
        "proxy_override",
        "timezone_id",
        "instance_pool_id",
        "maintenance_configuration_id",
        "private_endpoint_connections",
        "minimal_tls_version",
        "current_backup_storage_redundancy",
        "requested_backup_storage_redundancy",
        "zone_redundant",
        "primary_user_assigned_identity_id",
        "key_id",
        "administrators",
        "service_principal",
        "virtual_cluster_id",
        "external_governance_status",
        "pricing_model",
        "create_time",
        "authentication_metadata",
        "database_format",
        "requested_logical_availability_zone",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.ManagedInstanceProperties"] = None,
        identity: Optional["_models.ResourceIdentity"] = None,
        sku: Optional["_models.Sku"] = 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 ManagedInstanceAdministrator(ProxyResource):
    """An Azure SQL managed instance administrator.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceAdministratorProperties
    """

    properties: Optional["_models.ManagedInstanceAdministratorProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["administrator_type", "login", "sid", "tenant_id"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceAdministratorProperties"] = 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 ManagedInstanceAdministratorProperties(_Model):
    """The properties of a managed instance administrator.

    :ivar administrator_type: Type of the managed instance administrator. Required.
     "ActiveDirectory"
    :vartype administrator_type: str or ~azure.mgmt.sql.models.ManagedInstanceAdministratorType
    :ivar login: Login name of the managed instance administrator. Required.
    :vartype login: str
    :ivar sid: SID (object ID) of the managed instance administrator. Required.
    :vartype sid: str
    :ivar tenant_id: Tenant ID of the managed instance administrator.
    :vartype tenant_id: str
    """

    administrator_type: Union[str, "_models.ManagedInstanceAdministratorType"] = rest_field(
        name="administratorType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the managed instance administrator. Required. \"ActiveDirectory\""""
    login: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Login name of the managed instance administrator. Required."""
    sid: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """SID (object ID) of the managed instance administrator. Required."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"])
    """Tenant ID of the managed instance administrator."""

    @overload
    def __init__(
        self,
        *,
        administrator_type: Union[str, "_models.ManagedInstanceAdministratorType"],
        login: str,
        sid: str,
        tenant_id: 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 ManagedInstanceAdvancedThreatProtection(ProxyResource):
    """A managed instance Advanced Threat Protection.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.AdvancedThreatProtectionProperties
    """

    properties: Optional["_models.AdvancedThreatProtectionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["state", "creation_time"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.AdvancedThreatProtectionProperties"] = 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 ManagedInstanceAzureADOnlyAuthentication(ProxyResource):
    """Azure Active Directory only authentication.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceAzureADOnlyAuthProperties
    """

    properties: Optional["_models.ManagedInstanceAzureADOnlyAuthProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["azure_ad_only_authentication"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceAzureADOnlyAuthProperties"] = 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 ManagedInstanceAzureADOnlyAuthProperties(_Model):
    """Properties of a active directory only authentication for Managed Instance.

    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
     Required.
    :vartype azure_ad_only_authentication: bool
    """

    azure_ad_only_authentication: bool = rest_field(
        name="azureADOnlyAuthentication", visibility=["read", "create", "update", "delete", "query"]
    )
    """Azure Active Directory only Authentication enabled. Required."""

    @overload
    def __init__(
        self,
        *,
        azure_ad_only_authentication: bool,
    ) -> 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 ManagedInstanceDtc(ProxyResource):
    """SQL Managed Instance DTC.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceDtcProperties
    """

    properties: Optional["_models.ManagedInstanceDtcProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "dtc_enabled",
        "security_settings",
        "external_dns_suffix_search_list",
        "dtc_host_name_dns_suffix",
        "provisioning_state",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceDtcProperties"] = 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 ManagedInstanceDtcProperties(_Model):
    """The properties of managed instance DTC.

    :ivar dtc_enabled: Active status of managed instance DTC.
    :vartype dtc_enabled: bool
    :ivar security_settings: Security settings of managed instance DTC.
    :vartype security_settings: ~azure.mgmt.sql.models.ManagedInstanceDtcSecuritySettings
    :ivar external_dns_suffix_search_list: External dns suffix search list of managed instance DTC.
    :vartype external_dns_suffix_search_list: list[str]
    :ivar dtc_host_name_dns_suffix: Host name dns suffix of managed instance DTC.
    :vartype dtc_host_name_dns_suffix: str
    :ivar provisioning_state: Provisioning state of managed instance DTC. Known values are:
     "Created", "InProgress", "Succeeded", "Failed", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.ProvisioningState
    """

    dtc_enabled: Optional[bool] = rest_field(
        name="dtcEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Active status of managed instance DTC."""
    security_settings: Optional["_models.ManagedInstanceDtcSecuritySettings"] = rest_field(
        name="securitySettings", visibility=["read", "create", "update", "delete", "query"]
    )
    """Security settings of managed instance DTC."""
    external_dns_suffix_search_list: Optional[list[str]] = rest_field(
        name="externalDnsSuffixSearchList", visibility=["read", "create", "update", "delete", "query"]
    )
    """External dns suffix search list of managed instance DTC."""
    dtc_host_name_dns_suffix: Optional[str] = rest_field(name="dtcHostNameDnsSuffix", visibility=["read"])
    """Host name dns suffix of managed instance DTC."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state of managed instance DTC. Known values are: \"Created\", \"InProgress\",
     \"Succeeded\", \"Failed\", and \"Canceled\"."""

    @overload
    def __init__(
        self,
        *,
        dtc_enabled: Optional[bool] = None,
        security_settings: Optional["_models.ManagedInstanceDtcSecuritySettings"] = None,
        external_dns_suffix_search_list: 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 ManagedInstanceDtcSecuritySettings(_Model):
    """The Security Settings of managed instance DTC.

    :ivar transaction_manager_communication_settings: Transaction Manager communication settings of
     managed instance DTC.
    :vartype transaction_manager_communication_settings:
     ~azure.mgmt.sql.models.ManagedInstanceDtcTransactionManagerCommunicationSettings
    :ivar xa_transactions_enabled: Allow XA Transactions to managed instance DTC.
    :vartype xa_transactions_enabled: bool
    :ivar sna_lu6_point2_transactions_enabled: Allow SNA LU 6.2 Transactions to managed instance
     DTC.
    :vartype sna_lu6_point2_transactions_enabled: bool
    :ivar xa_transactions_default_timeout: Default timeout for XA Transactions (in seconds).
    :vartype xa_transactions_default_timeout: int
    :ivar xa_transactions_maximum_timeout: Maximum timeout for XA Transactions (in seconds).
    :vartype xa_transactions_maximum_timeout: int
    """

    transaction_manager_communication_settings: Optional[
        "_models.ManagedInstanceDtcTransactionManagerCommunicationSettings"
    ] = rest_field(
        name="transactionManagerCommunicationSettings", visibility=["read", "create", "update", "delete", "query"]
    )
    """Transaction Manager communication settings of managed instance DTC."""
    xa_transactions_enabled: Optional[bool] = rest_field(
        name="xaTransactionsEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Allow XA Transactions to managed instance DTC."""
    sna_lu6_point2_transactions_enabled: Optional[bool] = rest_field(
        name="snaLu6point2TransactionsEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Allow SNA LU 6.2 Transactions to managed instance DTC."""
    xa_transactions_default_timeout: Optional[int] = rest_field(
        name="xaTransactionsDefaultTimeout", visibility=["read", "create", "update", "delete", "query"]
    )
    """Default timeout for XA Transactions (in seconds)."""
    xa_transactions_maximum_timeout: Optional[int] = rest_field(
        name="xaTransactionsMaximumTimeout", visibility=["read", "create", "update", "delete", "query"]
    )
    """Maximum timeout for XA Transactions (in seconds)."""

    @overload
    def __init__(
        self,
        *,
        transaction_manager_communication_settings: Optional[
            "_models.ManagedInstanceDtcTransactionManagerCommunicationSettings"
        ] = None,
        xa_transactions_enabled: Optional[bool] = None,
        sna_lu6_point2_transactions_enabled: Optional[bool] = None,
        xa_transactions_default_timeout: Optional[int] = None,
        xa_transactions_maximum_timeout: 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 ManagedInstanceDtcTransactionManagerCommunicationSettings(_Model):  # pylint: disable=name-too-long
    """The Transaction Manager Communication Settings of managed instance DTC.

    :ivar allow_inbound_enabled: Allow Inbound traffic to managed instance DTC.
    :vartype allow_inbound_enabled: bool
    :ivar allow_outbound_enabled: Allow Outbound traffic of managed instance DTC.
    :vartype allow_outbound_enabled: bool
    :ivar authentication: Authentication type of managed instance DTC.
    :vartype authentication: str
    """

    allow_inbound_enabled: Optional[bool] = rest_field(
        name="allowInboundEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Allow Inbound traffic to managed instance DTC."""
    allow_outbound_enabled: Optional[bool] = rest_field(
        name="allowOutboundEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Allow Outbound traffic of managed instance DTC."""
    authentication: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Authentication type of managed instance DTC."""

    @overload
    def __init__(
        self,
        *,
        allow_inbound_enabled: Optional[bool] = None,
        allow_outbound_enabled: Optional[bool] = None,
        authentication: 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 ManagedInstanceEditionCapability(_Model):
    """The managed server capability.

    :ivar name: The managed server version name.
    :vartype name: str
    :ivar is_general_purpose_v2: Whether or not this is a GPv2 variant of General Purpose edition.
    :vartype is_general_purpose_v2: bool
    :ivar supported_families: The supported families.
    :vartype supported_families: list[~azure.mgmt.sql.models.ManagedInstanceFamilyCapability]
    :ivar supported_storage_capabilities: The list of supported storage capabilities for this
     edition.
    :vartype supported_storage_capabilities: list[~azure.mgmt.sql.models.StorageCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The managed server version name."""
    is_general_purpose_v2: Optional[bool] = rest_field(name="isGeneralPurposeV2", visibility=["read"])
    """Whether or not this is a GPv2 variant of General Purpose edition."""
    supported_families: Optional[list["_models.ManagedInstanceFamilyCapability"]] = rest_field(
        name="supportedFamilies", visibility=["read"]
    )
    """The supported families."""
    supported_storage_capabilities: Optional[list["_models.StorageCapability"]] = rest_field(
        name="supportedStorageCapabilities", visibility=["read"]
    )
    """The list of supported storage capabilities for this edition."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ManagedInstanceEncryptionProtector(ProxyResource):
    """The managed instance encryption protector.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceEncryptionProtectorProperties
    :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal
     experience.
    :vartype kind: str
    """

    properties: Optional["_models.ManagedInstanceEncryptionProtectorProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Kind of encryption protector. This is metadata used for the Azure portal experience."""

    __flattened_items = ["server_key_name", "server_key_type", "uri", "thumbprint", "auto_rotation_enabled"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceEncryptionProtectorProperties"] = 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 ManagedInstanceEncryptionProtectorProperties(_Model):  # pylint: disable=name-too-long
    """Properties for an encryption protector execution.

    :ivar server_key_name: The name of the managed instance key.
    :vartype server_key_name: str
    :ivar server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'.
     Required. Known values are: "ServiceManaged" and "AzureKeyVault".
    :vartype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
    :ivar uri: The URI of the server key.
    :vartype uri: str
    :ivar thumbprint: Thumbprint of the server key.
    :vartype thumbprint: str
    :ivar auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
    :vartype auto_rotation_enabled: bool
    """

    server_key_name: Optional[str] = rest_field(
        name="serverKeyName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The name of the managed instance key."""
    server_key_type: Union[str, "_models.ServerKeyType"] = rest_field(
        name="serverKeyType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Required. Known values
     are: \"ServiceManaged\" and \"AzureKeyVault\"."""
    uri: Optional[str] = rest_field(visibility=["read"])
    """The URI of the server key."""
    thumbprint: Optional[str] = rest_field(visibility=["read"])
    """Thumbprint of the server key."""
    auto_rotation_enabled: Optional[bool] = rest_field(
        name="autoRotationEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Key auto rotation opt-in flag. Either true or false."""

    @overload
    def __init__(
        self,
        *,
        server_key_type: Union[str, "_models.ServerKeyType"],
        server_key_name: Optional[str] = None,
        auto_rotation_enabled: Optional[bool] = 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 ManagedInstanceExternalAdministrator(_Model):
    """Properties of a active directory administrator.

    :ivar administrator_type: Type of the sever administrator. "ActiveDirectory"
    :vartype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
    :ivar principal_type: Principal Type of the sever administrator. Known values are: "User",
     "Group", and "Application".
    :vartype principal_type: str or ~azure.mgmt.sql.models.PrincipalType
    :ivar login: Login name of the server administrator.
    :vartype login: str
    :ivar sid: SID (object ID) of the server administrator.
    :vartype sid: str
    :ivar tenant_id: Tenant ID of the administrator.
    :vartype tenant_id: str
    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
    :vartype azure_ad_only_authentication: bool
    """

    administrator_type: Optional[Union[str, "_models.AdministratorType"]] = rest_field(
        name="administratorType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the sever administrator. \"ActiveDirectory\""""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Principal Type of the sever administrator. Known values are: \"User\", \"Group\", and
     \"Application\"."""
    login: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Login name of the server administrator."""
    sid: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """SID (object ID) of the server administrator."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"])
    """Tenant ID of the administrator."""
    azure_ad_only_authentication: Optional[bool] = rest_field(
        name="azureADOnlyAuthentication", visibility=["read", "create", "update", "delete", "query"]
    )
    """Azure Active Directory only Authentication enabled."""

    @overload
    def __init__(
        self,
        *,
        administrator_type: Optional[Union[str, "_models.AdministratorType"]] = None,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        login: Optional[str] = None,
        sid: Optional[str] = None,
        tenant_id: Optional[str] = None,
        azure_ad_only_authentication: Optional[bool] = 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 ManagedInstanceFamilyCapability(_Model):
    """The managed server family capability.

    :ivar name: Family name.
    :vartype name: str
    :ivar sku: SKU name.
    :vartype sku: str
    :ivar zone_redundant: Whether or not zone redundancy is supported for the family.
    :vartype zone_redundant: bool
    :ivar supported_license_types: List of supported license types.
    :vartype supported_license_types: list[~azure.mgmt.sql.models.LicenseTypeCapability]
    :ivar supported_vcores_values: List of supported virtual cores values.
    :vartype supported_vcores_values: list[~azure.mgmt.sql.models.ManagedInstanceVcoresCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """Family name."""
    sku: Optional[str] = rest_field(visibility=["read"])
    """SKU name."""
    zone_redundant: Optional[bool] = rest_field(name="zoneRedundant", visibility=["read"])
    """Whether or not zone redundancy is supported for the family."""
    supported_license_types: Optional[list["_models.LicenseTypeCapability"]] = rest_field(
        name="supportedLicenseTypes", visibility=["read"]
    )
    """List of supported license types."""
    supported_vcores_values: Optional[list["_models.ManagedInstanceVcoresCapability"]] = rest_field(
        name="supportedVcoresValues", visibility=["read"]
    )
    """List of supported virtual cores values."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ManagedInstanceKey(ProxyResource):
    """A managed instance key.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceKeyProperties
    :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal
     experience.
    :vartype kind: str
    """

    properties: Optional["_models.ManagedInstanceKeyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Kind of encryption protector. This is metadata used for the Azure portal experience."""

    __flattened_items = ["server_key_type", "uri", "thumbprint", "creation_date", "auto_rotation_enabled"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceKeyProperties"] = 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 ManagedInstanceKeyProperties(_Model):
    """Properties for a key execution.

    :ivar server_key_type: The key type like 'ServiceManaged', 'AzureKeyVault'. Required. Known
     values are: "ServiceManaged" and "AzureKeyVault".
    :vartype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
    :ivar uri: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required.
    :vartype uri: str
    :ivar thumbprint: Thumbprint of the key.
    :vartype thumbprint: str
    :ivar creation_date: The key creation date.
    :vartype creation_date: ~datetime.datetime
    :ivar auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
    :vartype auto_rotation_enabled: bool
    """

    server_key_type: Union[str, "_models.ServerKeyType"] = rest_field(name="serverKeyType", visibility=["create"])
    """The key type like 'ServiceManaged', 'AzureKeyVault'. Required. Known values are:
     \"ServiceManaged\" and \"AzureKeyVault\"."""
    uri: Optional[str] = rest_field(visibility=["create"])
    """The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required."""
    thumbprint: Optional[str] = rest_field(visibility=["read"])
    """Thumbprint of the key."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """The key creation date."""
    auto_rotation_enabled: Optional[bool] = rest_field(name="autoRotationEnabled", visibility=["read"])
    """Key auto rotation opt-in flag. Either true or false."""

    @overload
    def __init__(
        self,
        *,
        server_key_type: Union[str, "_models.ServerKeyType"],
        uri: 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 ManagedInstanceLongTermRetentionBackup(ProxyResource):
    """A long term retention backup for a managed database.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackupProperties
    """

    properties: Optional["_models.ManagedInstanceLongTermRetentionBackupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "managed_instance_name",
        "managed_instance_create_time",
        "database_name",
        "database_deletion_time",
        "backup_time",
        "backup_expiration_time",
        "backup_storage_redundancy",
        "backup_storage_access_tier",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceLongTermRetentionBackupProperties"] = 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 ManagedInstanceLongTermRetentionBackupProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a long term retention backup.

    :ivar managed_instance_name: The managed instance that the backup database belongs to.
    :vartype managed_instance_name: str
    :ivar managed_instance_create_time: The create time of the instance.
    :vartype managed_instance_create_time: ~datetime.datetime
    :ivar database_name: The name of the database the backup belong to.
    :vartype database_name: str
    :ivar database_deletion_time: The delete time of the database.
    :vartype database_deletion_time: ~datetime.datetime
    :ivar backup_time: The time the backup was taken.
    :vartype backup_time: ~datetime.datetime
    :ivar backup_expiration_time: The time the long term retention backup will expire.
    :vartype backup_expiration_time: ~datetime.datetime
    :ivar backup_storage_redundancy: The storage redundancy type of the backup. Known values are:
     "Geo", "Local", "Zone", and "GeoZone".
    :vartype backup_storage_redundancy: str or ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar backup_storage_access_tier: The BackupStorageAccessTier for the LTR backup. Known values
     are: "Hot" and "Archive".
    :vartype backup_storage_access_tier: str or ~azure.mgmt.sql.models.BackupStorageAccessTier
    """

    managed_instance_name: Optional[str] = rest_field(name="managedInstanceName", visibility=["read"])
    """The managed instance that the backup database belongs to."""
    managed_instance_create_time: Optional[datetime.datetime] = rest_field(
        name="managedInstanceCreateTime", visibility=["read"], format="rfc3339"
    )
    """The create time of the instance."""
    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """The name of the database the backup belong to."""
    database_deletion_time: Optional[datetime.datetime] = rest_field(
        name="databaseDeletionTime", visibility=["read"], format="rfc3339"
    )
    """The delete time of the database."""
    backup_time: Optional[datetime.datetime] = rest_field(name="backupTime", visibility=["read"], format="rfc3339")
    """The time the backup was taken."""
    backup_expiration_time: Optional[datetime.datetime] = rest_field(
        name="backupExpirationTime", visibility=["read"], format="rfc3339"
    )
    """The time the long term retention backup will expire."""
    backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="backupStorageRedundancy", visibility=["read"]
    )
    """The storage redundancy type of the backup. Known values are: \"Geo\", \"Local\", \"Zone\", and
     \"GeoZone\"."""
    backup_storage_access_tier: Optional[Union[str, "_models.BackupStorageAccessTier"]] = rest_field(
        name="backupStorageAccessTier", visibility=["read"]
    )
    """The BackupStorageAccessTier for the LTR backup. Known values are: \"Hot\" and \"Archive\"."""


class ManagedInstanceLongTermRetentionPolicy(ProxyResource):
    """A long term retention policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicyProperties
    """

    properties: Optional["_models.ManagedInstanceLongTermRetentionPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "backup_storage_access_tier",
        "weekly_retention",
        "monthly_retention",
        "yearly_retention",
        "week_of_year",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceLongTermRetentionPolicyProperties"] = 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 ManagedInstanceLongTermRetentionPolicyProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a long term retention policy.

    :ivar backup_storage_access_tier: The BackupStorageAccessTier for the LTR backups. Known values
     are: "Hot" and "Archive".
    :vartype backup_storage_access_tier: str or ~azure.mgmt.sql.models.BackupStorageAccessTier
    :ivar weekly_retention: The weekly retention policy for an LTR backup in an ISO 8601 format.
    :vartype weekly_retention: str
    :ivar monthly_retention: The monthly retention policy for an LTR backup in an ISO 8601 format.
    :vartype monthly_retention: str
    :ivar yearly_retention: The yearly retention policy for an LTR backup in an ISO 8601 format.
    :vartype yearly_retention: str
    :ivar week_of_year: The week of year to take the yearly backup in an ISO 8601 format.
    :vartype week_of_year: int
    """

    backup_storage_access_tier: Optional[Union[str, "_models.BackupStorageAccessTier"]] = rest_field(
        name="backupStorageAccessTier", visibility=["read", "create", "update", "delete", "query"]
    )
    """The BackupStorageAccessTier for the LTR backups. Known values are: \"Hot\" and \"Archive\"."""
    weekly_retention: Optional[str] = rest_field(
        name="weeklyRetention", visibility=["read", "create", "update", "delete", "query"]
    )
    """The weekly retention policy for an LTR backup in an ISO 8601 format."""
    monthly_retention: Optional[str] = rest_field(
        name="monthlyRetention", visibility=["read", "create", "update", "delete", "query"]
    )
    """The monthly retention policy for an LTR backup in an ISO 8601 format."""
    yearly_retention: Optional[str] = rest_field(
        name="yearlyRetention", visibility=["read", "create", "update", "delete", "query"]
    )
    """The yearly retention policy for an LTR backup in an ISO 8601 format."""
    week_of_year: Optional[int] = rest_field(
        name="weekOfYear", visibility=["read", "create", "update", "delete", "query"]
    )
    """The week of year to take the yearly backup in an ISO 8601 format."""

    @overload
    def __init__(
        self,
        *,
        backup_storage_access_tier: Optional[Union[str, "_models.BackupStorageAccessTier"]] = None,
        weekly_retention: Optional[str] = None,
        monthly_retention: Optional[str] = None,
        yearly_retention: Optional[str] = None,
        week_of_year: 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 ManagedInstanceMaintenanceConfigurationCapability(_Model):  # pylint: disable=name-too-long
    """The maintenance configuration capability.

    :ivar name: Maintenance configuration name.
    :vartype name: str
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """Maintenance configuration name."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ManagedInstanceOperation(ProxyResource):
    """A managed instance operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceOperationProperties
    """

    properties: Optional["_models.ManagedInstanceOperationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "managed_instance_name",
        "operation",
        "operation_friendly_name",
        "percent_complete",
        "start_time",
        "state",
        "error_code",
        "error_description",
        "error_severity",
        "is_user_error",
        "estimated_completion_time",
        "description",
        "is_cancellable",
        "operation_parameters",
        "operation_steps",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceOperationProperties"] = 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 ManagedInstanceOperationParametersPair(_Model):
    """The parameters of a managed instance operation.

    :ivar current_parameters: The current parameters.
    :vartype current_parameters: ~azure.mgmt.sql.models.UpsertManagedServerOperationParameters
    :ivar requested_parameters: The requested parameters.
    :vartype requested_parameters: ~azure.mgmt.sql.models.UpsertManagedServerOperationParameters
    """

    current_parameters: Optional["_models.UpsertManagedServerOperationParameters"] = rest_field(
        name="currentParameters", visibility=["read"]
    )
    """The current parameters."""
    requested_parameters: Optional["_models.UpsertManagedServerOperationParameters"] = rest_field(
        name="requestedParameters", visibility=["read"]
    )
    """The requested parameters."""


class ManagedInstanceOperationProperties(_Model):
    """The properties of a managed instance operation.

    :ivar managed_instance_name: The name of the managed instance the operation is being performed
     on.
    :vartype managed_instance_name: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    :ivar operation_parameters: The operation parameters.
    :vartype operation_parameters: ~azure.mgmt.sql.models.ManagedInstanceOperationParametersPair
    :ivar operation_steps: The operation steps.
    :vartype operation_steps: ~azure.mgmt.sql.models.ManagedInstanceOperationSteps
    """

    managed_instance_name: Optional[str] = rest_field(name="managedInstanceName", visibility=["read"])
    """The name of the managed instance the operation is being performed on."""
    operation: Optional[str] = rest_field(visibility=["read"])
    """The name of operation."""
    operation_friendly_name: Optional[str] = rest_field(name="operationFriendlyName", visibility=["read"])
    """The friendly name of operation."""
    percent_complete: Optional[int] = rest_field(name="percentComplete", visibility=["read"])
    """The percentage of the operation completed."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The operation start time."""
    state: Optional[Union[str, "_models.ManagementOperationState"]] = rest_field(visibility=["read"])
    """The operation state. Known values are: \"Pending\", \"InProgress\", \"Succeeded\", \"Failed\",
     \"CancelInProgress\", and \"Cancelled\"."""
    error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"])
    """The operation error code."""
    error_description: Optional[str] = rest_field(name="errorDescription", visibility=["read"])
    """The operation error description."""
    error_severity: Optional[int] = rest_field(name="errorSeverity", visibility=["read"])
    """The operation error severity."""
    is_user_error: Optional[bool] = rest_field(name="isUserError", visibility=["read"])
    """Whether or not the error is a user error."""
    estimated_completion_time: Optional[datetime.datetime] = rest_field(
        name="estimatedCompletionTime", visibility=["read"], format="rfc3339"
    )
    """The estimated completion time of the operation."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The operation description."""
    is_cancellable: Optional[bool] = rest_field(name="isCancellable", visibility=["read"])
    """Whether the operation can be cancelled."""
    operation_parameters: Optional["_models.ManagedInstanceOperationParametersPair"] = rest_field(
        name="operationParameters", visibility=["read"]
    )
    """The operation parameters."""
    operation_steps: Optional["_models.ManagedInstanceOperationSteps"] = rest_field(
        name="operationSteps", visibility=["read"]
    )
    """The operation steps."""


class ManagedInstanceOperationSteps(_Model):
    """The steps of a managed instance operation.

    :ivar total_steps: The total number of operation steps.
    :vartype total_steps: str
    :ivar current_step: The number of current operation steps.
    :vartype current_step: int
    :ivar steps_list: The operation steps list.
    :vartype steps_list:
     list[~azure.mgmt.sql.models.UpsertManagedServerOperationStepWithEstimatesAndDuration]
    """

    total_steps: Optional[str] = rest_field(name="totalSteps", visibility=["read"])
    """The total number of operation steps."""
    current_step: Optional[int] = rest_field(name="currentStep", visibility=["read"])
    """The number of current operation steps."""
    steps_list: Optional[list["_models.UpsertManagedServerOperationStepWithEstimatesAndDuration"]] = rest_field(
        name="stepsList", visibility=["read"]
    )
    """The operation steps list."""


class ManagedInstancePairInfo(_Model):
    """Pairs of Managed Instances in the failover group.

    :ivar primary_managed_instance_id: Id of Primary Managed Instance in pair.
    :vartype primary_managed_instance_id: str
    :ivar partner_managed_instance_id: Id of Partner Managed Instance in pair.
    :vartype partner_managed_instance_id: str
    """

    primary_managed_instance_id: Optional[str] = rest_field(
        name="primaryManagedInstanceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Id of Primary Managed Instance in pair."""
    partner_managed_instance_id: Optional[str] = rest_field(
        name="partnerManagedInstanceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Id of Partner Managed Instance in pair."""

    @overload
    def __init__(
        self,
        *,
        primary_managed_instance_id: Optional[str] = None,
        partner_managed_instance_id: 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 ManagedInstancePecProperty(_Model):
    """A private endpoint connection under a managed instance.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar properties: Private endpoint connection properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointConnectionProperties
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """Resource ID."""
    properties: Optional["_models.ManagedInstancePrivateEndpointConnectionProperties"] = rest_field(visibility=["read"])
    """Private endpoint connection properties."""


class ManagedInstancePrivateEndpointConnection(ProxyResource):
    """A private endpoint connection.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointConnectionProperties
    """

    properties: Optional["_models.ManagedInstancePrivateEndpointConnectionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["private_endpoint", "private_link_service_connection_state", "provisioning_state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstancePrivateEndpointConnectionProperties"] = 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 ManagedInstancePrivateEndpointConnectionProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a private endpoint connection.

    :ivar private_endpoint: Private endpoint which the connection belongs to.
    :vartype private_endpoint: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointProperty
    :ivar private_link_service_connection_state: Connection State of the Private Endpoint
     Connection.
    :vartype private_link_service_connection_state:
     ~azure.mgmt.sql.models.ManagedInstancePrivateLinkServiceConnectionStateProperty
    :ivar provisioning_state: State of the Private Endpoint Connection.
    :vartype provisioning_state: str
    """

    private_endpoint: Optional["_models.ManagedInstancePrivateEndpointProperty"] = rest_field(
        name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Private endpoint which the connection belongs to."""
    private_link_service_connection_state: Optional[
        "_models.ManagedInstancePrivateLinkServiceConnectionStateProperty"
    ] = rest_field(name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"])
    """Connection State of the Private Endpoint Connection."""
    provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"])
    """State of the Private Endpoint Connection."""

    @overload
    def __init__(
        self,
        *,
        private_endpoint: Optional["_models.ManagedInstancePrivateEndpointProperty"] = None,
        private_link_service_connection_state: Optional[
            "_models.ManagedInstancePrivateLinkServiceConnectionStateProperty"
        ] = 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 ManagedInstancePrivateEndpointProperty(_Model):
    """ManagedInstancePrivateEndpointProperty.

    :ivar id: Resource id of the private endpoint.
    :vartype id: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource id of the private endpoint."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = 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 ManagedInstancePrivateLink(ProxyResource):
    """A private link 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.sql.models.SystemData
    :ivar properties: The private link resource group id.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstancePrivateLinkProperties
    """

    properties: Optional["_models.ManagedInstancePrivateLinkProperties"] = rest_field(visibility=["read"])
    """The private link resource group id."""


class ManagedInstancePrivateLinkProperties(_Model):
    """Properties of a private link resource.

    :ivar group_id: The private link resource group id.
    :vartype group_id: str
    :ivar required_members: The private link resource required member names.
    :vartype required_members: list[str]
    :ivar required_zone_names: The private link resource required zone names.
    :vartype required_zone_names: list[str]
    """

    group_id: Optional[str] = rest_field(name="groupId", visibility=["read"])
    """The private link resource group id."""
    required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"])
    """The private link resource required member names."""
    required_zone_names: Optional[list[str]] = rest_field(name="requiredZoneNames", visibility=["read"])
    """The private link resource required zone names."""


class ManagedInstancePrivateLinkServiceConnectionStateProperty(_Model):  # pylint: disable=name-too-long
    """ManagedInstancePrivateLinkServiceConnectionStateProperty.

    :ivar status: The private link service connection status. Required.
    :vartype status: str
    :ivar description: The private link service connection description. Required.
    :vartype description: str
    :ivar actions_required: The private link service connection description.
    :vartype actions_required: str
    """

    status: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The private link service connection status. Required."""
    description: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The private link service connection description. Required."""
    actions_required: Optional[str] = rest_field(name="actionsRequired", visibility=["read"])
    """The private link service connection description."""

    @overload
    def __init__(
        self,
        *,
        status: str,
        description: str,
    ) -> 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 ManagedInstanceProperties(_Model):
    """The properties of a managed instance.

    :ivar provisioning_state: Provisioning state of managed instance. Known values are: "Created",
     "InProgress", "Succeeded", "Failed", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.ProvisioningState
    :ivar managed_instance_create_mode: Specifies the mode of database creation.

     Default: Regular instance creation.

     Restore: Creates an instance by restoring a set of backups to specific point in time.
     RestorePointInTime and SourceManagedInstanceId must be specified. Known values are: "Default"
     and "PointInTimeRestore".
    :vartype managed_instance_create_mode: str or ~azure.mgmt.sql.models.ManagedServerCreateMode
    :ivar fully_qualified_domain_name: The fully qualified domain name of the managed instance.
    :vartype fully_qualified_domain_name: str
    :ivar is_general_purpose_v2: Whether or not this is a GPv2 variant of General Purpose edition.
    :vartype is_general_purpose_v2: bool
    :ivar administrator_login: Administrator username for the managed instance. Can only be
     specified when the managed instance is being created (and is required for creation).
    :vartype administrator_login: str
    :ivar administrator_login_password: The administrator login password (required for managed
     instance creation).
    :vartype administrator_login_password: str
    :ivar subnet_id: Subnet resource ID for the managed instance.
    :vartype subnet_id: str
    :ivar state: The state of the managed instance.
    :vartype state: str
    :ivar license_type: The license type. Possible values are 'LicenseIncluded' (regular price
     inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL
     licenses). Known values are: "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType
    :ivar hybrid_secondary_usage: Hybrid secondary usage. Possible values are 'Active' (default
     value) and 'Passive' (customer uses the secondary as Passive DR). Known values are: "Active"
     and "Passive".
    :vartype hybrid_secondary_usage: str or ~azure.mgmt.sql.models.HybridSecondaryUsage
    :ivar hybrid_secondary_usage_detected: Hybrid secondary usage detected. Possible values are
     'Active' (customer does not meet the requirements to use the secondary as Passive DR) and
     'Passive' (customer meets the requirements to use the secondary as Passive DR). Known values
     are: "Active" and "Passive".
    :vartype hybrid_secondary_usage_detected: str or
     ~azure.mgmt.sql.models.HybridSecondaryUsageDetected
    :ivar v_cores: The number of vCores. Allowed values: 4, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48,
     56, 64, 80, 96, 128. Supported vCores depends on the selected hardware family and service tier.
    :vartype v_cores: int
    :ivar storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 32768.
     Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and
     number of vCores.
    :vartype storage_size_in_gb: int
    :ivar storage_i_ops: Storage IOps. Minimum value: 300. Maximum value: 80000. Increments of 1
     IOps allowed only. Maximum value depends on the selected hardware family and number of vCores.
    :vartype storage_i_ops: int
    :ivar storage_throughput_m_bps: Storage throughput MBps parameter is not supported in the
     instance create/update operation.
    :vartype storage_throughput_m_bps: int
    :ivar memory_size_in_gb: Memory size in GB. Minimum value: 28. Maximum value: 870. Minimum and
     maximum value depend on the number of vCores and service tier. Read more about resource limits:
     `https://aka.ms/mi-resource-limits-api <https://aka.ms/mi-resource-limits-api>`_.
    :vartype memory_size_in_gb: int
    :ivar collation: Collation of the managed instance.
    :vartype collation: str
    :ivar dns_zone: The Dns Zone that the managed instance is in.
    :vartype dns_zone: str
    :ivar dns_zone_partner: The resource id of another managed instance whose DNS zone this managed
     instance will share after creation.
    :vartype dns_zone_partner: str
    :ivar public_data_endpoint_enabled: Whether or not the public data endpoint is enabled.
    :vartype public_data_endpoint_enabled: bool
    :ivar source_managed_instance_id: The resource identifier of the source managed instance
     associated with create operation of this instance.
    :vartype source_managed_instance_id: str
    :ivar restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
     database that will be restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar proxy_override: Connection type used for connecting to the instance. Known values are:
     "Proxy", "Redirect", and "Default".
    :vartype proxy_override: str or ~azure.mgmt.sql.models.ManagedInstanceProxyOverride
    :ivar timezone_id: Id of the timezone. Allowed values are timezones supported by Windows.
     Windows keeps details on supported timezones, including the id, in registry under
     KEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones. You can get
     those registry values via SQL Server by querying SELECT name AS timezone_id FROM
     sys.time_zone_info. List of Ids can also be obtained by executing
     [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is
     "Pacific Standard Time" or "W. Europe Standard Time".
    :vartype timezone_id: str
    :ivar instance_pool_id: The Id of the instance pool this managed server belongs to.
    :vartype instance_pool_id: str
    :ivar maintenance_configuration_id: Specifies maintenance configuration id to apply to this
     managed instance.
    :vartype maintenance_configuration_id: str
    :ivar private_endpoint_connections: List of private endpoint connections on a managed instance.
    :vartype private_endpoint_connections: list[~azure.mgmt.sql.models.ManagedInstancePecProperty]
    :ivar minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'.
    :vartype minimal_tls_version: str
    :ivar current_backup_storage_redundancy: The storage account type used to store backups for
     this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage),
     Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Known values are: "Geo",
     "Local", "Zone", and "GeoZone".
    :vartype current_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage account type to be used to store backups
     for this instance. The options are Local (LocallyRedundantStorage), Zone
     (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar zone_redundant: Whether or not the zone-redundancy is enabled.
    :vartype zone_redundant: bool
    :ivar primary_user_assigned_identity_id: The resource id of a user assigned identity to be used
     by default.
    :vartype primary_user_assigned_identity_id: str
    :ivar key_id: A CMK URI of the key to use for encryption.
    :vartype key_id: str
    :ivar administrators: The Azure Active Directory administrator can be utilized during instance
     creation and for instance updates, except for the azureADOnlyAuthentication property. To update
     the azureADOnlyAuthentication property, individual API must be used.
    :vartype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator
    :ivar service_principal: The managed instance's service principal.
    :vartype service_principal: ~azure.mgmt.sql.models.ServicePrincipal
    :ivar virtual_cluster_id: Virtual cluster resource id for the Managed Instance.
    :vartype virtual_cluster_id: str
    :ivar external_governance_status: Status of external governance. Known values are: "Enabled"
     and "Disabled".
    :vartype external_governance_status: str or ~azure.mgmt.sql.models.ExternalGovernanceStatus
    :ivar pricing_model: Pricing model of Managed Instance. Known values are: "Regular" and
     "Freemium".
    :vartype pricing_model: str or ~azure.mgmt.sql.models.PricingModel
    :ivar create_time: Specifies the point in time (ISO8601 format) of the Managed Instance
     creation.
    :vartype create_time: ~datetime.datetime
    :ivar authentication_metadata: The managed instance's authentication metadata lookup mode.
     Known values are: "AzureAD", "Paired", and "Windows".
    :vartype authentication_metadata: str or ~azure.mgmt.sql.models.AuthMetadataLookupModes
    :ivar database_format: Specifies the internal format of instance databases specific to the SQL
     engine version. Known values are: "AlwaysUpToDate", "SQLServer2022", and "SQLServer2025".
    :vartype database_format: str or ~azure.mgmt.sql.models.ManagedInstanceDatabaseFormat
    :ivar requested_logical_availability_zone: Specifies the logical availability zone Managed
     Instance is pinned to. Known values are: "NoPreference", "1", "2", and "3".
    :vartype requested_logical_availability_zone: str or
     ~azure.mgmt.sql.models.AvailabilityZoneType
    """

    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state of managed instance. Known values are: \"Created\", \"InProgress\",
     \"Succeeded\", \"Failed\", and \"Canceled\"."""
    managed_instance_create_mode: Optional[Union[str, "_models.ManagedServerCreateMode"]] = rest_field(
        name="managedInstanceCreateMode", visibility=["create"]
    )
    """Specifies the mode of database creation.
     
     Default: Regular instance creation.
     
     Restore: Creates an instance by restoring a set of backups to specific point in time.
     RestorePointInTime and SourceManagedInstanceId must be specified. Known values are: \"Default\"
     and \"PointInTimeRestore\"."""
    fully_qualified_domain_name: Optional[str] = rest_field(name="fullyQualifiedDomainName", visibility=["read"])
    """The fully qualified domain name of the managed instance."""
    is_general_purpose_v2: Optional[bool] = rest_field(
        name="isGeneralPurposeV2", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not this is a GPv2 variant of General Purpose edition."""
    administrator_login: Optional[str] = rest_field(name="administratorLogin", visibility=["read", "create"])
    """Administrator username for the managed instance. Can only be specified when the managed
     instance is being created (and is required for creation)."""
    administrator_login_password: Optional[str] = rest_field(
        name="administratorLoginPassword", visibility=["create", "update"]
    )
    """The administrator login password (required for managed instance creation)."""
    subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"])
    """Subnet resource ID for the managed instance."""
    state: Optional[str] = rest_field(visibility=["read"])
    """The state of the managed instance."""
    license_type: Optional[Union[str, "_models.ManagedInstanceLicenseType"]] = rest_field(
        name="licenseType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL
     license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Known
     values are: \"LicenseIncluded\" and \"BasePrice\"."""
    hybrid_secondary_usage: Optional[Union[str, "_models.HybridSecondaryUsage"]] = rest_field(
        name="hybridSecondaryUsage", visibility=["read", "create", "update", "delete", "query"]
    )
    """Hybrid secondary usage. Possible values are 'Active' (default value) and 'Passive' (customer
     uses the secondary as Passive DR). Known values are: \"Active\" and \"Passive\"."""
    hybrid_secondary_usage_detected: Optional[Union[str, "_models.HybridSecondaryUsageDetected"]] = rest_field(
        name="hybridSecondaryUsageDetected", visibility=["read"]
    )
    """Hybrid secondary usage detected. Possible values are 'Active' (customer does not meet the
     requirements to use the secondary as Passive DR) and 'Passive' (customer meets the requirements
     to use the secondary as Passive DR). Known values are: \"Active\" and \"Passive\"."""
    v_cores: Optional[int] = rest_field(name="vCores", visibility=["read", "create", "update", "delete", "query"])
    """The number of vCores. Allowed values: 4, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64, 80, 96,
     128. Supported vCores depends on the selected hardware family and service tier."""
    storage_size_in_gb: Optional[int] = rest_field(
        name="storageSizeInGB", visibility=["read", "create", "update", "delete", "query"]
    )
    """Storage size in GB. Minimum value: 32. Maximum value: 32768. Increments of 32 GB allowed only.
     Maximum value depends on the selected hardware family and number of vCores."""
    storage_i_ops: Optional[int] = rest_field(
        name="storageIOps", visibility=["read", "create", "update", "delete", "query"]
    )
    """Storage IOps. Minimum value: 300. Maximum value: 80000. Increments of 1 IOps allowed only.
     Maximum value depends on the selected hardware family and number of vCores."""
    storage_throughput_m_bps: Optional[int] = rest_field(
        name="storageThroughputMBps", visibility=["read", "create", "update", "delete", "query"]
    )
    """Storage throughput MBps parameter is not supported in the instance create/update operation."""
    memory_size_in_gb: Optional[int] = rest_field(
        name="memorySizeInGB", visibility=["read", "create", "update", "delete", "query"]
    )
    """Memory size in GB. Minimum value: 28. Maximum value: 870. Minimum and maximum value depend on
     the number of vCores and service tier. Read more about resource limits:
     `https://aka.ms/mi-resource-limits-api <https://aka.ms/mi-resource-limits-api>`_."""
    collation: Optional[str] = rest_field(visibility=["read", "create"])
    """Collation of the managed instance."""
    dns_zone: Optional[str] = rest_field(name="dnsZone", visibility=["read"])
    """The Dns Zone that the managed instance is in."""
    dns_zone_partner: Optional[str] = rest_field(name="dnsZonePartner", visibility=["create"])
    """The resource id of another managed instance whose DNS zone this managed instance will share
     after creation."""
    public_data_endpoint_enabled: Optional[bool] = rest_field(
        name="publicDataEndpointEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not the public data endpoint is enabled."""
    source_managed_instance_id: Optional[str] = rest_field(name="sourceManagedInstanceId", visibility=["create"])
    """The resource identifier of the source managed instance associated with create operation of this
     instance."""
    restore_point_in_time: Optional[datetime.datetime] = rest_field(
        name="restorePointInTime", visibility=["create"], format="rfc3339"
    )
    """Specifies the point in time (ISO8601 format) of the source database that will be restored to
     create the new database."""
    proxy_override: Optional[Union[str, "_models.ManagedInstanceProxyOverride"]] = rest_field(
        name="proxyOverride", visibility=["read", "create", "update", "delete", "query"]
    )
    """Connection type used for connecting to the instance. Known values are: \"Proxy\", \"Redirect\",
     and \"Default\"."""
    timezone_id: Optional[str] = rest_field(name="timezoneId", visibility=["read", "create"])
    """Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps details on
     supported timezones, including the id, in registry under
     KEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones. You can get those
     registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info.
     List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in
     PowerShell. An example of valid timezone id is \"Pacific Standard Time\" or \"W. Europe
     Standard Time\"."""
    instance_pool_id: Optional[str] = rest_field(
        name="instancePoolId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The Id of the instance pool this managed server belongs to."""
    maintenance_configuration_id: Optional[str] = rest_field(
        name="maintenanceConfigurationId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies maintenance configuration id to apply to this managed instance."""
    private_endpoint_connections: Optional[list["_models.ManagedInstancePecProperty"]] = rest_field(
        name="privateEndpointConnections", visibility=["read"]
    )
    """List of private endpoint connections on a managed instance."""
    minimal_tls_version: Optional[str] = rest_field(
        name="minimalTlsVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'."""
    current_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="currentBackupStorageRedundancy", visibility=["read"]
    )
    """The storage account type used to store backups for this instance. The options are Local
     (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and
     GeoZone(GeoZoneRedundantStorage). Known values are: \"Geo\", \"Local\", \"Zone\", and
     \"GeoZone\"."""
    requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="requestedBackupStorageRedundancy", visibility=["read", "create", "update", "delete", "query"]
    )
    """The storage account type to be used to store backups for this instance. The options are Local
     (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and
     GeoZone(GeoZoneRedundantStorage). Known values are: \"Geo\", \"Local\", \"Zone\", and
     \"GeoZone\"."""
    zone_redundant: Optional[bool] = rest_field(
        name="zoneRedundant", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not the zone-redundancy is enabled."""
    primary_user_assigned_identity_id: Optional[str] = rest_field(
        name="primaryUserAssignedIdentityId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource id of a user assigned identity to be used by default."""
    key_id: Optional[str] = rest_field(name="keyId", visibility=["read", "create"])
    """A CMK URI of the key to use for encryption."""
    administrators: Optional["_models.ManagedInstanceExternalAdministrator"] = rest_field(visibility=["read", "create"])
    """The Azure Active Directory administrator can be utilized during instance creation and for
     instance updates, except for the azureADOnlyAuthentication property. To update the
     azureADOnlyAuthentication property, individual API must be used."""
    service_principal: Optional["_models.ServicePrincipal"] = rest_field(
        name="servicePrincipal", visibility=["read", "create", "update", "delete", "query"]
    )
    """The managed instance's service principal."""
    virtual_cluster_id: Optional[str] = rest_field(name="virtualClusterId", visibility=["read"])
    """Virtual cluster resource id for the Managed Instance."""
    external_governance_status: Optional[Union[str, "_models.ExternalGovernanceStatus"]] = rest_field(
        name="externalGovernanceStatus", visibility=["read"]
    )
    """Status of external governance. Known values are: \"Enabled\" and \"Disabled\"."""
    pricing_model: Optional[Union[str, "_models.PricingModel"]] = rest_field(
        name="pricingModel", visibility=["read", "create", "update", "delete", "query"]
    )
    """Pricing model of Managed Instance. Known values are: \"Regular\" and \"Freemium\"."""
    create_time: Optional[datetime.datetime] = rest_field(name="createTime", visibility=["read"], format="rfc3339")
    """Specifies the point in time (ISO8601 format) of the Managed Instance creation."""
    authentication_metadata: Optional[Union[str, "_models.AuthMetadataLookupModes"]] = rest_field(
        name="authenticationMetadata", visibility=["read", "create", "update", "delete", "query"]
    )
    """The managed instance's authentication metadata lookup mode. Known values are: \"AzureAD\",
     \"Paired\", and \"Windows\"."""
    database_format: Optional[Union[str, "_models.ManagedInstanceDatabaseFormat"]] = rest_field(
        name="databaseFormat", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the internal format of instance databases specific to the SQL engine version. Known
     values are: \"AlwaysUpToDate\", \"SQLServer2022\", and \"SQLServer2025\"."""
    requested_logical_availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = rest_field(
        name="requestedLogicalAvailabilityZone", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the logical availability zone Managed Instance is pinned to. Known values are:
     \"NoPreference\", \"1\", \"2\", and \"3\"."""

    @overload
    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        managed_instance_create_mode: Optional[Union[str, "_models.ManagedServerCreateMode"]] = None,
        is_general_purpose_v2: Optional[bool] = None,
        administrator_login: Optional[str] = None,
        administrator_login_password: Optional[str] = None,
        subnet_id: Optional[str] = None,
        license_type: Optional[Union[str, "_models.ManagedInstanceLicenseType"]] = None,
        hybrid_secondary_usage: Optional[Union[str, "_models.HybridSecondaryUsage"]] = None,
        v_cores: Optional[int] = None,
        storage_size_in_gb: Optional[int] = None,
        storage_i_ops: Optional[int] = None,
        storage_throughput_m_bps: Optional[int] = None,
        memory_size_in_gb: Optional[int] = None,
        collation: Optional[str] = None,
        dns_zone_partner: Optional[str] = None,
        public_data_endpoint_enabled: Optional[bool] = None,
        source_managed_instance_id: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        proxy_override: Optional[Union[str, "_models.ManagedInstanceProxyOverride"]] = None,
        timezone_id: Optional[str] = None,
        instance_pool_id: Optional[str] = None,
        maintenance_configuration_id: Optional[str] = None,
        minimal_tls_version: Optional[str] = None,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        zone_redundant: Optional[bool] = None,
        primary_user_assigned_identity_id: Optional[str] = None,
        key_id: Optional[str] = None,
        administrators: Optional["_models.ManagedInstanceExternalAdministrator"] = None,
        service_principal: Optional["_models.ServicePrincipal"] = None,
        pricing_model: Optional[Union[str, "_models.PricingModel"]] = None,
        authentication_metadata: Optional[Union[str, "_models.AuthMetadataLookupModes"]] = None,
        database_format: Optional[Union[str, "_models.ManagedInstanceDatabaseFormat"]] = None,
        requested_logical_availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = 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 ManagedInstanceQuery(ProxyResource):
    """Database query.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.QueryProperties
    """

    properties: Optional["_models.QueryProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["query_text"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.QueryProperties"] = 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 ManagedInstanceUpdate(_Model):
    """An update request for an Azure SQL Database managed instance.

    :ivar sku: Managed instance sku.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar identity: Managed instance identity.
    :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Managed instance sku."""
    identity: Optional["_models.ResourceIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed instance identity."""
    properties: Optional["_models.ManagedInstanceProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = [
        "provisioning_state",
        "managed_instance_create_mode",
        "fully_qualified_domain_name",
        "is_general_purpose_v2",
        "administrator_login",
        "administrator_login_password",
        "subnet_id",
        "state",
        "license_type",
        "hybrid_secondary_usage",
        "hybrid_secondary_usage_detected",
        "v_cores",
        "storage_size_in_gb",
        "storage_i_ops",
        "storage_throughput_m_bps",
        "memory_size_in_gb",
        "collation",
        "dns_zone",
        "dns_zone_partner",
        "public_data_endpoint_enabled",
        "source_managed_instance_id",
        "restore_point_in_time",
        "proxy_override",
        "timezone_id",
        "instance_pool_id",
        "maintenance_configuration_id",
        "private_endpoint_connections",
        "minimal_tls_version",
        "current_backup_storage_redundancy",
        "requested_backup_storage_redundancy",
        "zone_redundant",
        "primary_user_assigned_identity_id",
        "key_id",
        "administrators",
        "service_principal",
        "virtual_cluster_id",
        "external_governance_status",
        "pricing_model",
        "create_time",
        "authentication_metadata",
        "database_format",
        "requested_logical_availability_zone",
    ]

    @overload
    def __init__(
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        identity: Optional["_models.ResourceIdentity"] = None,
        properties: Optional["_models.ManagedInstanceProperties"] = 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 ManagedInstanceValidateAzureKeyVaultEncryptionKeyRequest(_Model):  # pylint: disable=name-too-long
    """Validate azure key vault encryption key.

    :ivar tde_key_uri: The URI of the key. Required.
    :vartype tde_key_uri: str
    """

    tde_key_uri: str = rest_field(name="tdeKeyUri", visibility=["create", "update"])
    """The URI of the key. Required."""

    @overload
    def __init__(
        self,
        *,
        tde_key_uri: str,
    ) -> 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 ManagedInstanceVcoresCapability(_Model):
    """The managed instance virtual cores capability.

    :ivar name: The virtual cores identifier.
    :vartype name: str
    :ivar value: The virtual cores value.
    :vartype value: int
    :ivar supported_memory_sizes_in_gb: Supported memory sizes in GB.
    :vartype supported_memory_sizes_in_gb: ~azure.mgmt.sql.models.MaxLimitRangeCapability
    :ivar supported_memory_limits_mb: Memory limit MB ranges.
    :vartype supported_memory_limits_mb: ~azure.mgmt.sql.models.MaxLimitRangeCapability
    :ivar included_max_size: Included size.
    :vartype included_max_size: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar supported_storage_sizes: Storage size ranges.
    :vartype supported_storage_sizes: list[~azure.mgmt.sql.models.MaxSizeRangeCapability]
    :ivar included_storage_i_ops: Included storage IOps.
    :vartype included_storage_i_ops: int
    :ivar supported_storage_i_ops: Storage IOps ranges.
    :vartype supported_storage_i_ops: ~azure.mgmt.sql.models.MaxLimitRangeCapability
    :ivar iops_min_value_override_factor_per_selected_storage_gb: Min IOps override factor per
     selected storage GB.
    :vartype iops_min_value_override_factor_per_selected_storage_gb: float
    :ivar iops_included_value_override_factor_per_selected_storage_gb: Included IOps override
     factor per selected storage GB.
    :vartype iops_included_value_override_factor_per_selected_storage_gb: float
    :ivar included_storage_throughput_m_bps: Included storage throughput MBps.
    :vartype included_storage_throughput_m_bps: int
    :ivar supported_storage_throughput_m_bps: Storage throughput MBps ranges.
    :vartype supported_storage_throughput_m_bps: ~azure.mgmt.sql.models.MaxLimitRangeCapability
    :ivar throughput_m_bps_min_value_override_factor_per_selected_storage_gb: Min throughput MBps
     override factor per selected storage GB.
    :vartype throughput_m_bps_min_value_override_factor_per_selected_storage_gb: float
    :ivar throughput_m_bps_included_value_override_factor_per_selected_storage_gb: Included
     throughput MBps override factor per selected storage GB.
    :vartype throughput_m_bps_included_value_override_factor_per_selected_storage_gb: float
    :ivar instance_pool_supported: True if this service objective is supported for managed
     instances in an instance pool.
    :vartype instance_pool_supported: bool
    :ivar standalone_supported: True if this service objective is supported for standalone managed
     instances.
    :vartype standalone_supported: bool
    :ivar supported_maintenance_configurations: List of supported maintenance configurations.
    :vartype supported_maintenance_configurations:
     list[~azure.mgmt.sql.models.ManagedInstanceMaintenanceConfigurationCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The virtual cores identifier."""
    value: Optional[int] = rest_field(visibility=["read"])
    """The virtual cores value."""
    supported_memory_sizes_in_gb: Optional["_models.MaxLimitRangeCapability"] = rest_field(
        name="supportedMemorySizesInGB", visibility=["read"]
    )
    """Supported memory sizes in GB."""
    supported_memory_limits_mb: Optional["_models.MaxLimitRangeCapability"] = rest_field(
        name="supportedMemoryLimitsMB", visibility=["read"]
    )
    """Memory limit MB ranges."""
    included_max_size: Optional["_models.MaxSizeCapability"] = rest_field(name="includedMaxSize", visibility=["read"])
    """Included size."""
    supported_storage_sizes: Optional[list["_models.MaxSizeRangeCapability"]] = rest_field(
        name="supportedStorageSizes", visibility=["read"]
    )
    """Storage size ranges."""
    included_storage_i_ops: Optional[int] = rest_field(name="includedStorageIOps", visibility=["read"])
    """Included storage IOps."""
    supported_storage_i_ops: Optional["_models.MaxLimitRangeCapability"] = rest_field(
        name="supportedStorageIOps", visibility=["read"]
    )
    """Storage IOps ranges."""
    iops_min_value_override_factor_per_selected_storage_gb: Optional[float] = rest_field(
        name="iopsMinValueOverrideFactorPerSelectedStorageGB", visibility=["read"]
    )
    """Min IOps override factor per selected storage GB."""
    iops_included_value_override_factor_per_selected_storage_gb: Optional[float] = rest_field(
        name="iopsIncludedValueOverrideFactorPerSelectedStorageGB", visibility=["read"]
    )
    """Included IOps override factor per selected storage GB."""
    included_storage_throughput_m_bps: Optional[int] = rest_field(
        name="includedStorageThroughputMBps", visibility=["read"]
    )
    """Included storage throughput MBps."""
    supported_storage_throughput_m_bps: Optional["_models.MaxLimitRangeCapability"] = rest_field(
        name="supportedStorageThroughputMBps", visibility=["read"]
    )
    """Storage throughput MBps ranges."""
    throughput_m_bps_min_value_override_factor_per_selected_storage_gb: Optional[float] = rest_field(
        name="throughputMBpsMinValueOverrideFactorPerSelectedStorageGB", visibility=["read"]
    )
    """Min throughput MBps override factor per selected storage GB."""
    throughput_m_bps_included_value_override_factor_per_selected_storage_gb: Optional[float] = rest_field(
        name="throughputMBpsIncludedValueOverrideFactorPerSelectedStorageGB", visibility=["read"]
    )
    """Included throughput MBps override factor per selected storage GB."""
    instance_pool_supported: Optional[bool] = rest_field(name="instancePoolSupported", visibility=["read"])
    """True if this service objective is supported for managed instances in an instance pool."""
    standalone_supported: Optional[bool] = rest_field(name="standaloneSupported", visibility=["read"])
    """True if this service objective is supported for standalone managed instances."""
    supported_maintenance_configurations: Optional[
        list["_models.ManagedInstanceMaintenanceConfigurationCapability"]
    ] = rest_field(name="supportedMaintenanceConfigurations", visibility=["read"])
    """List of supported maintenance configurations."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ManagedInstanceVersionCapability(_Model):
    """The managed instance capability.

    :ivar name: The server version name.
    :vartype name: str
    :ivar supported_editions: The list of supported managed instance editions.
    :vartype supported_editions: list[~azure.mgmt.sql.models.ManagedInstanceEditionCapability]
    :ivar supported_instance_pool_editions: The list of supported instance pool editions.
    :vartype supported_instance_pool_editions:
     list[~azure.mgmt.sql.models.InstancePoolEditionCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The server version name."""
    supported_editions: Optional[list["_models.ManagedInstanceEditionCapability"]] = rest_field(
        name="supportedEditions", visibility=["read"]
    )
    """The list of supported managed instance editions."""
    supported_instance_pool_editions: Optional[list["_models.InstancePoolEditionCapability"]] = rest_field(
        name="supportedInstancePoolEditions", visibility=["read"]
    )
    """The list of supported instance pool editions."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ManagedInstanceVulnerabilityAssessment(ProxyResource):
    """A managed instance vulnerability assessment.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessmentProperties
    """

    properties: Optional["_models.ManagedInstanceVulnerabilityAssessmentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "storage_container_path",
        "storage_container_sas_key",
        "storage_account_access_key",
        "recurring_scans",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedInstanceVulnerabilityAssessmentProperties"] = 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 ManagedInstanceVulnerabilityAssessmentProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a managed instance vulnerability assessment.

    :ivar storage_container_path: A blob storage container path to hold the scan results (e.g.
     `https://myStorage.blob.core.windows.net/VaScans/
     <https://myStorage.blob.core.windows.net/VaScans/>`_). Required.
    :vartype storage_container_path: str
    :ivar storage_container_sas_key: A shared access signature (SAS Key) that has write access to
     the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey'
     isn't specified, StorageContainerSasKey is required. Applies only if the storage account is not
     behind a Vnet or a firewall.
    :vartype storage_container_sas_key: str
    :ivar storage_account_access_key: Specifies the identifier key of the storage account for
     vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
     storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet
     or a firewall.
    :vartype storage_account_access_key: str
    :ivar recurring_scans: The recurring scans settings.
    :vartype recurring_scans:
     ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
    """

    storage_container_path: str = rest_field(name="storageContainerPath", visibility=["create", "update"])
    """A blob storage container path to hold the scan results (e.g.
     `https://myStorage.blob.core.windows.net/VaScans/
     <https://myStorage.blob.core.windows.net/VaScans/>`_). Required."""
    storage_container_sas_key: Optional[str] = rest_field(
        name="storageContainerSasKey", visibility=["create", "update"]
    )
    """A shared access signature (SAS Key) that has write access to the blob container specified in
     'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified,
     StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or
     a firewall."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["create", "update"]
    )
    """Specifies the identifier key of the storage account for vulnerability assessment scan results.
     If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. Applies only
     if the storage account is not behind a Vnet or a firewall."""
    recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = rest_field(
        name="recurringScans", visibility=["read", "create", "update", "delete", "query"]
    )
    """The recurring scans settings."""

    @overload
    def __init__(
        self,
        *,
        storage_container_path: str,
        storage_container_sas_key: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = 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 ManagedLedgerDigestUploads(ProxyResource):
    """Azure SQL Database ledger digest upload settings.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsProperties
    """

    properties: Optional["_models.ManagedLedgerDigestUploadsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["digest_storage_endpoint", "state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedLedgerDigestUploadsProperties"] = 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 ManagedLedgerDigestUploadsProperties(_Model):
    """The properties of a database ledger digest upload settings.

    :ivar digest_storage_endpoint: The digest storage endpoint, which must be either an Azure blob
     storage endpoint or an URI for Azure Confidential Ledger.
    :vartype digest_storage_endpoint: str
    :ivar state: Specifies the state of ledger digest upload. Known values are: "Enabled" and
     "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsState
    """

    digest_storage_endpoint: Optional[str] = rest_field(
        name="digestStorageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for
     Azure Confidential Ledger."""
    state: Optional[Union[str, "_models.ManagedLedgerDigestUploadsState"]] = rest_field(visibility=["read"])
    """Specifies the state of ledger digest upload. Known values are: \"Enabled\" and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        digest_storage_endpoint: 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 ManagedServerDnsAlias(ProxyResource):
    """A managed server DNS alias.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedServerDnsAliasProperties
    """

    properties: Optional["_models.ManagedServerDnsAliasProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["azure_dns_record", "public_azure_dns_record"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedServerDnsAliasProperties"] = 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 ManagedServerDnsAliasAcquisition(_Model):
    """A managed server DNS alias acquisition request.

    :ivar old_managed_server_dns_alias_resource_id: The resource ID of the managed server DNS alias
     that will be acquired to point to this managed server instead. Required.
    :vartype old_managed_server_dns_alias_resource_id: str
    """

    old_managed_server_dns_alias_resource_id: str = rest_field(
        name="oldManagedServerDnsAliasResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource ID of the managed server DNS alias that will be acquired to point to this managed
     server instead. Required."""

    @overload
    def __init__(
        self,
        *,
        old_managed_server_dns_alias_resource_id: str,
    ) -> 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 ManagedServerDnsAliasCreation(_Model):
    """A managed server dns alias creation request.

    :ivar create_dns_record: Whether or not DNS record should be created for this alias.
    :vartype create_dns_record: bool
    """

    create_dns_record: Optional[bool] = rest_field(
        name="createDnsRecord", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not DNS record should be created for this alias."""

    @overload
    def __init__(
        self,
        *,
        create_dns_record: Optional[bool] = 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 ManagedServerDnsAliasProperties(_Model):
    """Properties of a managed server DNS alias.

    :ivar azure_dns_record: The fully qualified DNS record for managed server alias.
    :vartype azure_dns_record: str
    :ivar public_azure_dns_record: The fully qualified public DNS record for managed server alias.
    :vartype public_azure_dns_record: str
    """

    azure_dns_record: Optional[str] = rest_field(name="azureDnsRecord", visibility=["read"])
    """The fully qualified DNS record for managed server alias."""
    public_azure_dns_record: Optional[str] = rest_field(name="publicAzureDnsRecord", visibility=["read"])
    """The fully qualified public DNS record for managed server alias."""


class ManagedServerSecurityAlertPolicy(ProxyResource):
    """A managed server security alert policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SecurityAlertsPolicyProperties
    """

    properties: Optional["_models.SecurityAlertsPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "state",
        "disabled_alerts",
        "email_addresses",
        "email_account_admins",
        "storage_endpoint",
        "storage_account_access_key",
        "retention_days",
        "creation_time",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SecurityAlertsPolicyProperties"] = 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 ManagedTransparentDataEncryption(ProxyResource):
    """A managed database transparent data encryption state.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedTransparentDataEncryptionProperties
    """

    properties: Optional["_models.ManagedTransparentDataEncryptionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ManagedTransparentDataEncryptionProperties"] = 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 ManagedTransparentDataEncryptionProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a transparent data encryption.

    :ivar state: Specifies the state of the transparent data encryption. Required. Known values
     are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.TransparentDataEncryptionState
    """

    state: Union[str, "_models.TransparentDataEncryptionState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the transparent data encryption. Required. Known values are: \"Enabled\"
     and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.TransparentDataEncryptionState"],
    ) -> 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 MaxLimitRangeCapability(_Model):
    """The maximum limit range capability.

    :ivar min_value: Minimum value.
    :vartype min_value: int
    :ivar max_value: Maximum value.
    :vartype max_value: int
    :ivar scale_size: Scale/step size for discrete values between the minimum value and the maximum
     value.
    :vartype scale_size: int
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    min_value: Optional[int] = rest_field(name="minValue", visibility=["read"])
    """Minimum value."""
    max_value: Optional[int] = rest_field(name="maxValue", visibility=["read"])
    """Maximum value."""
    scale_size: Optional[int] = rest_field(name="scaleSize", visibility=["read"])
    """Scale/step size for discrete values between the minimum value and the maximum value."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 MaxSizeCapability(_Model):
    """The maximum size capability.

    :ivar limit: The maximum size limit (see 'unit' for the units).
    :vartype limit: int
    :ivar unit: The units that the limit is expressed in. Known values are: "Megabytes",
     "Gigabytes", "Terabytes", and "Petabytes".
    :vartype unit: str or ~azure.mgmt.sql.models.MaxSizeUnit
    """

    limit: Optional[int] = rest_field(visibility=["read"])
    """The maximum size limit (see 'unit' for the units)."""
    unit: Optional[Union[str, "_models.MaxSizeUnit"]] = rest_field(visibility=["read"])
    """The units that the limit is expressed in. Known values are: \"Megabytes\", \"Gigabytes\",
     \"Terabytes\", and \"Petabytes\"."""


class MaxSizeRangeCapability(_Model):
    """The maximum size range capability.

    :ivar min_value: Minimum value.
    :vartype min_value: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar max_value: Maximum value.
    :vartype max_value: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar scale_size: Scale/step size for discrete values between the minimum value and the maximum
     value.
    :vartype scale_size: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar log_size: Size of transaction log.
    :vartype log_size: ~azure.mgmt.sql.models.LogSizeCapability
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    min_value: Optional["_models.MaxSizeCapability"] = rest_field(name="minValue", visibility=["read"])
    """Minimum value."""
    max_value: Optional["_models.MaxSizeCapability"] = rest_field(name="maxValue", visibility=["read"])
    """Maximum value."""
    scale_size: Optional["_models.MaxSizeCapability"] = rest_field(name="scaleSize", visibility=["read"])
    """Scale/step size for discrete values between the minimum value and the maximum value."""
    log_size: Optional["_models.LogSizeCapability"] = rest_field(name="logSize", visibility=["read"])
    """Size of transaction log."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 MinCapacityCapability(_Model):
    """The min capacity capability.

    :ivar value: Min capacity value.
    :vartype value: float
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    value: Optional[float] = rest_field(visibility=["read"])
    """Min capacity value."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 Name(_Model):
    """ARM Usage Name.

    :ivar value: Usage name value.
    :vartype value: str
    :ivar localized_value: Usage name localized value.
    :vartype localized_value: str
    """

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

    @overload
    def __init__(
        self,
        *,
        value: Optional[str] = None,
        localized_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 NetworkIsolationSettings(_Model):
    """Contains the ARM resources for which to create private endpoint connection.

    :ivar storage_account_resource_id: The resource id for the storage account used to store BACPAC
     file. If set, private endpoint connection will be created for the storage account. Must match
     storage account used for StorageUri parameter.
    :vartype storage_account_resource_id: str
    :ivar sql_server_resource_id: The resource id for the SQL server which is the target of this
     request. If set, private endpoint connection will be created for the SQL server. Must match
     server which is target of the operation.
    :vartype sql_server_resource_id: str
    """

    storage_account_resource_id: Optional[str] = rest_field(name="storageAccountResourceId", visibility=["create"])
    """The resource id for the storage account used to store BACPAC file. If set, private endpoint
     connection will be created for the storage account. Must match storage account used for
     StorageUri parameter."""
    sql_server_resource_id: Optional[str] = rest_field(name="sqlServerResourceId", visibility=["create"])
    """The resource id for the SQL server which is the target of this request. If set, private
     endpoint connection will be created for the SQL server. Must match server which is target of
     the operation."""

    @overload
    def __init__(
        self,
        *,
        storage_account_resource_id: Optional[str] = None,
        sql_server_resource_id: 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 NetworkSecurityPerimeterConfiguration(ProxyResource):
    """NSP Configuration for a server.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.NetworkSecurityPerimeterConfigurationProperties
    """

    properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "provisioning_state",
        "network_security_perimeter",
        "resource_association",
        "profile",
        "provisioning_issues",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = 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 NetworkSecurityPerimeterConfigurationProperties(_Model):  # pylint: disable=name-too-long
    """The properties of an NSP config.

    :ivar provisioning_state:
    :vartype provisioning_state: str
    :ivar network_security_perimeter:
    :vartype network_security_perimeter: ~azure.mgmt.sql.models.NSPConfigPerimeter
    :ivar resource_association:
    :vartype resource_association: ~azure.mgmt.sql.models.NSPConfigAssociation
    :ivar profile:
    :vartype profile: ~azure.mgmt.sql.models.NSPConfigProfile
    :ivar provisioning_issues:
    :vartype provisioning_issues: list[~azure.mgmt.sql.models.NSPProvisioningIssue]
    """

    provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"])
    network_security_perimeter: Optional["_models.NSPConfigPerimeter"] = rest_field(
        name="networkSecurityPerimeter", visibility=["read", "create", "update", "delete", "query"]
    )
    resource_association: Optional["_models.NSPConfigAssociation"] = rest_field(
        name="resourceAssociation", visibility=["read", "create", "update", "delete", "query"]
    )
    profile: Optional["_models.NSPConfigProfile"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    provisioning_issues: Optional[list["_models.NSPProvisioningIssue"]] = rest_field(
        name="provisioningIssues", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        network_security_perimeter: Optional["_models.NSPConfigPerimeter"] = None,
        resource_association: Optional["_models.NSPConfigAssociation"] = None,
        profile: Optional["_models.NSPConfigProfile"] = None,
        provisioning_issues: Optional[list["_models.NSPProvisioningIssue"]] = 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 NSPConfigAccessRule(_Model):
    """NSPConfigAccessRule.

    :ivar name:
    :vartype name: str
    :ivar properties:
    :vartype properties: ~azure.mgmt.sql.models.NSPConfigAccessRuleProperties
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    properties: Optional["_models.NSPConfigAccessRuleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        properties: Optional["_models.NSPConfigAccessRuleProperties"] = 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 NSPConfigAccessRuleProperties(_Model):
    """NSPConfigAccessRuleProperties.

    :ivar direction:
    :vartype direction: str
    :ivar address_prefixes:
    :vartype address_prefixes: list[str]
    :ivar fully_qualified_domain_names:
    :vartype fully_qualified_domain_names: list[str]
    :ivar subscriptions:
    :vartype subscriptions: list[str]
    :ivar network_security_perimeters:
    :vartype network_security_perimeters:
     list[~azure.mgmt.sql.models.NSPConfigNetworkSecurityPerimeterRule]
    :ivar service_tags:
    :vartype service_tags: list[str]
    """

    direction: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    address_prefixes: Optional[list[str]] = rest_field(
        name="addressPrefixes", visibility=["read", "create", "update", "delete", "query"]
    )
    fully_qualified_domain_names: Optional[list[str]] = rest_field(
        name="fullyQualifiedDomainNames", visibility=["read", "create", "update", "delete", "query"]
    )
    subscriptions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    network_security_perimeters: Optional[list["_models.NSPConfigNetworkSecurityPerimeterRule"]] = rest_field(
        name="networkSecurityPerimeters", visibility=["read", "create", "update", "delete", "query"]
    )
    service_tags: Optional[list[str]] = rest_field(
        name="serviceTags", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        direction: Optional[str] = None,
        address_prefixes: Optional[list[str]] = None,
        fully_qualified_domain_names: Optional[list[str]] = None,
        subscriptions: Optional[list[str]] = None,
        network_security_perimeters: Optional[list["_models.NSPConfigNetworkSecurityPerimeterRule"]] = None,
        service_tags: 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 NSPConfigAssociation(_Model):
    """NSPConfigAssociation.

    :ivar name:
    :vartype name: str
    :ivar access_mode:
    :vartype access_mode: str
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    access_mode: Optional[str] = rest_field(
        name="accessMode", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        access_mode: 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 NSPConfigNetworkSecurityPerimeterRule(_Model):
    """NSPConfigNetworkSecurityPerimeterRule.

    :ivar id:
    :vartype id: str
    :ivar perimeter_guid:
    :vartype perimeter_guid: str
    :ivar location:
    :vartype location: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    perimeter_guid: Optional[str] = rest_field(
        name="perimeterGuid", visibility=["read", "create", "update", "delete", "query"]
    )
    location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        perimeter_guid: Optional[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 NSPConfigPerimeter(_Model):
    """NSPConfigPerimeter.

    :ivar id:
    :vartype id: str
    :ivar perimeter_guid:
    :vartype perimeter_guid: str
    :ivar location:
    :vartype location: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    perimeter_guid: Optional[str] = rest_field(
        name="perimeterGuid", visibility=["read", "create", "update", "delete", "query"]
    )
    location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        perimeter_guid: Optional[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 NSPConfigProfile(_Model):
    """NSPConfigProfile.

    :ivar name:
    :vartype name: str
    :ivar access_rules_version:
    :vartype access_rules_version: str
    :ivar access_rules:
    :vartype access_rules: list[~azure.mgmt.sql.models.NSPConfigAccessRule]
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    access_rules_version: Optional[str] = rest_field(
        name="accessRulesVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    access_rules: Optional[list["_models.NSPConfigAccessRule"]] = rest_field(
        name="accessRules", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        access_rules_version: Optional[str] = None,
        access_rules: Optional[list["_models.NSPConfigAccessRule"]] = 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 NSPProvisioningIssue(_Model):
    """NSPProvisioningIssue.

    :ivar name:
    :vartype name: str
    :ivar properties:
    :vartype properties: ~azure.mgmt.sql.models.NSPProvisioningIssueProperties
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    properties: Optional["_models.NSPProvisioningIssueProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        properties: Optional["_models.NSPProvisioningIssueProperties"] = 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 NSPProvisioningIssueProperties(_Model):
    """NSPProvisioningIssueProperties.

    :ivar issue_type:
    :vartype issue_type: str
    :ivar severity:
    :vartype severity: str
    :ivar description:
    :vartype description: str
    :ivar suggested_resource_ids:
    :vartype suggested_resource_ids: list[str]
    :ivar suggested_access_rules:
    :vartype suggested_access_rules: list[str]
    """

    issue_type: Optional[str] = rest_field(name="issueType", visibility=["read", "create", "update", "delete", "query"])
    severity: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    suggested_resource_ids: Optional[list[str]] = rest_field(
        name="suggestedResourceIds", visibility=["read", "create", "update", "delete", "query"]
    )
    suggested_access_rules: Optional[list[str]] = rest_field(
        name="suggestedAccessRules", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        issue_type: Optional[str] = None,
        severity: Optional[str] = None,
        description: Optional[str] = None,
        suggested_resource_ids: Optional[list[str]] = None,
        suggested_access_rules: 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 Operation(_Model):
    """SQL REST API operation definition.

    :ivar name: The name of the operation being performed on this particular object.
    :vartype name: str
    :ivar display: The localized display information for this particular operation / action.
    :vartype display: ~azure.mgmt.sql.models.OperationDisplay
    :ivar origin: The intended executor of the operation. Known values are: "user" and "system".
    :vartype origin: str or ~azure.mgmt.sql.models.OperationOrigin
    :ivar properties: Additional descriptions for the operation.
    :vartype properties: dict[str, any]
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The name of the operation being performed on this particular object."""
    display: Optional["_models.OperationDisplay"] = rest_field(visibility=["read"])
    """The localized display information for this particular operation / action."""
    origin: Optional[Union[str, "_models.OperationOrigin"]] = rest_field(visibility=["read"])
    """The intended executor of the operation. Known values are: \"user\" and \"system\"."""
    properties: Optional[dict[str, Any]] = rest_field(visibility=["read"])
    """Additional descriptions for the operation."""


class OperationDisplay(_Model):
    """Display metadata associated with the operation.

    :ivar provider: The localized friendly form of the resource provider name.
    :vartype provider: str
    :ivar resource: The localized friendly form of the resource type related to this
     action/operation.
    :vartype resource: str
    :ivar operation: The localized friendly name for the operation.
    :vartype operation: str
    :ivar description: The localized friendly description for the operation.
    :vartype description: str
    """

    provider: Optional[str] = rest_field(visibility=["read"])
    """The localized friendly form of the resource provider name."""
    resource: Optional[str] = rest_field(visibility=["read"])
    """The localized friendly form of the resource type related to this action/operation."""
    operation: Optional[str] = rest_field(visibility=["read"])
    """The localized friendly name for the operation."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The localized friendly description for the operation."""


class OutboundEnvironmentEndpoint(_Model):
    """An endpoint that the managed instance service requires outbound network access to.

    :ivar category: The type of service accessed by the managed instance service, e.g., Azure
     Storage, Azure Active Directory, etc.
    :vartype category: str
    :ivar endpoints: The endpoints that the managed instance service communicates with in order to
     function correctly.
    :vartype endpoints: list[~azure.mgmt.sql.models.EndpointDependency]
    """

    category: Optional[str] = rest_field(visibility=["read"])
    """The type of service accessed by the managed instance service, e.g., Azure Storage, Azure Active
     Directory, etc."""
    endpoints: Optional[list["_models.EndpointDependency"]] = rest_field(visibility=["read"])
    """The endpoints that the managed instance service communicates with in order to function
     correctly."""


class OutboundFirewallRule(ProxyResource):
    """An Azure SQL DB Server Outbound Firewall Rule.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.OutboundFirewallRuleProperties
    """

    properties: Optional["_models.OutboundFirewallRuleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["provisioning_state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.OutboundFirewallRuleProperties"] = 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 OutboundFirewallRuleProperties(_Model):
    """The properties of an outbound firewall rule.

    :ivar provisioning_state: The state of the outbound rule.
    :vartype provisioning_state: str
    """

    provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"])
    """The state of the outbound rule."""


class PartnerInfo(_Model):
    """Partner server information for the failover group.

    :ivar id: Resource identifier of the partner server. Required.
    :vartype id: str
    :ivar location: Geo location of the partner server.
    :vartype location: str
    :ivar replication_role: Replication role of the partner server. Known values are: "Primary" and
     "Secondary".
    :vartype replication_role: str or ~azure.mgmt.sql.models.FailoverGroupReplicationRole
    """

    id: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource identifier of the partner server. Required."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Geo location of the partner server."""
    replication_role: Optional[Union[str, "_models.FailoverGroupReplicationRole"]] = rest_field(
        name="replicationRole", visibility=["read"]
    )
    """Replication role of the partner server. Known values are: \"Primary\" and \"Secondary\"."""

    @overload
    def __init__(
        self,
        *,
        id: str,  # 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 PartnerRegionInfo(_Model):
    """Partner region information for the failover group.

    :ivar location: Geo location of the partner managed instances.
    :vartype location: str
    :ivar replication_role: Replication role of the partner managed instances. Known values are:
     "Primary" and "Secondary".
    :vartype replication_role: str or ~azure.mgmt.sql.models.InstanceFailoverGroupReplicationRole
    """

    location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Geo location of the partner managed instances."""
    replication_role: Optional[Union[str, "_models.InstanceFailoverGroupReplicationRole"]] = rest_field(
        name="replicationRole", visibility=["read"]
    )
    """Replication role of the partner managed instances. Known values are: \"Primary\" and
     \"Secondary\"."""

    @overload
    def __init__(
        self,
        *,
        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 PerDatabaseAutoPauseDelayTimeRange(_Model):
    """Supported auto pause delay time range.

    :ivar min_value: Minimum value.
    :vartype min_value: int
    :ivar max_value: Maximum value.
    :vartype max_value: int
    :ivar step_size: Step value for discrete values between the minimum value and the maximum
     value.
    :vartype step_size: int
    :ivar default: Default value if no value is provided.
    :vartype default: int
    :ivar unit: Unit of time that delay is expressed in. "Minutes"
    :vartype unit: str or ~azure.mgmt.sql.models.PauseDelayTimeUnit
    :ivar do_not_pause_value: Value that is used to not pause (infinite delay before pause).
    :vartype do_not_pause_value: int
    """

    min_value: Optional[int] = rest_field(name="minValue", visibility=["read"])
    """Minimum value."""
    max_value: Optional[int] = rest_field(name="maxValue", visibility=["read"])
    """Maximum value."""
    step_size: Optional[int] = rest_field(name="stepSize", visibility=["read"])
    """Step value for discrete values between the minimum value and the maximum value."""
    default: Optional[int] = rest_field(visibility=["read"])
    """Default value if no value is provided."""
    unit: Optional[Union[str, "_models.PauseDelayTimeUnit"]] = rest_field(visibility=["read"])
    """Unit of time that delay is expressed in. \"Minutes\""""
    do_not_pause_value: Optional[int] = rest_field(name="doNotPauseValue", visibility=["read"])
    """Value that is used to not pause (infinite delay before pause)."""


class PerformanceLevelCapability(_Model):
    """The performance level capability.

    :ivar value: Performance level value.
    :vartype value: float
    :ivar unit: Unit type used to measure performance level. Known values are: "DTU" and "VCores".
    :vartype unit: str or ~azure.mgmt.sql.models.PerformanceLevelUnit
    """

    value: Optional[float] = rest_field(visibility=["read"])
    """Performance level value."""
    unit: Optional[Union[str, "_models.PerformanceLevelUnit"]] = rest_field(visibility=["read"])
    """Unit type used to measure performance level. Known values are: \"DTU\" and \"VCores\"."""


class PhaseDetails(_Model):
    """The phase details properties of a database operation.

    :ivar phase: The operation phase. Known values are: "LogTransitionInProgress", "Copying",
     "BuildingHyperscaleComponents", "Catchup", "WaitingForCutover", and "CutoverInProgress".
    :vartype phase: str or ~azure.mgmt.sql.models.Phase
    :ivar phase_information: The operation phase information.
    :vartype phase_information: dict[str, str]
    """

    phase: Optional[Union[str, "_models.Phase"]] = rest_field(visibility=["read"])
    """The operation phase. Known values are: \"LogTransitionInProgress\", \"Copying\",
     \"BuildingHyperscaleComponents\", \"Catchup\", \"WaitingForCutover\", and
     \"CutoverInProgress\"."""
    phase_information: Optional[dict[str, str]] = rest_field(name="phaseInformation", visibility=["read"])
    """The operation phase information."""


class PrivateEndpointConnection(ProxyResource):
    """A private endpoint connection.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.PrivateEndpointConnectionProperties
    """

    properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["private_endpoint", "group_ids", "private_link_service_connection_state", "provisioning_state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.PrivateEndpointConnectionProperties"] = 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 PrivateEndpointConnectionProperties(_Model):
    """Properties of a private endpoint connection.

    :ivar private_endpoint: Private endpoint which the connection belongs to.
    :vartype private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty
    :ivar group_ids: Group IDs.
    :vartype group_ids: list[str]
    :ivar private_link_service_connection_state: Connection state of the private endpoint
     connection.
    :vartype private_link_service_connection_state:
     ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty
    :ivar provisioning_state: State of the private endpoint connection. Known values are:
     "Approving", "Ready", "Dropping", "Failed", and "Rejecting".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.PrivateEndpointProvisioningState
    """

    private_endpoint: Optional["_models.PrivateEndpointProperty"] = rest_field(
        name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Private endpoint which the connection belongs to."""
    group_ids: Optional[list[str]] = rest_field(name="groupIds", visibility=["read"])
    """Group IDs."""
    private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = rest_field(
        name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Connection state of the private endpoint connection."""
    provisioning_state: Optional[Union[str, "_models.PrivateEndpointProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """State of the private endpoint connection. Known values are: \"Approving\", \"Ready\",
     \"Dropping\", \"Failed\", and \"Rejecting\"."""

    @overload
    def __init__(
        self,
        *,
        private_endpoint: Optional["_models.PrivateEndpointProperty"] = None,
        private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = 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 PrivateEndpointConnectionRequestStatus(_Model):
    """Contains the private endpoint connection requests status.

    :ivar private_link_service_id: Resource id for which the private endpoint is created.
    :vartype private_link_service_id: str
    :ivar private_endpoint_connection_name: The connection name for the private endpoint.
    :vartype private_endpoint_connection_name: str
    :ivar status: Status of this private endpoint connection.
    :vartype status: str
    """

    private_link_service_id: Optional[str] = rest_field(name="privateLinkServiceId", visibility=["read"])
    """Resource id for which the private endpoint is created."""
    private_endpoint_connection_name: Optional[str] = rest_field(
        name="privateEndpointConnectionName", visibility=["read"]
    )
    """The connection name for the private endpoint."""
    status: Optional[str] = rest_field(visibility=["read"])
    """Status of this private endpoint connection."""


class PrivateEndpointProperty(_Model):
    """PrivateEndpointProperty.

    :ivar id: Resource id of the private endpoint.
    :vartype id: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource id of the private endpoint."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = 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 PrivateLinkResource(ProxyResource):
    """A private link 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.sql.models.SystemData
    :ivar properties: The private link resource group id.
    :vartype properties: ~azure.mgmt.sql.models.PrivateLinkResourceProperties
    """

    properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field(visibility=["read"])
    """The private link resource group id."""


class PrivateLinkResourceProperties(_Model):
    """Properties of a private link resource.

    :ivar group_id: The private link resource group id.
    :vartype group_id: str
    :ivar required_members: The private link resource required member names.
    :vartype required_members: list[str]
    :ivar required_zone_names: The private link resource required zone names.
    :vartype required_zone_names: list[str]
    """

    group_id: Optional[str] = rest_field(name="groupId", visibility=["read"])
    """The private link resource group id."""
    required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"])
    """The private link resource required member names."""
    required_zone_names: Optional[list[str]] = rest_field(name="requiredZoneNames", visibility=["read"])
    """The private link resource required zone names."""


class PrivateLinkServiceConnectionStateProperty(_Model):  # pylint: disable=name-too-long
    """PrivateLinkServiceConnectionStateProperty.

    :ivar status: The private link service connection status. Required. Known values are:
     "Approved", "Pending", "Rejected", and "Disconnected".
    :vartype status: str or ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateStatus
    :ivar description: The private link service connection description. Required.
    :vartype description: str
    :ivar actions_required: The actions required for private link service connection. "None"
    :vartype actions_required: str or
     ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateActionsRequire
    """

    status: Union[str, "_models.PrivateLinkServiceConnectionStateStatus"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The private link service connection status. Required. Known values are: \"Approved\",
     \"Pending\", \"Rejected\", and \"Disconnected\"."""
    description: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The private link service connection description. Required."""
    actions_required: Optional[Union[str, "_models.PrivateLinkServiceConnectionStateActionsRequire"]] = rest_field(
        name="actionsRequired", visibility=["read"]
    )
    """The actions required for private link service connection. \"None\""""

    @overload
    def __init__(
        self,
        *,
        status: Union[str, "_models.PrivateLinkServiceConnectionStateStatus"],
        description: str,
    ) -> 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 QueryCheck(_Model):
    """SQL Vulnerability Assessment query check object.

    :ivar query: SQL Vulnerability Assessment rule query.
    :vartype query: str
    :ivar expected_result: SQL Vulnerability Assessment query expected result.
    :vartype expected_result: list[list[str]]
    :ivar column_names: SQL Vulnerability Assessment column names of query expected result.
    :vartype column_names: list[str]
    """

    query: Optional[str] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment rule query."""
    expected_result: Optional[list[list[str]]] = rest_field(name="expectedResult", visibility=["read"])
    """SQL Vulnerability Assessment query expected result."""
    column_names: Optional[list[str]] = rest_field(name="columnNames", visibility=["read"])
    """SQL Vulnerability Assessment column names of query expected result."""


class QueryMetricInterval(_Model):
    """Properties of a query metrics interval.

    :ivar interval_start_time: The start time for the metric interval (ISO-8601 format).
    :vartype interval_start_time: str
    :ivar interval_type: Interval type (length). Known values are: "PT1H" and "P1D".
    :vartype interval_type: str or ~azure.mgmt.sql.models.QueryTimeGrainType
    :ivar execution_count: Execution count of a query in this interval.
    :vartype execution_count: int
    :ivar metrics: List of metric objects for this interval.
    :vartype metrics: list[~azure.mgmt.sql.models.QueryMetricProperties]
    """

    interval_start_time: Optional[str] = rest_field(name="intervalStartTime", visibility=["read"])
    """The start time for the metric interval (ISO-8601 format)."""
    interval_type: Optional[Union[str, "_models.QueryTimeGrainType"]] = rest_field(
        name="intervalType", visibility=["read"]
    )
    """Interval type (length). Known values are: \"PT1H\" and \"P1D\"."""
    execution_count: Optional[int] = rest_field(name="executionCount", visibility=["read"])
    """Execution count of a query in this interval."""
    metrics: Optional[list["_models.QueryMetricProperties"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of metric objects for this interval."""

    @overload
    def __init__(
        self,
        *,
        metrics: Optional[list["_models.QueryMetricProperties"]] = 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 QueryMetricProperties(_Model):
    """Properties of a topquery metric in one interval.

    :ivar name: The name information for the metric.
    :vartype name: str
    :ivar display_name: The UI appropriate name for the metric.
    :vartype display_name: str
    :ivar unit: The unit of the metric. Known values are: "percentage", "KB", "microseconds", and
     "count".
    :vartype unit: str or ~azure.mgmt.sql.models.QueryMetricUnitType
    :ivar value: The value of the metric.
    :vartype value: float
    :ivar min: Metric value when min() aggregate function is used over the interval.
    :vartype min: float
    :ivar max: Metric value when max() aggregate function is used over the interval.
    :vartype max: float
    :ivar avg: Metric value when avg() aggregate function is used over the interval.
    :vartype avg: float
    :ivar sum: Metric value when sum() aggregate function is used over the interval.
    :vartype sum: float
    :ivar stdev: Metric value when stdev aggregate function is used over the interval.
    :vartype stdev: float
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The name information for the metric."""
    display_name: Optional[str] = rest_field(name="displayName", visibility=["read"])
    """The UI appropriate name for the metric."""
    unit: Optional[Union[str, "_models.QueryMetricUnitType"]] = rest_field(visibility=["read"])
    """The unit of the metric. Known values are: \"percentage\", \"KB\", \"microseconds\", and
     \"count\"."""
    value: Optional[float] = rest_field(visibility=["read"])
    """The value of the metric."""
    min: Optional[float] = rest_field(visibility=["read"])
    """Metric value when min() aggregate function is used over the interval."""
    max: Optional[float] = rest_field(visibility=["read"])
    """Metric value when max() aggregate function is used over the interval."""
    avg: Optional[float] = rest_field(visibility=["read"])
    """Metric value when avg() aggregate function is used over the interval."""
    sum: Optional[float] = rest_field(visibility=["read"])
    """Metric value when sum() aggregate function is used over the interval."""
    stdev: Optional[float] = rest_field(visibility=["read"])
    """Metric value when stdev aggregate function is used over the interval."""


class QueryProperties(_Model):
    """Properties of a database query.

    :ivar query_text: Query text.
    :vartype query_text: str
    """

    query_text: Optional[str] = rest_field(name="queryText", visibility=["read", "create", "update", "delete", "query"])
    """Query text."""

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

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.QueryStatisticsProperties
    """

    properties: Optional["_models.QueryStatisticsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["database_name", "query_id", "start_time", "end_time", "intervals"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.QueryStatisticsProperties"] = 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 QueryStatisticsProperties(_Model):
    """Properties of a query execution statistics.

    :ivar database_name: Database name of the database in which this query was executed.
    :vartype database_name: str
    :ivar query_id: Unique query id (unique within one database).
    :vartype query_id: str
    :ivar start_time: The start time for the metric (ISO-8601 format).
    :vartype start_time: str
    :ivar end_time: The end time for the metric (ISO-8601 format).
    :vartype end_time: str
    :ivar intervals: List of intervals with appropriate metric data.
    :vartype intervals: list[~azure.mgmt.sql.models.QueryMetricInterval]
    """

    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """Database name of the database in which this query was executed."""
    query_id: Optional[str] = rest_field(name="queryId", visibility=["read"])
    """Unique query id (unique within one database)."""
    start_time: Optional[str] = rest_field(name="startTime", visibility=["read"])
    """The start time for the metric (ISO-8601 format)."""
    end_time: Optional[str] = rest_field(name="endTime", visibility=["read"])
    """The end time for the metric (ISO-8601 format)."""
    intervals: Optional[list["_models.QueryMetricInterval"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of intervals with appropriate metric data."""

    @overload
    def __init__(
        self,
        *,
        intervals: Optional[list["_models.QueryMetricInterval"]] = 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 ReadScaleCapability(_Model):
    """The read scale capability.

    :ivar max_number_of_replicas: The maximum number of read scale replicas.
    :vartype max_number_of_replicas: int
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    max_number_of_replicas: Optional[int] = rest_field(name="maxNumberOfReplicas", visibility=["read"])
    """The maximum number of read scale replicas."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 RecommendedAction(ProxyResource):
    """Database, Server or Elastic Pool Recommended Action.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.RecommendedActionProperties
    :ivar kind: Resource kind.
    :vartype kind: str
    :ivar location: Resource location.
    :vartype location: str
    """

    properties: Optional["_models.RecommendedActionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Resource kind."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Resource location."""

    __flattened_items = [
        "recommendation_reason",
        "valid_since",
        "last_refresh",
        "state",
        "is_executable_action",
        "is_revertable_action",
        "is_archived_action",
        "execute_action_start_time",
        "execute_action_duration",
        "revert_action_start_time",
        "revert_action_duration",
        "execute_action_initiated_by",
        "execute_action_initiated_time",
        "revert_action_initiated_by",
        "revert_action_initiated_time",
        "score",
        "implementation_details",
        "error_details",
        "estimated_impact",
        "observed_impact",
        "time_series",
        "linked_objects",
        "details",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RecommendedActionProperties"] = 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 RecommendedActionErrorInfo(_Model):
    """Contains error information for an Azure SQL Database, Server or Elastic Pool Recommended
    Action.

    :ivar error_code: Gets the reason why the recommended action was put to error state. e.g.,
     DatabaseHasQdsOff, IndexAlreadyExists.
    :vartype error_code: str
    :ivar is_retryable: Gets whether the error could be ignored and recommended action could be
     retried. Possible values are: Yes/No. Known values are: "Yes" and "No".
    :vartype is_retryable: str or ~azure.mgmt.sql.models.IsRetryable
    """

    error_code: Optional[str] = rest_field(name="errorCode", visibility=["read"])
    """Gets the reason why the recommended action was put to error state. e.g., DatabaseHasQdsOff,
     IndexAlreadyExists."""
    is_retryable: Optional[Union[str, "_models.IsRetryable"]] = rest_field(name="isRetryable", visibility=["read"])
    """Gets whether the error could be ignored and recommended action could be retried. Possible
     values are: Yes/No. Known values are: \"Yes\" and \"No\"."""


class RecommendedActionImpactRecord(_Model):
    """Contains information of estimated or observed impact on various metrics for an Azure SQL
    Database, Server or Elastic Pool Recommended Action.

    :ivar dimension_name: Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange,
     NumberOfQueriesAffected.
    :vartype dimension_name: str
    :ivar unit: Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange,
     NumberOfQueriesAffected.
    :vartype unit: str
    :ivar absolute_value: Gets the absolute value of this dimension if applicable. e.g., Number of
     Queries affected.
    :vartype absolute_value: float
    :ivar change_value_absolute: Gets the absolute change in the value of this dimension. e.g.,
     Absolute Disk space change in Megabytes.
    :vartype change_value_absolute: float
    :ivar change_value_relative: Gets the relative change in the value of this dimension. e.g.,
     Relative Disk space change in Percentage.
    :vartype change_value_relative: float
    """

    dimension_name: Optional[str] = rest_field(name="dimensionName", visibility=["read"])
    """Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange,
     NumberOfQueriesAffected."""
    unit: Optional[str] = rest_field(visibility=["read"])
    """Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange,
     NumberOfQueriesAffected."""
    absolute_value: Optional[float] = rest_field(name="absoluteValue", visibility=["read"])
    """Gets the absolute value of this dimension if applicable. e.g., Number of Queries affected."""
    change_value_absolute: Optional[float] = rest_field(name="changeValueAbsolute", visibility=["read"])
    """Gets the absolute change in the value of this dimension. e.g., Absolute Disk space change in
     Megabytes."""
    change_value_relative: Optional[float] = rest_field(name="changeValueRelative", visibility=["read"])
    """Gets the relative change in the value of this dimension. e.g., Relative Disk space change in
     Percentage."""


class RecommendedActionImplementationInfo(_Model):
    """Contains information for manual implementation for an Azure SQL Database, Server or Elastic
    Pool Recommended Action.

    :ivar method: Gets the method in which this recommended action can be manually implemented.
     e.g., TSql, AzurePowerShell. Known values are: "TSql" and "AzurePowerShell".
    :vartype method: str or ~azure.mgmt.sql.models.ImplementationMethod
    :ivar script: Gets the manual implementation script. e.g., T-SQL script that could be executed
     on the database.
    :vartype script: str
    """

    method: Optional[Union[str, "_models.ImplementationMethod"]] = rest_field(visibility=["read"])
    """Gets the method in which this recommended action can be manually implemented. e.g., TSql,
     AzurePowerShell. Known values are: \"TSql\" and \"AzurePowerShell\"."""
    script: Optional[str] = rest_field(visibility=["read"])
    """Gets the manual implementation script. e.g., T-SQL script that could be executed on the
     database."""


class RecommendedActionMetricInfo(_Model):
    """Contains time series of various impacted metrics for an Azure SQL Database, Server or Elastic
    Pool Recommended Action.

    :ivar metric_name: Gets the name of the metric. e.g., CPU, Number of Queries.
    :vartype metric_name: str
    :ivar unit: Gets the unit in which metric is measured. e.g., DTU, Frequency.
    :vartype unit: str
    :ivar time_grain: Gets the duration of time interval for the value given by this MetricInfo.
     e.g., PT1H (1 hour).
    :vartype time_grain: str
    :ivar start_time: Gets the start time of time interval given by this MetricInfo.
    :vartype start_time: ~datetime.datetime
    :ivar value: Gets the value of the metric in the time interval given by this MetricInfo.
    :vartype value: float
    """

    metric_name: Optional[str] = rest_field(name="metricName", visibility=["read"])
    """Gets the name of the metric. e.g., CPU, Number of Queries."""
    unit: Optional[str] = rest_field(visibility=["read"])
    """Gets the unit in which metric is measured. e.g., DTU, Frequency."""
    time_grain: Optional[str] = rest_field(name="timeGrain", visibility=["read"])
    """Gets the duration of time interval for the value given by this MetricInfo. e.g., PT1H (1 hour)."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """Gets the start time of time interval given by this MetricInfo."""
    value: Optional[float] = rest_field(visibility=["read"])
    """Gets the value of the metric in the time interval given by this MetricInfo."""


class RecommendedActionProperties(_Model):
    """Properties for a Database, Server or Elastic Pool Recommended Action.

    :ivar recommendation_reason: Gets the reason for recommending this action. e.g.,
     DuplicateIndex.
    :vartype recommendation_reason: str
    :ivar valid_since: Gets the time since when this recommended action is valid.
    :vartype valid_since: ~datetime.datetime
    :ivar last_refresh: Gets time when this recommended action was last refreshed.
    :vartype last_refresh: ~datetime.datetime
    :ivar state: Gets the info of the current state the recommended action is in. Required.
    :vartype state: ~azure.mgmt.sql.models.RecommendedActionStateInfo
    :ivar is_executable_action: Gets if this recommended action is actionable by user.
    :vartype is_executable_action: bool
    :ivar is_revertable_action: Gets if changes applied by this recommended action can be reverted
     by user.
    :vartype is_revertable_action: bool
    :ivar is_archived_action: Gets if this recommended action was suggested some time ago but user
     chose to ignore this and system added a new recommended action again.
    :vartype is_archived_action: bool
    :ivar execute_action_start_time: Gets the time when system started applying this recommended
     action on the user resource. e.g., index creation start time.
    :vartype execute_action_start_time: ~datetime.datetime
    :ivar execute_action_duration: Gets the time taken for applying this recommended action on user
     resource. e.g., time taken for index creation.
    :vartype execute_action_duration: ~datetime.timedelta
    :ivar revert_action_start_time: Gets the time when system started reverting changes of this
     recommended action on user resource. e.g., time when index drop is executed.
    :vartype revert_action_start_time: ~datetime.datetime
    :ivar revert_action_duration: Gets the time taken for reverting changes of this recommended
     action on user resource. e.g., time taken for dropping the created index.
    :vartype revert_action_duration: ~datetime.timedelta
    :ivar execute_action_initiated_by: Gets if approval for applying this recommended action was
     given by user/system. Known values are: "User" and "System".
    :vartype execute_action_initiated_by: str or
     ~azure.mgmt.sql.models.RecommendedActionInitiatedBy
    :ivar execute_action_initiated_time: Gets the time when this recommended action was approved
     for execution.
    :vartype execute_action_initiated_time: ~datetime.datetime
    :ivar revert_action_initiated_by: Gets if approval for reverting this recommended action was
     given by user/system. Known values are: "User" and "System".
    :vartype revert_action_initiated_by: str or ~azure.mgmt.sql.models.RecommendedActionInitiatedBy
    :ivar revert_action_initiated_time: Gets the time when this recommended action was approved for
     revert.
    :vartype revert_action_initiated_time: ~datetime.datetime
    :ivar score: Gets the impact of this recommended action. Possible values are 1 - Low impact, 2
     - Medium Impact and 3 - High Impact.
    :vartype score: int
    :ivar implementation_details: Gets the implementation details of this recommended action for
     user to apply it manually.
    :vartype implementation_details: ~azure.mgmt.sql.models.RecommendedActionImplementationInfo
    :ivar error_details: Gets the error details if and why this recommended action is put to error
     state.
    :vartype error_details: ~azure.mgmt.sql.models.RecommendedActionErrorInfo
    :ivar estimated_impact: Gets the estimated impact info for this recommended action e.g.,
     Estimated CPU gain, Estimated Disk Space change.
    :vartype estimated_impact: list[~azure.mgmt.sql.models.RecommendedActionImpactRecord]
    :ivar observed_impact: Gets the observed/actual impact info for this recommended action e.g.,
     Actual CPU gain, Actual Disk Space change.
    :vartype observed_impact: list[~azure.mgmt.sql.models.RecommendedActionImpactRecord]
    :ivar time_series: Gets the time series info of metrics for this recommended action e.g., CPU
     consumption time series.
    :vartype time_series: list[~azure.mgmt.sql.models.RecommendedActionMetricInfo]
    :ivar linked_objects: Gets the linked objects, if any.
    :vartype linked_objects: list[str]
    :ivar details: Gets additional details specific to this recommended action.
    :vartype details: dict[str, str]
    """

    recommendation_reason: Optional[str] = rest_field(name="recommendationReason", visibility=["read"])
    """Gets the reason for recommending this action. e.g., DuplicateIndex."""
    valid_since: Optional[datetime.datetime] = rest_field(name="validSince", visibility=["read"], format="rfc3339")
    """Gets the time since when this recommended action is valid."""
    last_refresh: Optional[datetime.datetime] = rest_field(name="lastRefresh", visibility=["read"], format="rfc3339")
    """Gets time when this recommended action was last refreshed."""
    state: "_models.RecommendedActionStateInfo" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Gets the info of the current state the recommended action is in. Required."""
    is_executable_action: Optional[bool] = rest_field(name="isExecutableAction", visibility=["read"])
    """Gets if this recommended action is actionable by user."""
    is_revertable_action: Optional[bool] = rest_field(name="isRevertableAction", visibility=["read"])
    """Gets if changes applied by this recommended action can be reverted by user."""
    is_archived_action: Optional[bool] = rest_field(name="isArchivedAction", visibility=["read"])
    """Gets if this recommended action was suggested some time ago but user chose to ignore this and
     system added a new recommended action again."""
    execute_action_start_time: Optional[datetime.datetime] = rest_field(
        name="executeActionStartTime", visibility=["read"], format="rfc3339"
    )
    """Gets the time when system started applying this recommended action on the user resource. e.g.,
     index creation start time."""
    execute_action_duration: Optional[datetime.timedelta] = rest_field(
        name="executeActionDuration", visibility=["read"]
    )
    """Gets the time taken for applying this recommended action on user resource. e.g., time taken for
     index creation."""
    revert_action_start_time: Optional[datetime.datetime] = rest_field(
        name="revertActionStartTime", visibility=["read"], format="rfc3339"
    )
    """Gets the time when system started reverting changes of this recommended action on user
     resource. e.g., time when index drop is executed."""
    revert_action_duration: Optional[datetime.timedelta] = rest_field(name="revertActionDuration", visibility=["read"])
    """Gets the time taken for reverting changes of this recommended action on user resource. e.g.,
     time taken for dropping the created index."""
    execute_action_initiated_by: Optional[Union[str, "_models.RecommendedActionInitiatedBy"]] = rest_field(
        name="executeActionInitiatedBy", visibility=["read"]
    )
    """Gets if approval for applying this recommended action was given by user/system. Known values
     are: \"User\" and \"System\"."""
    execute_action_initiated_time: Optional[datetime.datetime] = rest_field(
        name="executeActionInitiatedTime", visibility=["read"], format="rfc3339"
    )
    """Gets the time when this recommended action was approved for execution."""
    revert_action_initiated_by: Optional[Union[str, "_models.RecommendedActionInitiatedBy"]] = rest_field(
        name="revertActionInitiatedBy", visibility=["read"]
    )
    """Gets if approval for reverting this recommended action was given by user/system. Known values
     are: \"User\" and \"System\"."""
    revert_action_initiated_time: Optional[datetime.datetime] = rest_field(
        name="revertActionInitiatedTime", visibility=["read"], format="rfc3339"
    )
    """Gets the time when this recommended action was approved for revert."""
    score: Optional[int] = rest_field(visibility=["read"])
    """Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - Medium
     Impact and 3 - High Impact."""
    implementation_details: Optional["_models.RecommendedActionImplementationInfo"] = rest_field(
        name="implementationDetails", visibility=["read"]
    )
    """Gets the implementation details of this recommended action for user to apply it manually."""
    error_details: Optional["_models.RecommendedActionErrorInfo"] = rest_field(name="errorDetails", visibility=["read"])
    """Gets the error details if and why this recommended action is put to error state."""
    estimated_impact: Optional[list["_models.RecommendedActionImpactRecord"]] = rest_field(
        name="estimatedImpact", visibility=["read"]
    )
    """Gets the estimated impact info for this recommended action e.g., Estimated CPU gain, Estimated
     Disk Space change."""
    observed_impact: Optional[list["_models.RecommendedActionImpactRecord"]] = rest_field(
        name="observedImpact", visibility=["read"]
    )
    """Gets the observed/actual impact info for this recommended action e.g., Actual CPU gain, Actual
     Disk Space change."""
    time_series: Optional[list["_models.RecommendedActionMetricInfo"]] = rest_field(
        name="timeSeries", visibility=["read"]
    )
    """Gets the time series info of metrics for this recommended action e.g., CPU consumption time
     series."""
    linked_objects: Optional[list[str]] = rest_field(name="linkedObjects", visibility=["read"])
    """Gets the linked objects, if any."""
    details: Optional[dict[str, str]] = rest_field(visibility=["read"])
    """Gets additional details specific to this recommended action."""

    @overload
    def __init__(
        self,
        *,
        state: "_models.RecommendedActionStateInfo",
    ) -> 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 RecommendedActionStateInfo(_Model):
    """Contains information of current state for an Azure SQL Database, Server or Elastic Pool
    Recommended Action.

    :ivar current_value: Current state the recommended action is in. Some commonly used states are:
     Active      -> recommended action is active and no action has been taken yet. Pending     ->
     recommended action is approved for and is awaiting execution. Executing   -> recommended action
     is being applied on the user database. Verifying   -> recommended action was applied and is
     being verified of its usefulness by the system. Success     -> recommended action was applied
     and improvement found during verification. Pending Revert  -> verification found little or no
     improvement so recommended action is queued for revert or user has manually reverted. Reverting
     -> changes made while applying recommended action are being reverted on the user database.
     Reverted    -> successfully reverted the changes made by recommended action on user database.
     Ignored     -> user explicitly ignored/discarded the recommended action. Required. Known values
     are: "Active", "Pending", "Executing", "Verifying", "PendingRevert", "RevertCancelled",
     "Reverting", "Reverted", "Ignored", "Expired", "Monitoring", "Resolved", "Success", and
     "Error".
    :vartype current_value: str or ~azure.mgmt.sql.models.RecommendedActionCurrentState
    :ivar action_initiated_by: Gets who initiated the execution of this recommended action.
     Possible Value are: User    -> When user explicity notified system to apply the recommended
     action. System  -> When auto-execute status of this advisor was set to 'Enabled', in which case
     the system applied it. Known values are: "User" and "System".
    :vartype action_initiated_by: str or ~azure.mgmt.sql.models.RecommendedActionInitiatedBy
    :ivar last_modified: Gets the time when the state was last modified.
    :vartype last_modified: ~datetime.datetime
    """

    current_value: Union[str, "_models.RecommendedActionCurrentState"] = rest_field(
        name="currentValue", visibility=["read", "create", "update", "delete", "query"]
    )
    """Current state the recommended action is in. Some commonly used states are: Active      ->
     recommended action is active and no action has been taken yet. Pending     -> recommended
     action is approved for and is awaiting execution. Executing   -> recommended action is being
     applied on the user database. Verifying   -> recommended action was applied and is being
     verified of its usefulness by the system. Success     -> recommended action was applied and
     improvement found during verification. Pending Revert  -> verification found little or no
     improvement so recommended action is queued for revert or user has manually reverted. Reverting
     -> changes made while applying recommended action are being reverted on the user database.
     Reverted    -> successfully reverted the changes made by recommended action on user database.
     Ignored     -> user explicitly ignored/discarded the recommended action. Required. Known values
     are: \"Active\", \"Pending\", \"Executing\", \"Verifying\", \"PendingRevert\",
     \"RevertCancelled\", \"Reverting\", \"Reverted\", \"Ignored\", \"Expired\", \"Monitoring\",
     \"Resolved\", \"Success\", and \"Error\"."""
    action_initiated_by: Optional[Union[str, "_models.RecommendedActionInitiatedBy"]] = rest_field(
        name="actionInitiatedBy", visibility=["read"]
    )
    """Gets who initiated the execution of this recommended action. Possible Value are: User    ->
     When user explicity notified system to apply the recommended action. System  -> When
     auto-execute status of this advisor was set to 'Enabled', in which case the system applied it.
     Known values are: \"User\" and \"System\"."""
    last_modified: Optional[datetime.datetime] = rest_field(name="lastModified", visibility=["read"], format="rfc3339")
    """Gets the time when the state was last modified."""

    @overload
    def __init__(
        self,
        *,
        current_value: Union[str, "_models.RecommendedActionCurrentState"],
    ) -> 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 RecommendedSensitivityLabelUpdate(ProxyResource):
    """A recommended sensitivity label update operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdateProperties
    """

    properties: Optional["_models.RecommendedSensitivityLabelUpdateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["op", "schema", "table", "column"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RecommendedSensitivityLabelUpdateProperties"] = 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 RecommendedSensitivityLabelUpdateList(_Model):
    """A list of recommended sensitivity label update operations.

    :ivar operations:
    :vartype operations: list[~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdate]
    """

    operations: Optional[list["_models.RecommendedSensitivityLabelUpdate"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        operations: Optional[list["_models.RecommendedSensitivityLabelUpdate"]] = 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 RecommendedSensitivityLabelUpdateProperties(_Model):  # pylint: disable=name-too-long
    """Properties of an operation executed on a recommended sensitivity label.

    :ivar op: Required. Known values are: "enable" and "disable".
    :vartype op: str or ~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdateKind
    :ivar schema: Schema name of the column to update. Required.
    :vartype schema: str
    :ivar table: Table name of the column to update. Required.
    :vartype table: str
    :ivar column: Column name to update. Required.
    :vartype column: str
    """

    op: Union[str, "_models.RecommendedSensitivityLabelUpdateKind"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Required. Known values are: \"enable\" and \"disable\"."""
    schema: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Schema name of the column to update. Required."""
    table: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Table name of the column to update. Required."""
    column: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Column name to update. Required."""

    @overload
    def __init__(
        self,
        *,
        op: Union[str, "_models.RecommendedSensitivityLabelUpdateKind"],
        schema: str,
        table: str,
        column: str,
    ) -> 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 RecoverableDatabase(ProxyResource):
    """A recoverable database 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.RecoverableDatabaseProperties
    """

    properties: Optional["_models.RecoverableDatabaseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "edition",
        "service_level_objective",
        "elastic_pool_name",
        "last_available_backup_date",
        "keys_property",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RecoverableDatabaseProperties"] = 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 RecoverableDatabaseProperties(_Model):
    """The recoverable database's properties.

    :ivar edition: The edition of the database.
    :vartype edition: str
    :ivar service_level_objective: The service level objective name of the database.
    :vartype service_level_objective: str
    :ivar elastic_pool_name: The elastic pool name of the database.
    :vartype elastic_pool_name: str
    :ivar last_available_backup_date: The last available backup date.
    :vartype last_available_backup_date: ~datetime.datetime
    :ivar keys_property: The resource ids of the user assigned identities to use.
    :vartype keys_property: dict[str, ~azure.mgmt.sql.models.DatabaseKey]
    """

    edition: Optional[str] = rest_field(visibility=["read"])
    """The edition of the database."""
    service_level_objective: Optional[str] = rest_field(name="serviceLevelObjective", visibility=["read"])
    """The service level objective name of the database."""
    elastic_pool_name: Optional[str] = rest_field(name="elasticPoolName", visibility=["read"])
    """The elastic pool name of the database."""
    last_available_backup_date: Optional[datetime.datetime] = rest_field(
        name="lastAvailableBackupDate", visibility=["read"], format="rfc3339"
    )
    """The last available backup date."""
    keys_property: Optional[dict[str, "_models.DatabaseKey"]] = rest_field(
        name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys"
    )
    """The resource ids of the user assigned identities to use."""

    @overload
    def __init__(
        self,
        *,
        keys_property: Optional[dict[str, "_models.DatabaseKey"]] = 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 RecoverableManagedDatabase(ProxyResource):
    """A recoverable managed database 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.RecoverableManagedDatabaseProperties
    """

    properties: Optional["_models.RecoverableManagedDatabaseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["last_available_backup_date"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RecoverableManagedDatabaseProperties"] = 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 RecoverableManagedDatabaseProperties(_Model):
    """The recoverable managed database's properties.

    :ivar last_available_backup_date: The last available backup date.
    :vartype last_available_backup_date: str
    """

    last_available_backup_date: Optional[str] = rest_field(name="lastAvailableBackupDate", visibility=["read"])
    """The last available backup date."""


class RefreshExternalGovernanceStatusOperationResult(ProxyResource):  # pylint: disable=name-too-long
    """An RefreshExternalGovernanceStatus operation result 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties:
     ~azure.mgmt.sql.models.RefreshExternalGovernanceStatusOperationResultProperties
    """

    properties: Optional["_models.RefreshExternalGovernanceStatusOperationResultProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["request_id", "request_type", "queued_time", "server_name", "status", "error_message"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RefreshExternalGovernanceStatusOperationResultProperties"] = 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 RefreshExternalGovernanceStatusOperationResultMI(ProxyResource):  # pylint: disable=name-too-long
    """An RefreshExternalGovernanceStatus operation result 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties:
     ~azure.mgmt.sql.models.RefreshExternalGovernanceStatusOperationResultPropertiesMI
    """

    properties: Optional["_models.RefreshExternalGovernanceStatusOperationResultPropertiesMI"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "request_id",
        "request_type",
        "queued_time",
        "managed_instance_name",
        "status",
        "error_message",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RefreshExternalGovernanceStatusOperationResultPropertiesMI"] = 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 RefreshExternalGovernanceStatusOperationResultProperties(_Model):  # pylint: disable=name-too-long
    """Contains the operation result properties for refresh external governance status operation.

    :ivar request_id: Request Id.
    :vartype request_id: str
    :ivar request_type: Request type.
    :vartype request_type: str
    :ivar queued_time: Queued time.
    :vartype queued_time: str
    :ivar server_name: Server name.
    :vartype server_name: str
    :ivar status: Operation status.
    :vartype status: str
    :ivar error_message: Error message.
    :vartype error_message: str
    """

    request_id: Optional[str] = rest_field(name="requestId", visibility=["read"])
    """Request Id."""
    request_type: Optional[str] = rest_field(name="requestType", visibility=["read"])
    """Request type."""
    queued_time: Optional[str] = rest_field(name="queuedTime", visibility=["read"])
    """Queued time."""
    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """Server name."""
    status: Optional[str] = rest_field(visibility=["read"])
    """Operation status."""
    error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"])
    """Error message."""


class RefreshExternalGovernanceStatusOperationResultPropertiesMI(_Model):  # pylint: disable=name-too-long
    """Contains the operation result properties for refresh external governance status operation.

    :ivar request_id: Request Id.
    :vartype request_id: str
    :ivar request_type: Request type.
    :vartype request_type: str
    :ivar queued_time: Queued time.
    :vartype queued_time: str
    :ivar managed_instance_name: Managed instance name.
    :vartype managed_instance_name: str
    :ivar status: Operation status.
    :vartype status: str
    :ivar error_message: Error message.
    :vartype error_message: str
    """

    request_id: Optional[str] = rest_field(name="requestId", visibility=["read"])
    """Request Id."""
    request_type: Optional[str] = rest_field(name="requestType", visibility=["read"])
    """Request type."""
    queued_time: Optional[str] = rest_field(name="queuedTime", visibility=["read"])
    """Queued time."""
    managed_instance_name: Optional[str] = rest_field(name="managedInstanceName", visibility=["read"])
    """Managed instance name."""
    status: Optional[str] = rest_field(visibility=["read"])
    """Operation status."""
    error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"])
    """Error message."""


class Remediation(_Model):
    """SQL Vulnerability Assessment remediation Details.

    :ivar description: SQL Vulnerability Assessment remediation description.
    :vartype description: str
    :ivar scripts: SQL Vulnerability Assessment remediation script.
    :vartype scripts: list[str]
    :ivar automated: SQL Vulnerability Assessment is remediation automated.
    :vartype automated: bool
    :ivar portal_link: SQL Vulnerability Assessment optional link to remediate in Azure Portal.
    :vartype portal_link: str
    """

    description: Optional[str] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment remediation description."""
    scripts: Optional[list[str]] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment remediation script."""
    automated: Optional[bool] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment is remediation automated."""
    portal_link: Optional[str] = rest_field(name="portalLink", visibility=["read"])
    """SQL Vulnerability Assessment optional link to remediate in Azure Portal."""


class ReplicationLink(ProxyResource):
    """A replication link.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ReplicationLinkProperties
    """

    properties: Optional["_models.ReplicationLinkProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "partner_server",
        "partner_database",
        "partner_database_id",
        "partner_location",
        "role",
        "partner_role",
        "replication_mode",
        "start_time",
        "percent_complete",
        "replication_state",
        "is_termination_allowed",
        "link_type",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ReplicationLinkProperties"] = 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 ReplicationLinkProperties(_Model):
    """Properties of a replication link.

    :ivar partner_server: Resource partner server.
    :vartype partner_server: str
    :ivar partner_database: Resource partner database.
    :vartype partner_database: str
    :ivar partner_database_id: Resource partner database Id.
    :vartype partner_database_id: str
    :ivar partner_location: Resource partner location.
    :vartype partner_location: str
    :ivar role: Local replication role. Known values are: "Primary", "Secondary",
     "NonReadableSecondary", "Source", and "Copy".
    :vartype role: str or ~azure.mgmt.sql.models.ReplicationRole
    :ivar partner_role: Partner replication role. Known values are: "Primary", "Secondary",
     "NonReadableSecondary", "Source", and "Copy".
    :vartype partner_role: str or ~azure.mgmt.sql.models.ReplicationRole
    :ivar replication_mode: Replication mode.
    :vartype replication_mode: str
    :ivar start_time: Time at which the link was created.
    :vartype start_time: ~datetime.datetime
    :ivar percent_complete: Seeding completion percentage for the link.
    :vartype percent_complete: int
    :ivar replication_state: Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). Known values
     are: "PENDING", "SEEDING", "CATCH_UP", and "SUSPENDED".
    :vartype replication_state: str or ~azure.mgmt.sql.models.ReplicationState
    :ivar is_termination_allowed: Whether the user is currently allowed to terminate the link.
    :vartype is_termination_allowed: bool
    :ivar link_type: Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED.
     Known values are: "GEO", "NAMED", and "STANDBY".
    :vartype link_type: str or ~azure.mgmt.sql.models.ReplicationLinkType
    """

    partner_server: Optional[str] = rest_field(name="partnerServer", visibility=["read"])
    """Resource partner server."""
    partner_database: Optional[str] = rest_field(name="partnerDatabase", visibility=["read"])
    """Resource partner database."""
    partner_database_id: Optional[str] = rest_field(name="partnerDatabaseId", visibility=["read"])
    """Resource partner database Id."""
    partner_location: Optional[str] = rest_field(name="partnerLocation", visibility=["read"])
    """Resource partner location."""
    role: Optional[Union[str, "_models.ReplicationRole"]] = rest_field(visibility=["read"])
    """Local replication role. Known values are: \"Primary\", \"Secondary\", \"NonReadableSecondary\",
     \"Source\", and \"Copy\"."""
    partner_role: Optional[Union[str, "_models.ReplicationRole"]] = rest_field(name="partnerRole", visibility=["read"])
    """Partner replication role. Known values are: \"Primary\", \"Secondary\",
     \"NonReadableSecondary\", \"Source\", and \"Copy\"."""
    replication_mode: Optional[str] = rest_field(name="replicationMode", visibility=["read"])
    """Replication mode."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """Time at which the link was created."""
    percent_complete: Optional[int] = rest_field(name="percentComplete", visibility=["read"])
    """Seeding completion percentage for the link."""
    replication_state: Optional[Union[str, "_models.ReplicationState"]] = rest_field(
        name="replicationState", visibility=["read"]
    )
    """Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). Known values are: \"PENDING\",
     \"SEEDING\", \"CATCH_UP\", and \"SUSPENDED\"."""
    is_termination_allowed: Optional[bool] = rest_field(name="isTerminationAllowed", visibility=["read"])
    """Whether the user is currently allowed to terminate the link."""
    link_type: Optional[Union[str, "_models.ReplicationLinkType"]] = rest_field(
        name="linkType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. Known values are:
     \"GEO\", \"NAMED\", and \"STANDBY\"."""

    @overload
    def __init__(
        self,
        *,
        link_type: Optional[Union[str, "_models.ReplicationLinkType"]] = 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 ReplicationLinkUpdate(ProxyResource):
    """A replication link update request.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ReplicationLinkUpdateProperties
    """

    properties: Optional["_models.ReplicationLinkUpdateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["link_type"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ReplicationLinkUpdateProperties"] = 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 ReplicationLinkUpdateProperties(_Model):
    """Properties of a replication link update.

    :ivar link_type: Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED.
     Known values are: "GEO", "NAMED", and "STANDBY".
    :vartype link_type: str or ~azure.mgmt.sql.models.ReplicationLinkType
    """

    link_type: Optional[Union[str, "_models.ReplicationLinkType"]] = rest_field(
        name="linkType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED. Known values are:
     \"GEO\", \"NAMED\", and \"STANDBY\"."""

    @overload
    def __init__(
        self,
        *,
        link_type: Optional[Union[str, "_models.ReplicationLinkType"]] = 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 ResourceIdentity(_Model):
    """Azure Active Directory identity configuration for a resource.

    :ivar user_assigned_identities: The resource ids of the user assigned identities to use.
    :vartype user_assigned_identities: dict[str, ~azure.mgmt.sql.models.UserIdentity]
    :ivar principal_id: The Azure Active Directory principal id.
    :vartype principal_id: str
    :ivar type: The identity type. Set this to 'SystemAssigned' in order to automatically create
     and assign an Azure Active Directory principal for the resource. Known values are: "None",
     "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned".
    :vartype type: str or ~azure.mgmt.sql.models.IdentityType
    :ivar tenant_id: The Azure Active Directory tenant id.
    :vartype tenant_id: str
    """

    user_assigned_identities: Optional[dict[str, "_models.UserIdentity"]] = rest_field(
        name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource ids of the user assigned identities to use."""
    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The Azure Active Directory principal id."""
    type: Optional[Union[str, "_models.IdentityType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an
     Azure Active Directory principal for the resource. Known values are: \"None\",
     \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\"."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"])
    """The Azure Active Directory tenant id."""

    @overload
    def __init__(
        self,
        *,
        user_assigned_identities: Optional[dict[str, "_models.UserIdentity"]] = None,
        type: Optional[Union[str, "_models.IdentityType"]] = 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 ResourceMoveDefinition(_Model):
    """Contains the information necessary to perform a resource move (rename).

    :ivar id: The target ID for the resource. Required.
    :vartype id: str
    """

    id: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The target ID for the resource. Required."""

    @overload
    def __init__(
        self,
        *,
        id: str,  # 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 RestorableDroppedDatabase(ProxyResource):
    """A restorable dropped database 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.RestorableDroppedDatabaseProperties
    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar location: Resource location.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    properties: Optional["_models.RestorableDroppedDatabaseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name and tier of the SKU."""
    location: Optional[str] = rest_field(visibility=["read", "create"])
    """Resource location."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = [
        "database_name",
        "max_size_bytes",
        "creation_date",
        "deletion_date",
        "earliest_restore_date",
        "backup_storage_redundancy",
        "keys_property",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RestorableDroppedDatabaseProperties"] = None,
        sku: Optional["_models.Sku"] = None,
        location: Optional[str] = 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 RestorableDroppedDatabaseProperties(_Model):
    """The restorable dropped database's properties.

    :ivar database_name: The name of the database.
    :vartype database_name: str
    :ivar max_size_bytes: The max size of the database expressed in bytes.
    :vartype max_size_bytes: int
    :ivar creation_date: The creation date of the database (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar deletion_date: The deletion date of the database (ISO8601 format).
    :vartype deletion_date: ~datetime.datetime
    :ivar earliest_restore_date: The earliest restore date of the database (ISO8601 format).
    :vartype earliest_restore_date: ~datetime.datetime
    :ivar backup_storage_redundancy: The storage account type used to store backups for this
     database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype backup_storage_redundancy: str or ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar keys_property: The resource ids of the user assigned identities to use.
    :vartype keys_property: dict[str, ~azure.mgmt.sql.models.DatabaseKey]
    """

    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """The name of the database."""
    max_size_bytes: Optional[int] = rest_field(name="maxSizeBytes", visibility=["read"])
    """The max size of the database expressed in bytes."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """The creation date of the database (ISO8601 format)."""
    deletion_date: Optional[datetime.datetime] = rest_field(name="deletionDate", visibility=["read"], format="rfc3339")
    """The deletion date of the database (ISO8601 format)."""
    earliest_restore_date: Optional[datetime.datetime] = rest_field(
        name="earliestRestoreDate", visibility=["read"], format="rfc3339"
    )
    """The earliest restore date of the database (ISO8601 format)."""
    backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="backupStorageRedundancy", visibility=["read"]
    )
    """The storage account type used to store backups for this database. Known values are: \"Geo\",
     \"Local\", \"Zone\", and \"GeoZone\"."""
    keys_property: Optional[dict[str, "_models.DatabaseKey"]] = rest_field(
        name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys"
    )
    """The resource ids of the user assigned identities to use."""

    @overload
    def __init__(
        self,
        *,
        keys_property: Optional[dict[str, "_models.DatabaseKey"]] = 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 RestorableDroppedManagedDatabase(TrackedResource):
    """A restorable dropped managed database 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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.RestorableDroppedManagedDatabaseProperties
    """

    properties: Optional["_models.RestorableDroppedManagedDatabaseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["database_name", "creation_date", "deletion_date", "earliest_restore_date"]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.RestorableDroppedManagedDatabaseProperties"] = 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 RestorableDroppedManagedDatabaseProperties(_Model):  # pylint: disable=name-too-long
    """The restorable dropped managed database's properties.

    :ivar database_name: The name of the database.
    :vartype database_name: str
    :ivar creation_date: The creation date of the database (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar deletion_date: The deletion date of the database (ISO8601 format).
    :vartype deletion_date: ~datetime.datetime
    :ivar earliest_restore_date: The earliest restore date of the database (ISO8601 format).
    :vartype earliest_restore_date: ~datetime.datetime
    """

    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """The name of the database."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """The creation date of the database (ISO8601 format)."""
    deletion_date: Optional[datetime.datetime] = rest_field(name="deletionDate", visibility=["read"], format="rfc3339")
    """The deletion date of the database (ISO8601 format)."""
    earliest_restore_date: Optional[datetime.datetime] = rest_field(
        name="earliestRestoreDate", visibility=["read"], format="rfc3339"
    )
    """The earliest restore date of the database (ISO8601 format)."""


class RestorePoint(ProxyResource):
    """Database restore points.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.RestorePointProperties
    :ivar location: Resource location.
    :vartype location: str
    """

    properties: Optional["_models.RestorePointProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Resource location."""

    __flattened_items = [
        "restore_point_type",
        "earliest_restore_date",
        "restore_point_creation_date",
        "restore_point_label",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RestorePointProperties"] = 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 RestorePointProperties(_Model):
    """Properties of a database restore point.

    :ivar restore_point_type: The type of restore point. Known values are: "CONTINUOUS" and
     "DISCRETE".
    :vartype restore_point_type: str or ~azure.mgmt.sql.models.RestorePointType
    :ivar earliest_restore_date: The earliest time to which this database can be restored.
    :vartype earliest_restore_date: ~datetime.datetime
    :ivar restore_point_creation_date: The time the backup was taken.
    :vartype restore_point_creation_date: ~datetime.datetime
    :ivar restore_point_label: The label of restore point for backup request by user.
    :vartype restore_point_label: str
    """

    restore_point_type: Optional[Union[str, "_models.RestorePointType"]] = rest_field(
        name="restorePointType", visibility=["read"]
    )
    """The type of restore point. Known values are: \"CONTINUOUS\" and \"DISCRETE\"."""
    earliest_restore_date: Optional[datetime.datetime] = rest_field(
        name="earliestRestoreDate", visibility=["read"], format="rfc3339"
    )
    """The earliest time to which this database can be restored."""
    restore_point_creation_date: Optional[datetime.datetime] = rest_field(
        name="restorePointCreationDate", visibility=["read"], format="rfc3339"
    )
    """The time the backup was taken."""
    restore_point_label: Optional[str] = rest_field(name="restorePointLabel", visibility=["read"])
    """The label of restore point for backup request by user."""


class ScheduleItem(_Model):
    """Schedule info describing when the server should be started or stopped.

    :ivar start_day: Start day. Required. Known values are: "Sunday", "Monday", "Tuesday",
     "Wednesday", "Thursday", "Friday", and "Saturday".
    :vartype start_day: str or ~azure.mgmt.sql.models.DayOfWeek
    :ivar start_time: Start time. Required.
    :vartype start_time: str
    :ivar stop_day: Stop day. Required. Known values are: "Sunday", "Monday", "Tuesday",
     "Wednesday", "Thursday", "Friday", and "Saturday".
    :vartype stop_day: str or ~azure.mgmt.sql.models.DayOfWeek
    :ivar stop_time: Stop time. Required.
    :vartype stop_time: str
    """

    start_day: Union[str, "_models.DayOfWeek"] = rest_field(
        name="startDay", visibility=["read", "create", "update", "delete", "query"]
    )
    """Start day. Required. Known values are: \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\",
     \"Thursday\", \"Friday\", and \"Saturday\"."""
    start_time: str = rest_field(name="startTime", visibility=["read", "create", "update", "delete", "query"])
    """Start time. Required."""
    stop_day: Union[str, "_models.DayOfWeek"] = rest_field(
        name="stopDay", visibility=["read", "create", "update", "delete", "query"]
    )
    """Stop day. Required. Known values are: \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\",
     \"Thursday\", \"Friday\", and \"Saturday\"."""
    stop_time: str = rest_field(name="stopTime", visibility=["read", "create", "update", "delete", "query"])
    """Stop time. Required."""

    @overload
    def __init__(
        self,
        *,
        start_day: Union[str, "_models.DayOfWeek"],
        start_time: str,
        stop_day: Union[str, "_models.DayOfWeek"],
        stop_time: str,
    ) -> 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 SecurityAlertPolicyProperties(_Model):
    """Properties of a security alert policy.

    :ivar state: Specifies the state of the policy, whether it is enabled or disabled or a policy
     has not been applied yet on the specific database. Required. Known values are: "New",
     "Enabled", and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState
    :ivar disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
     Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
     Brute_Force.
    :vartype disabled_alerts: list[str]
    :ivar email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
    :vartype email_addresses: list[str]
    :ivar email_account_admins: Specifies that the alert is sent to the account administrators.
    :vartype email_account_admins: bool
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     `https://MyAccount.blob.core.windows.net <https://MyAccount.blob.core.windows.net>`_). This
     blob storage will hold all Threat Detection audit logs.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the Threat Detection audit
     storage account.
    :vartype storage_account_access_key: str
    :ivar retention_days: Specifies the number of days to keep in the Threat Detection audit logs.
    :vartype retention_days: int
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    state: Union[str, "_models.SecurityAlertPolicyState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the policy, whether it is enabled or disabled or a policy has not been
     applied yet on the specific database. Required. Known values are: \"New\", \"Enabled\", and
     \"Disabled\"."""
    disabled_alerts: Optional[list[str]] = rest_field(
        name="disabledAlerts", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection,
     Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force."""
    email_addresses: Optional[list[str]] = rest_field(
        name="emailAddresses", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies an array of e-mail addresses to which the alert is sent."""
    email_account_admins: Optional[bool] = rest_field(
        name="emailAccountAdmins", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies that the alert is sent to the account administrators."""
    storage_endpoint: Optional[str] = rest_field(
        name="storageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage endpoint (e.g. `https://MyAccount.blob.core.windows.net
     <https://MyAccount.blob.core.windows.net>`_). This blob storage will hold all Threat Detection
     audit logs."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the identifier key of the Threat Detection audit storage account."""
    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the number of days to keep in the Threat Detection audit logs."""
    creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339")
    """Specifies the UTC creation time of the policy."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.SecurityAlertPolicyState"],
        disabled_alerts: Optional[list[str]] = None,
        email_addresses: Optional[list[str]] = None,
        email_account_admins: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        retention_days: 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 SecurityAlertsPolicyProperties(_Model):
    """Properties of a security alert policy.

    :ivar state: Specifies the state of the policy, whether it is enabled or disabled or a policy
     has not been applied yet on the specific database. Required. Known values are: "Enabled" and
     "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SecurityAlertsPolicyState
    :ivar disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
     Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
     Brute_Force.
    :vartype disabled_alerts: list[str]
    :ivar email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
    :vartype email_addresses: list[str]
    :ivar email_account_admins: Specifies that the alert is sent to the account administrators.
    :vartype email_account_admins: bool
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     `https://MyAccount.blob.core.windows.net <https://MyAccount.blob.core.windows.net>`_). This
     blob storage will hold all Threat Detection audit logs.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the Threat Detection audit
     storage account.
    :vartype storage_account_access_key: str
    :ivar retention_days: Specifies the number of days to keep in the Threat Detection audit logs.
    :vartype retention_days: int
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    state: Union[str, "_models.SecurityAlertsPolicyState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the policy, whether it is enabled or disabled or a policy has not been
     applied yet on the specific database. Required. Known values are: \"Enabled\" and \"Disabled\"."""
    disabled_alerts: Optional[list[str]] = rest_field(
        name="disabledAlerts", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection,
     Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force."""
    email_addresses: Optional[list[str]] = rest_field(
        name="emailAddresses", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies an array of e-mail addresses to which the alert is sent."""
    email_account_admins: Optional[bool] = rest_field(
        name="emailAccountAdmins", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies that the alert is sent to the account administrators."""
    storage_endpoint: Optional[str] = rest_field(
        name="storageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage endpoint (e.g. `https://MyAccount.blob.core.windows.net
     <https://MyAccount.blob.core.windows.net>`_). This blob storage will hold all Threat Detection
     audit logs."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the identifier key of the Threat Detection audit storage account."""
    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the number of days to keep in the Threat Detection audit logs."""
    creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339")
    """Specifies the UTC creation time of the policy."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.SecurityAlertsPolicyState"],
        disabled_alerts: Optional[list[str]] = None,
        email_addresses: Optional[list[str]] = None,
        email_account_admins: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        retention_days: 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 SecurityEvent(ProxyResource):
    """A security event.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SecurityEventProperties
    """

    properties: Optional["_models.SecurityEventProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "event_time",
        "security_event_type",
        "subscription",
        "server",
        "database",
        "client_ip",
        "application_name",
        "principal_name",
        "security_event_sql_injection_additional_properties",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SecurityEventProperties"] = 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 SecurityEventProperties(_Model):
    """The properties of a security event.

    :ivar event_time: The time when the security event occurred.
    :vartype event_time: ~datetime.datetime
    :ivar security_event_type: The type of the security event. Known values are: "Undefined",
     "SqlInjectionVulnerability", and "SqlInjectionExploit".
    :vartype security_event_type: str or ~azure.mgmt.sql.models.SecurityEventType
    :ivar subscription: The subscription name.
    :vartype subscription: str
    :ivar server: The server name.
    :vartype server: str
    :ivar database: The database name.
    :vartype database: str
    :ivar client_ip: The IP address of the client who executed the statement.
    :vartype client_ip: str
    :ivar application_name: The application used to execute the statement.
    :vartype application_name: str
    :ivar principal_name: The principal user who executed the statement.
    :vartype principal_name: str
    :ivar security_event_sql_injection_additional_properties: The sql injection additional
     properties, populated only if the type of the security event is sql injection.
    :vartype security_event_sql_injection_additional_properties:
     ~azure.mgmt.sql.models.SecurityEventSqlInjectionAdditionalProperties
    """

    event_time: Optional[datetime.datetime] = rest_field(name="eventTime", visibility=["read"], format="rfc3339")
    """The time when the security event occurred."""
    security_event_type: Optional[Union[str, "_models.SecurityEventType"]] = rest_field(
        name="securityEventType", visibility=["read"]
    )
    """The type of the security event. Known values are: \"Undefined\", \"SqlInjectionVulnerability\",
     and \"SqlInjectionExploit\"."""
    subscription: Optional[str] = rest_field(visibility=["read"])
    """The subscription name."""
    server: Optional[str] = rest_field(visibility=["read"])
    """The server name."""
    database: Optional[str] = rest_field(visibility=["read"])
    """The database name."""
    client_ip: Optional[str] = rest_field(name="clientIp", visibility=["read"])
    """The IP address of the client who executed the statement."""
    application_name: Optional[str] = rest_field(name="applicationName", visibility=["read"])
    """The application used to execute the statement."""
    principal_name: Optional[str] = rest_field(name="principalName", visibility=["read"])
    """The principal user who executed the statement."""
    security_event_sql_injection_additional_properties: Optional[
        "_models.SecurityEventSqlInjectionAdditionalProperties"
    ] = rest_field(name="securityEventSqlInjectionAdditionalProperties", visibility=["read"])
    """The sql injection additional properties, populated only if the type of the security event is
     sql injection."""


class SecurityEventSqlInjectionAdditionalProperties(_Model):  # pylint: disable=name-too-long
    """The properties of a security event sql injection additional properties.

    :ivar threat_id: The threat ID.
    :vartype threat_id: str
    :ivar statement: The statement.
    :vartype statement: str
    :ivar statement_highlight_offset: The statement highlight offset.
    :vartype statement_highlight_offset: int
    :ivar statement_highlight_length: The statement highlight length.
    :vartype statement_highlight_length: int
    :ivar error_code: The sql error code.
    :vartype error_code: int
    :ivar error_severity: The sql error severity.
    :vartype error_severity: int
    :ivar error_message: The sql error message.
    :vartype error_message: str
    """

    threat_id: Optional[str] = rest_field(name="threatId", visibility=["read"])
    """The threat ID."""
    statement: Optional[str] = rest_field(visibility=["read"])
    """The statement."""
    statement_highlight_offset: Optional[int] = rest_field(name="statementHighlightOffset", visibility=["read"])
    """The statement highlight offset."""
    statement_highlight_length: Optional[int] = rest_field(name="statementHighlightLength", visibility=["read"])
    """The statement highlight length."""
    error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"])
    """The sql error code."""
    error_severity: Optional[int] = rest_field(name="errorSeverity", visibility=["read"])
    """The sql error severity."""
    error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"])
    """The sql error message."""


class SensitivityLabel(ProxyResource):
    """A sensitivity label.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SensitivityLabelProperties
    :ivar managed_by: Resource that manages the sensitivity label.
    :vartype managed_by: str
    """

    properties: Optional["_models.SensitivityLabelProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read"])
    """Resource that manages the sensitivity label."""

    __flattened_items = [
        "schema_name",
        "table_name",
        "column_name",
        "label_name",
        "label_id",
        "information_type",
        "information_type_id",
        "is_disabled",
        "rank",
        "client_classification_source",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SensitivityLabelProperties"] = 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 SensitivityLabelProperties(_Model):
    """Properties of a sensitivity label.

    :ivar schema_name: The schema name.
    :vartype schema_name: str
    :ivar table_name: The table name.
    :vartype table_name: str
    :ivar column_name: The column name.
    :vartype column_name: str
    :ivar label_name: The label name.
    :vartype label_name: str
    :ivar label_id: The label ID.
    :vartype label_id: str
    :ivar information_type: The information type.
    :vartype information_type: str
    :ivar information_type_id: The information type ID.
    :vartype information_type_id: str
    :ivar is_disabled: Is sensitivity recommendation disabled. Applicable for recommended
     sensitivity label only. Specifies whether the sensitivity recommendation on this column is
     disabled (dismissed) or not.
    :vartype is_disabled: bool
    :ivar rank: Known values are: "None", "Low", "Medium", "High", and "Critical".
    :vartype rank: str or ~azure.mgmt.sql.models.SensitivityLabelRank
    :ivar client_classification_source: Known values are: "None", "Native", "Recommended", and
     "MIP".
    :vartype client_classification_source: str or ~azure.mgmt.sql.models.ClientClassificationSource
    """

    schema_name: Optional[str] = rest_field(name="schemaName", visibility=["read"])
    """The schema name."""
    table_name: Optional[str] = rest_field(name="tableName", visibility=["read"])
    """The table name."""
    column_name: Optional[str] = rest_field(name="columnName", visibility=["read"])
    """The column name."""
    label_name: Optional[str] = rest_field(name="labelName", visibility=["read", "create", "update", "delete", "query"])
    """The label name."""
    label_id: Optional[str] = rest_field(name="labelId", visibility=["read", "create", "update", "delete", "query"])
    """The label ID."""
    information_type: Optional[str] = rest_field(
        name="informationType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The information type."""
    information_type_id: Optional[str] = rest_field(
        name="informationTypeId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The information type ID."""
    is_disabled: Optional[bool] = rest_field(name="isDisabled", visibility=["read"])
    """Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only.
     Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not."""
    rank: Optional[Union[str, "_models.SensitivityLabelRank"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Known values are: \"None\", \"Low\", \"Medium\", \"High\", and \"Critical\"."""
    client_classification_source: Optional[Union[str, "_models.ClientClassificationSource"]] = rest_field(
        name="clientClassificationSource", visibility=["read", "create", "update", "delete", "query"]
    )
    """Known values are: \"None\", \"Native\", \"Recommended\", and \"MIP\"."""

    @overload
    def __init__(
        self,
        *,
        label_name: Optional[str] = None,
        label_id: Optional[str] = None,
        information_type: Optional[str] = None,
        information_type_id: Optional[str] = None,
        rank: Optional[Union[str, "_models.SensitivityLabelRank"]] = None,
        client_classification_source: Optional[Union[str, "_models.ClientClassificationSource"]] = 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 SensitivityLabelUpdate(ProxyResource):
    """A sensitivity label update operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SensitivityLabelUpdateProperties
    """

    properties: Optional["_models.SensitivityLabelUpdateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["op", "schema", "table", "column", "sensitivity_label"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SensitivityLabelUpdateProperties"] = 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 SensitivityLabelUpdateList(_Model):
    """A list of sensitivity label update operations.

    :ivar operations:
    :vartype operations: list[~azure.mgmt.sql.models.SensitivityLabelUpdate]
    """

    operations: Optional[list["_models.SensitivityLabelUpdate"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        operations: Optional[list["_models.SensitivityLabelUpdate"]] = 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 SensitivityLabelUpdateProperties(_Model):
    """Properties of an operation executed on a sensitivity label.

    :ivar op: Required. Known values are: "set" and "remove".
    :vartype op: str or ~azure.mgmt.sql.models.SensitivityLabelUpdateKind
    :ivar schema: Schema name of the column to update. Required.
    :vartype schema: str
    :ivar table: Table name of the column to update. Required.
    :vartype table: str
    :ivar column: Column name to update. Required.
    :vartype column: str
    :ivar sensitivity_label: The sensitivity label information to apply on a column.
    :vartype sensitivity_label: ~azure.mgmt.sql.models.SensitivityLabel
    """

    op: Union[str, "_models.SensitivityLabelUpdateKind"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Required. Known values are: \"set\" and \"remove\"."""
    schema: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Schema name of the column to update. Required."""
    table: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Table name of the column to update. Required."""
    column: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Column name to update. Required."""
    sensitivity_label: Optional["_models.SensitivityLabel"] = rest_field(
        name="sensitivityLabel", visibility=["read", "create", "update", "delete", "query"]
    )
    """The sensitivity label information to apply on a column."""

    @overload
    def __init__(
        self,
        *,
        op: Union[str, "_models.SensitivityLabelUpdateKind"],
        schema: str,
        table: str,
        column: str,
        sensitivity_label: Optional["_models.SensitivityLabel"] = 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 Server(TrackedResource):
    """An Azure SQL Database server.

    :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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerProperties
    :ivar identity: The Azure Active Directory identity of the server.
    :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity
    :ivar kind: Kind of sql server. This is metadata used for the Azure portal experience.
    :vartype kind: str
    """

    properties: Optional["_models.ServerProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    identity: Optional["_models.ResourceIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The Azure Active Directory identity of the server."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Kind of sql server. This is metadata used for the Azure portal experience."""

    __flattened_items = [
        "administrator_login",
        "administrator_login_password",
        "version",
        "state",
        "fully_qualified_domain_name",
        "private_endpoint_connections",
        "minimal_tls_version",
        "public_network_access",
        "workspace_feature",
        "primary_user_assigned_identity_id",
        "federated_client_id",
        "key_id",
        "administrators",
        "restrict_outbound_network_access",
        "is_i_pv6_enabled",
        "external_governance_status",
        "retention_days",
        "create_mode",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.ServerProperties"] = None,
        identity: Optional["_models.ResourceIdentity"] = 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 ServerAdvancedThreatProtection(ProxyResource):
    """A server Advanced Threat Protection.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.AdvancedThreatProtectionProperties
    """

    properties: Optional["_models.AdvancedThreatProtectionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["state", "creation_time"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.AdvancedThreatProtectionProperties"] = 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 ServerAutomaticTuning(ProxyResource):
    """Server-level Automatic Tuning.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.AutomaticTuningServerProperties
    """

    properties: Optional["_models.AutomaticTuningServerProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["desired_state", "actual_state", "options"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.AutomaticTuningServerProperties"] = 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 ServerAzureADAdministrator(ProxyResource):
    """Azure Active Directory administrator.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.AdministratorProperties
    """

    properties: Optional["_models.AdministratorProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["administrator_type", "login", "sid", "tenant_id", "azure_ad_only_authentication"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.AdministratorProperties"] = 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 ServerAzureADOnlyAuthentication(ProxyResource):
    """Azure Active Directory only authentication.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.AzureADOnlyAuthProperties
    """

    properties: Optional["_models.AzureADOnlyAuthProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["azure_ad_only_authentication"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.AzureADOnlyAuthProperties"] = 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 ServerBlobAuditingPolicy(ProxyResource):
    """A server blob auditing policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerBlobAuditingPolicyProperties
    """

    properties: Optional["_models.ServerBlobAuditingPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "is_devops_audit_enabled",
        "retention_days",
        "audit_actions_and_groups",
        "is_storage_secondary_key_in_use",
        "is_azure_monitor_target_enabled",
        "queue_delay_ms",
        "is_managed_identity_in_use",
        "state",
        "storage_endpoint",
        "storage_account_access_key",
        "storage_account_subscription_id",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerBlobAuditingPolicyProperties"] = 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 ServerBlobAuditingPolicyProperties(_Model):
    """Properties of a server blob auditing policy.

    :ivar is_devops_audit_enabled: Specifies the state of devops audit. If state is Enabled, devops
     logs will be sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled',
     'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true

     When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit'
     diagnostic logs category on the master database should also be created.

     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_devops_audit_enabled: bool
    :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage
     account.
    :vartype retention_days: int
    :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:

     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.

     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.

     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP

     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.

     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES

     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}

     Note that <object> in the above format can refer to an object like a table, view, or stored
     procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name}
     and SCHEMA::{schema_name} are used, respectively.

     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public

     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
    :vartype audit_actions_and_groups: list[str]
    :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the
     storage's secondary key.
    :vartype is_storage_secondary_key_in_use: bool
    :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.

     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit
     actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum
     is 2,147,483,647.
    :vartype queue_delay_ms: int
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     `https://MyAccount.blob.core.windows.net <https://MyAccount.blob.core.windows.net>`_). If state
     is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:

     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355).
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    is_devops_audit_enabled: Optional[bool] = rest_field(
        name="isDevopsAuditEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled',
     'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true
     
     When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit'
     diagnostic logs category on the master database should also be created.
     
     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_
     
     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_."""
    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the number of days to keep in the audit logs in the storage account."""
    audit_actions_and_groups: Optional[list[str]] = rest_field(
        name="auditActionsAndGroups", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the Actions-Groups and Actions to audit.
     
     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:
     
     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.
     
     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.
     
     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):
     
     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP
     
     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.
     
     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.
     
     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES
     
     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}
     
     Note that <object> in the above format can refer to an object like a table, view, or stored
     procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name}
     and SCHEMA::{schema_name} are used, respectively.
     
     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public
     
     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_."""
    is_storage_secondary_key_in_use: Optional[bool] = rest_field(
        name="isStorageSecondaryKeyInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether storageAccountAccessKey value is the storage's secondary key."""
    is_azure_monitor_target_enabled: Optional[bool] = rest_field(
        name="isAzureMonitorTargetEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether audit events are sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.
     
     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.
     
     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_
     
     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_."""
    queue_delay_ms: Optional[int] = rest_field(
        name="queueDelayMs", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the amount of time in milliseconds that can elapse before audit actions are forced to
     be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647."""
    is_managed_identity_in_use: Optional[bool] = rest_field(
        name="isManagedIdentityInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether Managed Identity is used to access blob storage."""
    state: Union[str, "_models.BlobAuditingPolicyState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: \"Enabled\" and
     \"Disabled\"."""
    storage_endpoint: Optional[str] = rest_field(
        name="storageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage endpoint (e.g. `https://MyAccount.blob.core.windows.net
     <https://MyAccount.blob.core.windows.net>`_). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["create", "update"]
    )
    """Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:
     
     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355)."""
    storage_account_subscription_id: Optional[str] = rest_field(
        name="storageAccountSubscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage subscription Id."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.BlobAuditingPolicyState"],
        is_devops_audit_enabled: Optional[bool] = None,
        retention_days: Optional[int] = None,
        audit_actions_and_groups: Optional[list[str]] = None,
        is_storage_secondary_key_in_use: Optional[bool] = None,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        queue_delay_ms: Optional[int] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: 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 ServerConfigurationOption(ProxyResource):
    """A server configuration option.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerConfigurationOptionProperties
    """

    properties: Optional["_models.ServerConfigurationOptionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["server_configuration_option_value", "provisioning_state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerConfigurationOptionProperties"] = 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 ServerConfigurationOptionProperties(_Model):
    """The properties of server configuration option.

    :ivar server_configuration_option_value: Value of the server configuration option. Required.
    :vartype server_configuration_option_value: int
    :ivar provisioning_state: Provisioning state of server configuration option. Known values are:
     "Created", "InProgress", "Succeeded", "Failed", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.ProvisioningState
    """

    server_configuration_option_value: int = rest_field(
        name="serverConfigurationOptionValue", visibility=["read", "update"]
    )
    """Value of the server configuration option. Required."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state of server configuration option. Known values are: \"Created\",
     \"InProgress\", \"Succeeded\", \"Failed\", and \"Canceled\"."""

    @overload
    def __init__(
        self,
        *,
        server_configuration_option_value: int,
    ) -> 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 ServerConnectionPolicy(ProxyResource):
    """A server connection policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerConnectionPolicyProperties
    :ivar location: Resource location.
    :vartype location: str
    :ivar kind: Metadata used for the Azure portal experience.
    :vartype kind: str
    """

    properties: Optional["_models.ServerConnectionPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Resource location."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Metadata used for the Azure portal experience."""

    __flattened_items = ["connection_type"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerConnectionPolicyProperties"] = 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 ServerConnectionPolicyProperties(_Model):
    """The properties of a server connection policy.

    :ivar connection_type: The server connection type. Required. Known values are: "Default",
     "Redirect", and "Proxy".
    :vartype connection_type: str or ~azure.mgmt.sql.models.ServerConnectionType
    """

    connection_type: Union[str, "_models.ServerConnectionType"] = rest_field(
        name="connectionType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The server connection type. Required. Known values are: \"Default\", \"Redirect\", and
     \"Proxy\"."""

    @overload
    def __init__(
        self,
        *,
        connection_type: Union[str, "_models.ServerConnectionType"],
    ) -> 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 ServerDevOpsAuditingSettings(ProxyResource):
    """A server DevOps auditing settings.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerDevOpsAuditSettingsProperties
    """

    properties: Optional["_models.ServerDevOpsAuditSettingsProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "is_azure_monitor_target_enabled",
        "is_managed_identity_in_use",
        "state",
        "storage_endpoint",
        "storage_account_access_key",
        "storage_account_subscription_id",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerDevOpsAuditSettingsProperties"] = 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 ServerDevOpsAuditSettingsProperties(_Model):
    """Properties of a server DevOps audit settings.

    :ivar is_azure_monitor_target_enabled: Specifies whether DevOps audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit'
     diagnostic logs category on the master database should be also created.

     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     `https://MyAccount.blob.core.windows.net <https://MyAccount.blob.core.windows.net>`_). If state
     is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:

     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355).
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    is_azure_monitor_target_enabled: Optional[bool] = rest_field(
        name="isAzureMonitorTargetEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether DevOps audit events are sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.
     
     When using REST API to configure DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit'
     diagnostic logs category on the master database should be also created.
     
     Diagnostic Settings URI format:
     PUT
     `https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
     <https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview>`_
     
     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_."""
    is_managed_identity_in_use: Optional[bool] = rest_field(
        name="isManagedIdentityInUse", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether Managed Identity is used to access blob storage."""
    state: Union[str, "_models.BlobAuditingPolicyState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Required. Known values are: \"Enabled\" and
     \"Disabled\"."""
    storage_endpoint: Optional[str] = rest_field(
        name="storageEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage endpoint (e.g. `https://MyAccount.blob.core.windows.net
     <https://MyAccount.blob.core.windows.net>`_). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["create", "update"]
    )
    """Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:
     
     1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
     For more information, see [Auditing to storage using Managed Identity
     authentication](https://go.microsoft.com/fwlink/?linkid=2114355)."""
    storage_account_subscription_id: Optional[str] = rest_field(
        name="storageAccountSubscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the blob storage subscription Id."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.BlobAuditingPolicyState"],
        is_azure_monitor_target_enabled: Optional[bool] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: 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 ServerDnsAlias(ProxyResource):
    """A server DNS alias.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerDnsAliasProperties
    """

    properties: Optional["_models.ServerDnsAliasProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["azure_dns_record"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerDnsAliasProperties"] = 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 ServerDnsAliasAcquisition(_Model):
    """A server dns alias acquisition request.

    :ivar old_server_dns_alias_id: The id of the server alias that will be acquired to point to
     this server instead. Required.
    :vartype old_server_dns_alias_id: str
    """

    old_server_dns_alias_id: str = rest_field(
        name="oldServerDnsAliasId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The id of the server alias that will be acquired to point to this server instead. Required."""

    @overload
    def __init__(
        self,
        *,
        old_server_dns_alias_id: str,
    ) -> 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 ServerDnsAliasProperties(_Model):
    """Properties of a server DNS alias.

    :ivar azure_dns_record: The fully qualified DNS record for alias.
    :vartype azure_dns_record: str
    """

    azure_dns_record: Optional[str] = rest_field(name="azureDnsRecord", visibility=["read"])
    """The fully qualified DNS record for alias."""


class ServerExternalAdministrator(_Model):
    """Properties of a active directory administrator.

    :ivar administrator_type: Type of the sever administrator. "ActiveDirectory"
    :vartype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
    :ivar principal_type: Principal Type of the sever administrator. Known values are: "User",
     "Group", and "Application".
    :vartype principal_type: str or ~azure.mgmt.sql.models.PrincipalType
    :ivar login: Login name of the server administrator.
    :vartype login: str
    :ivar sid: SID (object ID) of the server administrator.
    :vartype sid: str
    :ivar tenant_id: Tenant ID of the administrator.
    :vartype tenant_id: str
    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
    :vartype azure_ad_only_authentication: bool
    """

    administrator_type: Optional[Union[str, "_models.AdministratorType"]] = rest_field(
        name="administratorType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the sever administrator. \"ActiveDirectory\""""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Principal Type of the sever administrator. Known values are: \"User\", \"Group\", and
     \"Application\"."""
    login: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Login name of the server administrator."""
    sid: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """SID (object ID) of the server administrator."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"])
    """Tenant ID of the administrator."""
    azure_ad_only_authentication: Optional[bool] = rest_field(
        name="azureADOnlyAuthentication", visibility=["read", "create", "update", "delete", "query"]
    )
    """Azure Active Directory only Authentication enabled."""

    @overload
    def __init__(
        self,
        *,
        administrator_type: Optional[Union[str, "_models.AdministratorType"]] = None,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        login: Optional[str] = None,
        sid: Optional[str] = None,
        tenant_id: Optional[str] = None,
        azure_ad_only_authentication: Optional[bool] = 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 ServerFirewallRuleProperties(_Model):
    """The properties of a server firewall rule.

    :ivar start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. Use
     value '0.0.0.0' for all Azure-internal IP addresses.
    :vartype start_ip_address: str
    :ivar end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be
     greater than or equal to startIpAddress. Use value '0.0.0.0' for all Azure-internal IP
     addresses.
    :vartype end_ip_address: str
    """

    start_ip_address: Optional[str] = rest_field(
        name="startIpAddress", visibility=["read", "create", "update", "delete", "query"]
    )
    """The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' for all
     Azure-internal IP addresses."""
    end_ip_address: Optional[str] = rest_field(
        name="endIpAddress", visibility=["read", "create", "update", "delete", "query"]
    )
    """The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to
     startIpAddress. Use value '0.0.0.0' for all Azure-internal IP addresses."""

    @overload
    def __init__(
        self,
        *,
        start_ip_address: Optional[str] = None,
        end_ip_address: 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 ServerInfo(_Model):
    """Server info for the server trust group.

    :ivar server_id: Server Id. Required.
    :vartype server_id: str
    """

    server_id: str = rest_field(name="serverId", visibility=["read", "create", "update", "delete", "query"])
    """Server Id. Required."""

    @overload
    def __init__(
        self,
        *,
        server_id: str,
    ) -> 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 ServerKey(ProxyResource):
    """A server key.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerKeyProperties
    :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal
     experience.
    :vartype kind: str
    :ivar location: Resource location.
    :vartype location: str
    """

    properties: Optional["_models.ServerKeyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    kind: Optional[str] = rest_field(visibility=["read"])
    """Kind of encryption protector. This is metadata used for the Azure portal experience."""
    location: Optional[str] = rest_field(visibility=["read"])
    """Resource location."""

    __flattened_items = [
        "subregion",
        "server_key_type",
        "uri",
        "thumbprint",
        "creation_date",
        "auto_rotation_enabled",
        "key_version",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerKeyProperties"] = 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 ServerKeyProperties(_Model):
    """Properties for a server key execution.

    :ivar subregion: Subregion of the server key.
    :vartype subregion: str
    :ivar server_key_type: The server key type like 'ServiceManaged', 'AzureKeyVault'. Required.
     Known values are: "ServiceManaged" and "AzureKeyVault".
    :vartype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
    :ivar uri: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is
     required. The AKV URI is required to be in this format:
     '`https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion
     <https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion>`_' or can be
     '`https://YourVaultName.vault.azure.net/keys/YourKeyName
     <https://YourVaultName.vault.azure.net/keys/YourKeyName>`_'.
    :vartype uri: str
    :ivar thumbprint: Thumbprint of the server key.
    :vartype thumbprint: str
    :ivar creation_date: The server key creation date.
    :vartype creation_date: ~datetime.datetime
    :ivar auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
    :vartype auto_rotation_enabled: bool
    :ivar key_version: The version of the server key.
    :vartype key_version: str
    """

    subregion: Optional[str] = rest_field(visibility=["read"])
    """Subregion of the server key."""
    server_key_type: Union[str, "_models.ServerKeyType"] = rest_field(name="serverKeyType", visibility=["create"])
    """The server key type like 'ServiceManaged', 'AzureKeyVault'. Required. Known values are:
     \"ServiceManaged\" and \"AzureKeyVault\"."""
    uri: Optional[str] = rest_field(visibility=["create"])
    """The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. The
     AKV URI is required to be in this format:
     '`https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion
     <https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion>`_' or can be
     '`https://YourVaultName.vault.azure.net/keys/YourKeyName
     <https://YourVaultName.vault.azure.net/keys/YourKeyName>`_'."""
    thumbprint: Optional[str] = rest_field(visibility=["read"])
    """Thumbprint of the server key."""
    creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339")
    """The server key creation date."""
    auto_rotation_enabled: Optional[bool] = rest_field(name="autoRotationEnabled", visibility=["read"])
    """Key auto rotation opt-in flag. Either true or false."""
    key_version: Optional[str] = rest_field(name="keyVersion", visibility=["read"])
    """The version of the server key."""

    @overload
    def __init__(
        self,
        *,
        server_key_type: Union[str, "_models.ServerKeyType"],
        uri: 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 ServerOperation(ProxyResource):
    """A server operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerOperationProperties
    """

    properties: Optional["_models.ServerOperationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "operation",
        "operation_friendly_name",
        "percent_complete",
        "server_name",
        "start_time",
        "state",
        "error_code",
        "error_description",
        "error_severity",
        "is_user_error",
        "estimated_completion_time",
        "description",
        "is_cancellable",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerOperationProperties"] = 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 ServerOperationProperties(_Model):
    """The properties of a server operation.

    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar server_name: The name of the server.
    :vartype server_name: str
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    """

    operation: Optional[str] = rest_field(visibility=["read"])
    """The name of operation."""
    operation_friendly_name: Optional[str] = rest_field(name="operationFriendlyName", visibility=["read"])
    """The friendly name of operation."""
    percent_complete: Optional[int] = rest_field(name="percentComplete", visibility=["read"])
    """The percentage of the operation completed."""
    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """The name of the server."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The operation start time."""
    state: Optional[Union[str, "_models.ManagementOperationState"]] = rest_field(visibility=["read"])
    """The operation state. Known values are: \"Pending\", \"InProgress\", \"Succeeded\", \"Failed\",
     \"CancelInProgress\", and \"Cancelled\"."""
    error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"])
    """The operation error code."""
    error_description: Optional[str] = rest_field(name="errorDescription", visibility=["read"])
    """The operation error description."""
    error_severity: Optional[int] = rest_field(name="errorSeverity", visibility=["read"])
    """The operation error severity."""
    is_user_error: Optional[bool] = rest_field(name="isUserError", visibility=["read"])
    """Whether or not the error is a user error."""
    estimated_completion_time: Optional[datetime.datetime] = rest_field(
        name="estimatedCompletionTime", visibility=["read"], format="rfc3339"
    )
    """The estimated completion time of the operation."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The operation description."""
    is_cancellable: Optional[bool] = rest_field(name="isCancellable", visibility=["read"])
    """Whether the operation can be cancelled."""


class ServerPrivateEndpointConnection(_Model):
    """A private endpoint connection under a server.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar properties: Private endpoint connection properties.
    :vartype properties: ~azure.mgmt.sql.models.PrivateEndpointConnectionProperties
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """Resource ID."""
    properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field(visibility=["read"])
    """Private endpoint connection properties."""


class ServerProperties(_Model):
    """The properties of a server.

    :ivar administrator_login: Administrator username for the server. Once created it cannot be
     changed.
    :vartype administrator_login: str
    :ivar administrator_login_password: The administrator login password (required for server
     creation).
    :vartype administrator_login_password: str
    :ivar version: The version of the server.
    :vartype version: str
    :ivar state: The state of the server.
    :vartype state: str
    :ivar fully_qualified_domain_name: The fully qualified domain name of the server.
    :vartype fully_qualified_domain_name: str
    :ivar private_endpoint_connections: List of private endpoint connections on a server.
    :vartype private_endpoint_connections:
     list[~azure.mgmt.sql.models.ServerPrivateEndpointConnection]
    :ivar minimal_tls_version: Minimal TLS version. Allowed values: 'None', 1.0', '1.1', '1.2',
     '1.3'. Known values are: "None", "1.0", "1.1", "1.2", and "1.3".
    :vartype minimal_tls_version: str or ~azure.mgmt.sql.models.MinimalTlsVersion
    :ivar public_network_access: Whether or not public endpoint access is allowed for this server.
     Value is optional but if passed in, must be 'Enabled' or 'Disabled' or 'SecuredByPerimeter'.
     Known values are: "Enabled", "Disabled", and "SecuredByPerimeter".
    :vartype public_network_access: str or ~azure.mgmt.sql.models.ServerPublicNetworkAccessFlag
    :ivar workspace_feature: Whether or not existing server has a workspace created and if it
     allows connection from workspace. Known values are: "Connected" and "Disconnected".
    :vartype workspace_feature: str or ~azure.mgmt.sql.models.ServerWorkspaceFeature
    :ivar primary_user_assigned_identity_id: The resource id of a user assigned identity to be used
     by default.
    :vartype primary_user_assigned_identity_id: str
    :ivar federated_client_id: The Client id used for cross tenant CMK scenario.
    :vartype federated_client_id: str
    :ivar key_id: A CMK URI of the key to use for encryption.
    :vartype key_id: str
    :ivar administrators: The Azure Active Directory administrator can be utilized during server
     creation and for server updates, except for the azureADOnlyAuthentication property. To update
     the azureADOnlyAuthentication property, individual API must be used.
    :vartype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator
    :ivar restrict_outbound_network_access: Whether or not to restrict outbound network access for
     this server.  Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values
     are: "Enabled" and "Disabled".
    :vartype restrict_outbound_network_access: str or
     ~azure.mgmt.sql.models.ServerNetworkAccessFlag
    :ivar is_i_pv6_enabled: Whether or not to enable IPv6 support for this server.  Value is
     optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are: "Enabled" and
     "Disabled".
    :vartype is_i_pv6_enabled: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag
    :ivar external_governance_status: Status of external governance. Known values are: "Enabled"
     and "Disabled".
    :vartype external_governance_status: str or ~azure.mgmt.sql.models.ExternalGovernanceStatus
    :ivar retention_days: Number of days this server will stay soft-deleted.
    :vartype retention_days: int
    :ivar create_mode: Create mode for server, only valid values for this are Normal and Restore.
     Known values are: "Normal" and "Restore".
    :vartype create_mode: str or ~azure.mgmt.sql.models.ServerCreateMode
    """

    administrator_login: Optional[str] = rest_field(name="administratorLogin", visibility=["read", "create"])
    """Administrator username for the server. Once created it cannot be changed."""
    administrator_login_password: Optional[str] = rest_field(
        name="administratorLoginPassword", visibility=["create", "update"]
    )
    """The administrator login password (required for server creation)."""
    version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The version of the server."""
    state: Optional[str] = rest_field(visibility=["read"])
    """The state of the server."""
    fully_qualified_domain_name: Optional[str] = rest_field(name="fullyQualifiedDomainName", visibility=["read"])
    """The fully qualified domain name of the server."""
    private_endpoint_connections: Optional[list["_models.ServerPrivateEndpointConnection"]] = rest_field(
        name="privateEndpointConnections", visibility=["read"]
    )
    """List of private endpoint connections on a server."""
    minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = rest_field(
        name="minimalTlsVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Minimal TLS version. Allowed values: 'None', 1.0', '1.1', '1.2', '1.3'. Known values are:
     \"None\", \"1.0\", \"1.1\", \"1.2\", and \"1.3\"."""
    public_network_access: Optional[Union[str, "_models.ServerPublicNetworkAccessFlag"]] = rest_field(
        name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not public endpoint access is allowed for this server.  Value is optional but if
     passed in, must be 'Enabled' or 'Disabled' or 'SecuredByPerimeter'. Known values are:
     \"Enabled\", \"Disabled\", and \"SecuredByPerimeter\"."""
    workspace_feature: Optional[Union[str, "_models.ServerWorkspaceFeature"]] = rest_field(
        name="workspaceFeature", visibility=["read"]
    )
    """Whether or not existing server has a workspace created and if it allows connection from
     workspace. Known values are: \"Connected\" and \"Disconnected\"."""
    primary_user_assigned_identity_id: Optional[str] = rest_field(
        name="primaryUserAssignedIdentityId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource id of a user assigned identity to be used by default."""
    federated_client_id: Optional[str] = rest_field(
        name="federatedClientId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The Client id used for cross tenant CMK scenario."""
    key_id: Optional[str] = rest_field(name="keyId", visibility=["read", "create", "update", "delete", "query"])
    """A CMK URI of the key to use for encryption."""
    administrators: Optional["_models.ServerExternalAdministrator"] = rest_field(visibility=["read", "create"])
    """The Azure Active Directory administrator can be utilized during server creation and for server
     updates, except for the azureADOnlyAuthentication property. To update the
     azureADOnlyAuthentication property, individual API must be used."""
    restrict_outbound_network_access: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = rest_field(
        name="restrictOutboundNetworkAccess", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not to restrict outbound network access for this server.  Value is optional but if
     passed in, must be 'Enabled' or 'Disabled'. Known values are: \"Enabled\" and \"Disabled\"."""
    is_i_pv6_enabled: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = rest_field(
        name="isIPv6Enabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether or not to enable IPv6 support for this server.  Value is optional but if passed in,
     must be 'Enabled' or 'Disabled'. Known values are: \"Enabled\" and \"Disabled\"."""
    external_governance_status: Optional[Union[str, "_models.ExternalGovernanceStatus"]] = rest_field(
        name="externalGovernanceStatus", visibility=["read"]
    )
    """Status of external governance. Known values are: \"Enabled\" and \"Disabled\"."""
    retention_days: Optional[int] = rest_field(
        name="retentionDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """Number of days this server will stay soft-deleted."""
    create_mode: Optional[Union[str, "_models.ServerCreateMode"]] = rest_field(
        name="createMode", visibility=["read", "create"]
    )
    """Create mode for server, only valid values for this are Normal and Restore. Known values are:
     \"Normal\" and \"Restore\"."""

    @overload
    def __init__(
        self,
        *,
        administrator_login: Optional[str] = None,
        administrator_login_password: Optional[str] = None,
        version: Optional[str] = None,
        minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None,
        public_network_access: Optional[Union[str, "_models.ServerPublicNetworkAccessFlag"]] = None,
        primary_user_assigned_identity_id: Optional[str] = None,
        federated_client_id: Optional[str] = None,
        key_id: Optional[str] = None,
        administrators: Optional["_models.ServerExternalAdministrator"] = None,
        restrict_outbound_network_access: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = None,
        is_i_pv6_enabled: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = None,
        retention_days: Optional[int] = None,
        create_mode: Optional[Union[str, "_models.ServerCreateMode"]] = 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 ServerSecurityAlertPolicy(ProxyResource):
    """A server security alert policy.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SecurityAlertsPolicyProperties
    """

    properties: Optional["_models.SecurityAlertsPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "state",
        "disabled_alerts",
        "email_addresses",
        "email_account_admins",
        "storage_endpoint",
        "storage_account_access_key",
        "retention_days",
        "creation_time",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SecurityAlertsPolicyProperties"] = 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 ServerTrustCertificate(ProxyResource):
    """Server trust certificate imported from box to enable connection between box and Sql Managed
    Instance.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerTrustCertificateProperties
    """

    properties: Optional["_models.ServerTrustCertificateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["public_blob", "thumbprint", "certificate_name"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerTrustCertificateProperties"] = 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 ServerTrustCertificateProperties(_Model):
    """The properties of a server trust certificate.

    :ivar public_blob: The certificate public blob.
    :vartype public_blob: str
    :ivar thumbprint: The certificate thumbprint.
    :vartype thumbprint: str
    :ivar certificate_name: The certificate name.
    :vartype certificate_name: str
    """

    public_blob: Optional[str] = rest_field(
        name="publicBlob", visibility=["read", "create", "update", "delete", "query"]
    )
    """The certificate public blob."""
    thumbprint: Optional[str] = rest_field(visibility=["read"])
    """The certificate thumbprint."""
    certificate_name: Optional[str] = rest_field(name="certificateName", visibility=["read"])
    """The certificate name."""

    @overload
    def __init__(
        self,
        *,
        public_blob: 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 ServerTrustGroup(ProxyResource):
    """A server trust group.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerTrustGroupProperties
    """

    properties: Optional["_models.ServerTrustGroupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["group_members", "trust_scopes"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerTrustGroupProperties"] = 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 ServerTrustGroupProperties(_Model):
    """Properties of a server trust group.

    :ivar group_members: Group members information for the server trust group. Required.
    :vartype group_members: list[~azure.mgmt.sql.models.ServerInfo]
    :ivar trust_scopes: Trust scope of the server trust group. Required.
    :vartype trust_scopes: list[str or
     ~azure.mgmt.sql.models.ServerTrustGroupPropertiesTrustScopesItem]
    """

    group_members: list["_models.ServerInfo"] = rest_field(
        name="groupMembers", visibility=["read", "create", "update", "delete", "query"]
    )
    """Group members information for the server trust group. Required."""
    trust_scopes: list[Union[str, "_models.ServerTrustGroupPropertiesTrustScopesItem"]] = rest_field(
        name="trustScopes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Trust scope of the server trust group. Required."""

    @overload
    def __init__(
        self,
        *,
        group_members: list["_models.ServerInfo"],
        trust_scopes: list[Union[str, "_models.ServerTrustGroupPropertiesTrustScopesItem"]],
    ) -> 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 ServerUpdate(_Model):
    """An update request for an Azure SQL Database server.

    :ivar identity: Server identity.
    :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    identity: Optional["_models.ResourceIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Server identity."""
    properties: Optional["_models.ServerProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = [
        "administrator_login",
        "administrator_login_password",
        "version",
        "state",
        "fully_qualified_domain_name",
        "private_endpoint_connections",
        "minimal_tls_version",
        "public_network_access",
        "workspace_feature",
        "primary_user_assigned_identity_id",
        "federated_client_id",
        "key_id",
        "administrators",
        "restrict_outbound_network_access",
        "is_i_pv6_enabled",
        "external_governance_status",
        "retention_days",
        "create_mode",
    ]

    @overload
    def __init__(
        self,
        *,
        identity: Optional["_models.ResourceIdentity"] = None,
        properties: Optional["_models.ServerProperties"] = 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 ServerUsage(ProxyResource):
    """Usage metric of a server.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerUsageProperties
    """

    properties: Optional["_models.ServerUsageProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["display_name", "current_value", "limit", "unit"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerUsageProperties"] = 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 ServerUsageProperties(_Model):
    """Properties of a server usage.

    :ivar display_name: User-readable name of the metric.
    :vartype display_name: str
    :ivar current_value: Current value of the metric.
    :vartype current_value: float
    :ivar limit: Boundary value of the metric.
    :vartype limit: float
    :ivar unit: Unit of the metric.
    :vartype unit: str
    """

    display_name: Optional[str] = rest_field(name="displayName", visibility=["read"])
    """User-readable name of the metric."""
    current_value: Optional[float] = rest_field(name="currentValue", visibility=["read"])
    """Current value of the metric."""
    limit: Optional[float] = rest_field(visibility=["read"])
    """Boundary value of the metric."""
    unit: Optional[str] = rest_field(visibility=["read"])
    """Unit of the metric."""


class ServerVersionCapability(_Model):
    """The server capability.

    :ivar name: The server version name.
    :vartype name: str
    :ivar supported_editions: The list of supported database editions.
    :vartype supported_editions: list[~azure.mgmt.sql.models.EditionCapability]
    :ivar supported_elastic_pool_editions: The list of supported elastic pool editions.
    :vartype supported_elastic_pool_editions:
     list[~azure.mgmt.sql.models.ElasticPoolEditionCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The server version name."""
    supported_editions: Optional[list["_models.EditionCapability"]] = rest_field(
        name="supportedEditions", visibility=["read"]
    )
    """The list of supported database editions."""
    supported_elastic_pool_editions: Optional[list["_models.ElasticPoolEditionCapability"]] = rest_field(
        name="supportedElasticPoolEditions", visibility=["read"]
    )
    """The list of supported elastic pool editions."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ServerVulnerabilityAssessment(ProxyResource):
    """A server vulnerability assessment.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.ServerVulnerabilityAssessmentProperties
    """

    properties: Optional["_models.ServerVulnerabilityAssessmentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "storage_container_path",
        "storage_container_sas_key",
        "storage_account_access_key",
        "recurring_scans",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.ServerVulnerabilityAssessmentProperties"] = 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 ServerVulnerabilityAssessmentProperties(_Model):
    """Properties of a server Vulnerability Assessment.

    :ivar storage_container_path: A blob storage container path to hold the scan results (e.g.
     `https://myStorage.blob.core.windows.net/VaScans/
     <https://myStorage.blob.core.windows.net/VaScans/>`_). Required.
    :vartype storage_container_path: str
    :ivar storage_container_sas_key: A shared access signature (SAS Key) that has write access to
     the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey'
     isn't specified, StorageContainerSasKey is required. Applies only if the storage account is not
     behind a Vnet or a firewall.
    :vartype storage_container_sas_key: str
    :ivar storage_account_access_key: Specifies the identifier key of the storage account for
     vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
     storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet
     or a firewall.
    :vartype storage_account_access_key: str
    :ivar recurring_scans: The recurring scans settings.
    :vartype recurring_scans:
     ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
    """

    storage_container_path: str = rest_field(name="storageContainerPath", visibility=["create", "update"])
    """A blob storage container path to hold the scan results (e.g.
     `https://myStorage.blob.core.windows.net/VaScans/
     <https://myStorage.blob.core.windows.net/VaScans/>`_). Required."""
    storage_container_sas_key: Optional[str] = rest_field(
        name="storageContainerSasKey", visibility=["create", "update"]
    )
    """A shared access signature (SAS Key) that has write access to the blob container specified in
     'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified,
     StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or
     a firewall."""
    storage_account_access_key: Optional[str] = rest_field(
        name="storageAccountAccessKey", visibility=["create", "update"]
    )
    """Specifies the identifier key of the storage account for vulnerability assessment scan results.
     If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. Applies only
     if the storage account is not behind a Vnet or a firewall."""
    recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = rest_field(
        name="recurringScans", visibility=["read", "create", "update", "delete", "query"]
    )
    """The recurring scans settings."""

    @overload
    def __init__(
        self,
        *,
        storage_container_path: str,
        storage_container_sas_key: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = 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 ServiceObjectiveCapability(_Model):
    """The service objectives capability.

    :ivar id: The unique ID of the service objective.
    :vartype id: str
    :ivar name: The service objective name.
    :vartype name: str
    :ivar supported_max_sizes: The list of supported maximum database sizes.
    :vartype supported_max_sizes: list[~azure.mgmt.sql.models.MaxSizeRangeCapability]
    :ivar performance_level: The performance level.
    :vartype performance_level: ~azure.mgmt.sql.models.PerformanceLevelCapability
    :ivar sku: The sku.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar supported_license_types: List of supported license types.
    :vartype supported_license_types: list[~azure.mgmt.sql.models.LicenseTypeCapability]
    :ivar included_max_size: The included (free) max size.
    :vartype included_max_size: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar zone_redundant: Whether or not zone redundancy is supported for the service objective.
    :vartype zone_redundant: bool
    :ivar supported_auto_pause_delay: Supported time range for auto pause delay.
    :vartype supported_auto_pause_delay: ~azure.mgmt.sql.models.AutoPauseDelayTimeRange
    :ivar supported_min_capacities: List of supported min capacities.
    :vartype supported_min_capacities: list[~azure.mgmt.sql.models.MinCapacityCapability]
    :ivar compute_model: The compute model.
    :vartype compute_model: str
    :ivar supported_maintenance_configurations: List of supported maintenance configurations.
    :vartype supported_maintenance_configurations:
     list[~azure.mgmt.sql.models.MaintenanceConfigurationCapability]
    :ivar zone_pinning: Whether or not zone pinning is supported.
    :vartype zone_pinning: bool
    :ivar supported_zones: List of supported availability zones.
    :vartype supported_zones: list[~azure.mgmt.sql.models.ZonePinningCapability]
    :ivar supported_free_limit_exhaustion_behaviors: List of supported free limit exhaustion
     behaviors.
    :vartype supported_free_limit_exhaustion_behaviors:
     list[~azure.mgmt.sql.models.FreeLimitExhaustionBehaviorCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """The unique ID of the service objective."""
    name: Optional[str] = rest_field(visibility=["read"])
    """The service objective name."""
    supported_max_sizes: Optional[list["_models.MaxSizeRangeCapability"]] = rest_field(
        name="supportedMaxSizes", visibility=["read"]
    )
    """The list of supported maximum database sizes."""
    performance_level: Optional["_models.PerformanceLevelCapability"] = rest_field(
        name="performanceLevel", visibility=["read"]
    )
    """The performance level."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read"])
    """The sku."""
    supported_license_types: Optional[list["_models.LicenseTypeCapability"]] = rest_field(
        name="supportedLicenseTypes", visibility=["read"]
    )
    """List of supported license types."""
    included_max_size: Optional["_models.MaxSizeCapability"] = rest_field(name="includedMaxSize", visibility=["read"])
    """The included (free) max size."""
    zone_redundant: Optional[bool] = rest_field(name="zoneRedundant", visibility=["read"])
    """Whether or not zone redundancy is supported for the service objective."""
    supported_auto_pause_delay: Optional["_models.AutoPauseDelayTimeRange"] = rest_field(
        name="supportedAutoPauseDelay", visibility=["read"]
    )
    """Supported time range for auto pause delay."""
    supported_min_capacities: Optional[list["_models.MinCapacityCapability"]] = rest_field(
        name="supportedMinCapacities", visibility=["read"]
    )
    """List of supported min capacities."""
    compute_model: Optional[str] = rest_field(name="computeModel", visibility=["read"])
    """The compute model."""
    supported_maintenance_configurations: Optional[list["_models.MaintenanceConfigurationCapability"]] = rest_field(
        name="supportedMaintenanceConfigurations", visibility=["read"]
    )
    """List of supported maintenance configurations."""
    zone_pinning: Optional[bool] = rest_field(name="zonePinning", visibility=["read"])
    """Whether or not zone pinning is supported."""
    supported_zones: Optional[list["_models.ZonePinningCapability"]] = rest_field(
        name="supportedZones", visibility=["read"]
    )
    """List of supported availability zones."""
    supported_free_limit_exhaustion_behaviors: Optional[list["_models.FreeLimitExhaustionBehaviorCapability"]] = (
        rest_field(name="supportedFreeLimitExhaustionBehaviors", visibility=["read"])
    )
    """List of supported free limit exhaustion behaviors."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 ServicePrincipal(_Model):
    """The managed instance's service principal configuration for a resource.

    :ivar principal_id: The Azure Active Directory application object id.
    :vartype principal_id: str
    :ivar client_id: The Azure Active Directory application client id.
    :vartype client_id: str
    :ivar tenant_id: The Azure Active Directory tenant id.
    :vartype tenant_id: str
    :ivar type: Service principal type. Known values are: "None" and "SystemAssigned".
    :vartype type: str or ~azure.mgmt.sql.models.ServicePrincipalType
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The Azure Active Directory application object id."""
    client_id: Optional[str] = rest_field(name="clientId", visibility=["read"])
    """The Azure Active Directory application client id."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"])
    """The Azure Active Directory tenant id."""
    type: Optional[Union[str, "_models.ServicePrincipalType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Service principal type. Known values are: \"None\" and \"SystemAssigned\"."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.ServicePrincipalType"]] = 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 Sku(_Model):
    """An ARM Resource SKU.

    :ivar name: The name of the SKU, typically, a letter + Number code, e.g. P3. Required.
    :vartype name: str
    :ivar tier: The tier or edition of the particular SKU, e.g. Basic, Premium.
    :vartype tier: str
    :ivar size: Size of the particular SKU.
    :vartype size: str
    :ivar family: If the service has different generations of hardware, for the same SKU, then that
     can be captured here.
    :vartype family: str
    :ivar capacity: Capacity of the particular SKU.
    :vartype capacity: int
    """

    name: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name of the SKU, typically, a letter + Number code, e.g. P3. Required."""
    tier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The tier or edition of the particular SKU, e.g. Basic, Premium."""
    size: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Size of the particular SKU."""
    family: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """If the service has different generations of hardware, for the same SKU, then that can be
     captured here."""
    capacity: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Capacity of the particular SKU."""

    @overload
    def __init__(
        self,
        *,
        name: str,
        tier: Optional[str] = None,
        size: Optional[str] = None,
        family: Optional[str] = None,
        capacity: 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 SqlAgentConfiguration(ProxyResource):
    """A recoverable managed database 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SqlAgentConfigurationProperties
    """

    properties: Optional["_models.SqlAgentConfigurationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SqlAgentConfigurationProperties"] = 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 SqlAgentConfigurationProperties(_Model):
    """Sql agent configuration properties.

    :ivar state: The state of Sql Agent. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SqlAgentConfigurationPropertiesState
    """

    state: Optional[Union[str, "_models.SqlAgentConfigurationPropertiesState"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The state of Sql Agent. Known values are: \"Enabled\" and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.SqlAgentConfigurationPropertiesState"]] = 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 SqlVulnerabilityAssessment(ProxyResource):
    """A SQL Vulnerability Assessment.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SqlVulnerabilityAssessmentPolicyProperties
    """

    properties: Optional["_models.SqlVulnerabilityAssessmentPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SqlVulnerabilityAssessmentPolicyProperties"] = 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 SqlVulnerabilityAssessmentPolicyProperties(_Model):  # pylint: disable=name-too-long
    """SqlVulnerabilityAssessmentPolicyProperties.

    :ivar state: Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or
     disabled or a state has not been applied yet on the specific database or server. Known values
     are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SqlVulnerabilityAssessmentState
    """

    state: Optional[Union[str, "_models.SqlVulnerabilityAssessmentState"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or disabled or a
     state has not been applied yet on the specific database or server. Known values are:
     \"Enabled\" and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.SqlVulnerabilityAssessmentState"]] = 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 SqlVulnerabilityAssessmentScanError(_Model):
    """Properties of a vulnerability assessment scan error.

    :ivar code: The error code.
    :vartype code: str
    :ivar message: The error message.
    :vartype message: str
    """

    code: Optional[str] = rest_field(visibility=["read"])
    """The error code."""
    message: Optional[str] = rest_field(visibility=["read"])
    """The error message."""


class SqlVulnerabilityAssessmentScanRecord(ProxyResource):
    """A vulnerability assessment scan record.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SqlVulnerabilityAssessmentScanRecordProperties
    """

    properties: Optional["_models.SqlVulnerabilityAssessmentScanRecordProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "scan_id",
        "trigger_type",
        "state",
        "start_time",
        "end_time",
        "errors",
        "server",
        "database",
        "sql_version",
        "high_severity_failed_rules_count",
        "medium_severity_failed_rules_count",
        "low_severity_failed_rules_count",
        "total_passed_rules_count",
        "total_failed_rules_count",
        "total_rules_count",
        "is_baseline_applied",
        "last_scan_time",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SqlVulnerabilityAssessmentScanRecordProperties"] = 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 SqlVulnerabilityAssessmentScanRecordProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a vulnerability assessment scan record.

    :ivar scan_id: The scan ID.
    :vartype scan_id: str
    :ivar trigger_type: The scan trigger type. Known values are: "OnDemand" and "Recurring".
    :vartype trigger_type: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentScanTriggerType
    :ivar state: The scan status. Known values are: "Passed", "Failed", "FailedToRun", and
     "InProgress".
    :vartype state: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentScanState
    :ivar start_time: The scan start time (UTC).
    :vartype start_time: ~datetime.datetime
    :ivar end_time: The scan end time (UTC).
    :vartype end_time: ~datetime.datetime
    :ivar errors: The scan errors.
    :vartype errors: list[~azure.mgmt.sql.models.SqlVulnerabilityAssessmentScanError]
    :ivar server: The server name.
    :vartype server: str
    :ivar database: The database name.
    :vartype database: str
    :ivar sql_version: The SQL version.
    :vartype sql_version: str
    :ivar high_severity_failed_rules_count: The number of failed rules with high severity.
    :vartype high_severity_failed_rules_count: int
    :ivar medium_severity_failed_rules_count: The number of failed rules with medium severity.
    :vartype medium_severity_failed_rules_count: int
    :ivar low_severity_failed_rules_count: The number of failed rules with low severity.
    :vartype low_severity_failed_rules_count: int
    :ivar total_passed_rules_count: The number of total passed rules.
    :vartype total_passed_rules_count: int
    :ivar total_failed_rules_count: The number of total failed rules.
    :vartype total_failed_rules_count: int
    :ivar total_rules_count: The number of total rules assessed.
    :vartype total_rules_count: int
    :ivar is_baseline_applied: Baseline created for this database, and has one or more rules.
    :vartype is_baseline_applied: bool
    :ivar last_scan_time: The last scan time.
    :vartype last_scan_time: ~datetime.datetime
    """

    scan_id: Optional[str] = rest_field(name="scanId", visibility=["read"])
    """The scan ID."""
    trigger_type: Optional[Union[str, "_models.VulnerabilityAssessmentScanTriggerType"]] = rest_field(
        name="triggerType", visibility=["read"]
    )
    """The scan trigger type. Known values are: \"OnDemand\" and \"Recurring\"."""
    state: Optional[Union[str, "_models.VulnerabilityAssessmentScanState"]] = rest_field(visibility=["read"])
    """The scan status. Known values are: \"Passed\", \"Failed\", \"FailedToRun\", and \"InProgress\"."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The scan start time (UTC)."""
    end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339")
    """The scan end time (UTC)."""
    errors: Optional[list["_models.SqlVulnerabilityAssessmentScanError"]] = rest_field(visibility=["read"])
    """The scan errors."""
    server: Optional[str] = rest_field(visibility=["read"])
    """The server name."""
    database: Optional[str] = rest_field(visibility=["read"])
    """The database name."""
    sql_version: Optional[str] = rest_field(name="sqlVersion", visibility=["read"])
    """The SQL version."""
    high_severity_failed_rules_count: Optional[int] = rest_field(
        name="highSeverityFailedRulesCount", visibility=["read"]
    )
    """The number of failed rules with high severity."""
    medium_severity_failed_rules_count: Optional[int] = rest_field(
        name="mediumSeverityFailedRulesCount", visibility=["read"]
    )
    """The number of failed rules with medium severity."""
    low_severity_failed_rules_count: Optional[int] = rest_field(name="lowSeverityFailedRulesCount", visibility=["read"])
    """The number of failed rules with low severity."""
    total_passed_rules_count: Optional[int] = rest_field(name="totalPassedRulesCount", visibility=["read"])
    """The number of total passed rules."""
    total_failed_rules_count: Optional[int] = rest_field(name="totalFailedRulesCount", visibility=["read"])
    """The number of total failed rules."""
    total_rules_count: Optional[int] = rest_field(name="totalRulesCount", visibility=["read"])
    """The number of total rules assessed."""
    is_baseline_applied: Optional[bool] = rest_field(name="isBaselineApplied", visibility=["read"])
    """Baseline created for this database, and has one or more rules."""
    last_scan_time: Optional[datetime.datetime] = rest_field(name="lastScanTime", visibility=["read"], format="rfc3339")
    """The last scan time."""


class SqlVulnerabilityAssessmentScanResultProperties(_Model):  # pylint: disable=name-too-long
    """SQL Vulnerability Assessment scan result properties for a single rule.

    :ivar rule_id: SQL Vulnerability Assessment rule Id.
    :vartype rule_id: str
    :ivar status: SQL Vulnerability Assessment rule result status. Known values are: "NonFinding",
     "Finding", and "InternalError".
    :vartype status: str or ~azure.mgmt.sql.models.RuleStatus
    :ivar error_message: SQL Vulnerability Assessment error message.
    :vartype error_message: str
    :ivar is_trimmed: SQL Vulnerability Assessment is the query results trimmed.
    :vartype is_trimmed: bool
    :ivar query_results: SQL Vulnerability Assessment query results that was run.
    :vartype query_results: list[list[str]]
    :ivar remediation: SQL Vulnerability Assessment the remediation details.
    :vartype remediation: ~azure.mgmt.sql.models.Remediation
    :ivar baseline_adjusted_result: SQL Vulnerability Assessment rule result adjusted with
     baseline.
    :vartype baseline_adjusted_result: ~azure.mgmt.sql.models.BaselineAdjustedResult
    :ivar rule_metadata: SQL Vulnerability Assessment rule metadata.
    :vartype rule_metadata: ~azure.mgmt.sql.models.VaRule
    """

    rule_id: Optional[str] = rest_field(name="ruleId", visibility=["read"])
    """SQL Vulnerability Assessment rule Id."""
    status: Optional[Union[str, "_models.RuleStatus"]] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment rule result status. Known values are: \"NonFinding\", \"Finding\",
     and \"InternalError\"."""
    error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"])
    """SQL Vulnerability Assessment error message."""
    is_trimmed: Optional[bool] = rest_field(name="isTrimmed", visibility=["read"])
    """SQL Vulnerability Assessment is the query results trimmed."""
    query_results: Optional[list[list[str]]] = rest_field(name="queryResults", visibility=["read"])
    """SQL Vulnerability Assessment query results that was run."""
    remediation: Optional["_models.Remediation"] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment the remediation details."""
    baseline_adjusted_result: Optional["_models.BaselineAdjustedResult"] = rest_field(
        name="baselineAdjustedResult", visibility=["read"]
    )
    """SQL Vulnerability Assessment rule result adjusted with baseline."""
    rule_metadata: Optional["_models.VaRule"] = rest_field(name="ruleMetadata", visibility=["read"])
    """SQL Vulnerability Assessment rule metadata."""


class SqlVulnerabilityAssessmentScanResults(ProxyResource):
    """Concrete proxy resource types can be created by aliasing this type using a specific property
    type.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SqlVulnerabilityAssessmentScanResultProperties
    """

    properties: Optional["_models.SqlVulnerabilityAssessmentScanResultProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "rule_id",
        "status",
        "error_message",
        "is_trimmed",
        "query_results",
        "remediation",
        "baseline_adjusted_result",
        "rule_metadata",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SqlVulnerabilityAssessmentScanResultProperties"] = 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 StartStopManagedInstanceSchedule(ProxyResource):
    """Managed instance's Start/Stop schedule.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.StartStopManagedInstanceScheduleProperties
    """

    properties: Optional["_models.StartStopManagedInstanceScheduleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["description", "time_zone_id", "schedule_list", "next_run_action", "next_execution_time"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.StartStopManagedInstanceScheduleProperties"] = 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 StartStopManagedInstanceScheduleProperties(_Model):  # pylint: disable=name-too-long
    """Properties of managed instance's Start/Stop schedule.

    :ivar description: The description of the schedule.
    :vartype description: str
    :ivar time_zone_id: The time zone of the schedule.
    :vartype time_zone_id: str
    :ivar schedule_list: Schedule list. Required.
    :vartype schedule_list: list[~azure.mgmt.sql.models.ScheduleItem]
    :ivar next_run_action: Next action to be executed (Start or Stop).
    :vartype next_run_action: str
    :ivar next_execution_time: Timestamp when the next action will be executed in the corresponding
     schedule time zone.
    :vartype next_execution_time: str
    """

    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The description of the schedule."""
    time_zone_id: Optional[str] = rest_field(
        name="timeZoneId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The time zone of the schedule."""
    schedule_list: list["_models.ScheduleItem"] = rest_field(
        name="scheduleList", visibility=["read", "create", "update", "delete", "query"]
    )
    """Schedule list. Required."""
    next_run_action: Optional[str] = rest_field(name="nextRunAction", visibility=["read"])
    """Next action to be executed (Start or Stop)."""
    next_execution_time: Optional[str] = rest_field(name="nextExecutionTime", visibility=["read"])
    """Timestamp when the next action will be executed in the corresponding schedule time zone."""

    @overload
    def __init__(
        self,
        *,
        schedule_list: list["_models.ScheduleItem"],
        description: Optional[str] = None,
        time_zone_id: 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 StorageCapability(_Model):
    """The storage account type capability.

    :ivar storage_account_type: The storage account type for the database's backups. Known values
     are: "GRS", "LRS", "ZRS", and "GZRS".
    :vartype storage_account_type: str or
     ~azure.mgmt.sql.models.StorageCapabilityStorageAccountType
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    storage_account_type: Optional[Union[str, "_models.StorageCapabilityStorageAccountType"]] = rest_field(
        name="storageAccountType", visibility=["read"]
    )
    """The storage account type for the database's backups. Known values are: \"GRS\", \"LRS\",
     \"ZRS\", and \"GZRS\"."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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 SubscriptionUsage(ProxyResource):
    """Usage Metric of a Subscription in a Location.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SubscriptionUsageProperties
    """

    properties: Optional["_models.SubscriptionUsageProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["display_name", "current_value", "limit", "unit"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SubscriptionUsageProperties"] = 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 SubscriptionUsageProperties(_Model):
    """Properties of a subscription usage.

    :ivar display_name: User-readable name of the metric.
    :vartype display_name: str
    :ivar current_value: Current value of the metric.
    :vartype current_value: float
    :ivar limit: Boundary value of the metric.
    :vartype limit: float
    :ivar unit: Unit of the metric.
    :vartype unit: str
    """

    display_name: Optional[str] = rest_field(name="displayName", visibility=["read"])
    """User-readable name of the metric."""
    current_value: Optional[float] = rest_field(name="currentValue", visibility=["read"])
    """Current value of the metric."""
    limit: Optional[float] = rest_field(visibility=["read"])
    """Boundary value of the metric."""
    unit: Optional[str] = rest_field(visibility=["read"])
    """Unit of the metric."""


class SynapseLinkWorkspace(ProxyResource):
    """Synapse link workspace 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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SynapseLinkWorkspaceProperties
    """

    properties: Optional["_models.SynapseLinkWorkspaceProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["workspaces"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SynapseLinkWorkspaceProperties"] = 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 SynapseLinkWorkspaceInfoProperties(_Model):
    """Properties of a Synapse link workspaces.

    :ivar workspace_id: Synapse link workspace id.
    :vartype workspace_id: str
    :ivar link_connection_name: Link connection name.
    :vartype link_connection_name: str
    """

    workspace_id: Optional[str] = rest_field(
        name="workspaceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Synapse link workspace id."""
    link_connection_name: Optional[str] = rest_field(
        name="linkConnectionName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Link connection name."""

    @overload
    def __init__(
        self,
        *,
        workspace_id: Optional[str] = None,
        link_connection_name: 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 SynapseLinkWorkspaceProperties(_Model):
    """Properties of a Synapse link workspaces.

    :ivar workspaces: List of all synapselink workspaces.
    :vartype workspaces: list[~azure.mgmt.sql.models.SynapseLinkWorkspaceInfoProperties]
    """

    workspaces: Optional[list["_models.SynapseLinkWorkspaceInfoProperties"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of all synapselink workspaces."""

    @overload
    def __init__(
        self,
        *,
        workspaces: Optional[list["_models.SynapseLinkWorkspaceInfoProperties"]] = 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 SyncAgent(ProxyResource):
    """An Azure SQL Database sync agent.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SyncAgentProperties
    """

    properties: Optional["_models.SyncAgentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "name",
        "sync_database_id",
        "last_alive_time",
        "state",
        "is_up_to_date",
        "expiry_time",
        "version",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SyncAgentProperties"] = 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 SyncAgentKeyProperties(_Model):
    """Properties of an Azure SQL Database sync agent key.

    :ivar sync_agent_key: Key of sync agent.
    :vartype sync_agent_key: str
    """

    sync_agent_key: Optional[str] = rest_field(name="syncAgentKey", visibility=["read"])
    """Key of sync agent."""


class SyncAgentLinkedDatabase(ProxyResource):
    """An Azure SQL Database sync agent linked database.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SyncAgentLinkedDatabaseProperties
    """

    properties: Optional["_models.SyncAgentLinkedDatabaseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["database_type", "database_id", "description", "server_name", "database_name", "user_name"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SyncAgentLinkedDatabaseProperties"] = 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 SyncAgentLinkedDatabaseProperties(_Model):
    """Properties of an Azure SQL Database sync agent linked database.

    :ivar database_type: Type of the sync agent linked database. Known values are:
     "AzureSqlDatabase" and "SqlServerDatabase".
    :vartype database_type: str or ~azure.mgmt.sql.models.SyncMemberDbType
    :ivar database_id: Id of the sync agent linked database.
    :vartype database_id: str
    :ivar description: Description of the sync agent linked database.
    :vartype description: str
    :ivar server_name: Server name of the sync agent linked database.
    :vartype server_name: str
    :ivar database_name: Database name of the sync agent linked database.
    :vartype database_name: str
    :ivar user_name: User name of the sync agent linked database.
    :vartype user_name: str
    """

    database_type: Optional[Union[str, "_models.SyncMemberDbType"]] = rest_field(
        name="databaseType", visibility=["read"]
    )
    """Type of the sync agent linked database. Known values are: \"AzureSqlDatabase\" and
     \"SqlServerDatabase\"."""
    database_id: Optional[str] = rest_field(name="databaseId", visibility=["read"])
    """Id of the sync agent linked database."""
    description: Optional[str] = rest_field(visibility=["read"])
    """Description of the sync agent linked database."""
    server_name: Optional[str] = rest_field(name="serverName", visibility=["read"])
    """Server name of the sync agent linked database."""
    database_name: Optional[str] = rest_field(name="databaseName", visibility=["read"])
    """Database name of the sync agent linked database."""
    user_name: Optional[str] = rest_field(name="userName", visibility=["read"])
    """User name of the sync agent linked database."""


class SyncAgentProperties(_Model):
    """Properties of an Azure SQL Database sync agent.

    :ivar name: Name of the sync agent.
    :vartype name: str
    :ivar sync_database_id: ARM resource id of the sync database in the sync agent.
    :vartype sync_database_id: str
    :ivar last_alive_time: Last alive time of the sync agent.
    :vartype last_alive_time: ~datetime.datetime
    :ivar state: State of the sync agent. Known values are: "Online", "Offline", and
     "NeverConnected".
    :vartype state: str or ~azure.mgmt.sql.models.SyncAgentState
    :ivar is_up_to_date: If the sync agent version is up to date.
    :vartype is_up_to_date: bool
    :ivar expiry_time: Expiration time of the sync agent version.
    :vartype expiry_time: ~datetime.datetime
    :ivar version: Version of the sync agent.
    :vartype version: str
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """Name of the sync agent."""
    sync_database_id: Optional[str] = rest_field(
        name="syncDatabaseId", visibility=["read", "create", "update", "delete", "query"]
    )
    """ARM resource id of the sync database in the sync agent."""
    last_alive_time: Optional[datetime.datetime] = rest_field(
        name="lastAliveTime", visibility=["read"], format="rfc3339"
    )
    """Last alive time of the sync agent."""
    state: Optional[Union[str, "_models.SyncAgentState"]] = rest_field(visibility=["read"])
    """State of the sync agent. Known values are: \"Online\", \"Offline\", and \"NeverConnected\"."""
    is_up_to_date: Optional[bool] = rest_field(name="isUpToDate", visibility=["read"])
    """If the sync agent version is up to date."""
    expiry_time: Optional[datetime.datetime] = rest_field(name="expiryTime", visibility=["read"], format="rfc3339")
    """Expiration time of the sync agent version."""
    version: Optional[str] = rest_field(visibility=["read"])
    """Version of the sync agent."""

    @overload
    def __init__(
        self,
        *,
        sync_database_id: 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 SyncDatabaseIdProperties(_Model):
    """Properties of the sync database id.

    :ivar id: ARM resource id of sync database.
    :vartype id: str
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """ARM resource id of sync database."""


class SyncFullSchemaProperties(_Model):
    """Properties of the database full schema.

    :ivar tables: List of tables in the database full schema.
    :vartype tables: list[~azure.mgmt.sql.models.SyncFullSchemaTable]
    :ivar last_update_time: Last update time of the database schema.
    :vartype last_update_time: ~datetime.datetime
    """

    tables: Optional[list["_models.SyncFullSchemaTable"]] = rest_field(visibility=["read"])
    """List of tables in the database full schema."""
    last_update_time: Optional[datetime.datetime] = rest_field(
        name="lastUpdateTime", visibility=["read"], format="rfc3339"
    )
    """Last update time of the database schema."""


class SyncFullSchemaTable(_Model):
    """Properties of the table in the database full schema.

    :ivar columns: List of columns in the table of database full schema.
    :vartype columns: list[~azure.mgmt.sql.models.SyncFullSchemaTableColumn]
    :ivar error_id: Error id of the table.
    :vartype error_id: str
    :ivar has_error: If there is error in the table.
    :vartype has_error: bool
    :ivar name: Name of the table.
    :vartype name: str
    :ivar quoted_name: Quoted name of the table.
    :vartype quoted_name: str
    """

    columns: Optional[list["_models.SyncFullSchemaTableColumn"]] = rest_field(visibility=["read"])
    """List of columns in the table of database full schema."""
    error_id: Optional[str] = rest_field(name="errorId", visibility=["read"])
    """Error id of the table."""
    has_error: Optional[bool] = rest_field(name="hasError", visibility=["read"])
    """If there is error in the table."""
    name: Optional[str] = rest_field(visibility=["read"])
    """Name of the table."""
    quoted_name: Optional[str] = rest_field(name="quotedName", visibility=["read"])
    """Quoted name of the table."""


class SyncFullSchemaTableColumn(_Model):
    """Properties of the column in the table of database full schema.

    :ivar data_size: Data size of the column.
    :vartype data_size: str
    :ivar data_type: Data type of the column.
    :vartype data_type: str
    :ivar error_id: Error id of the column.
    :vartype error_id: str
    :ivar has_error: If there is error in the table.
    :vartype has_error: bool
    :ivar is_primary_key: If it is the primary key of the table.
    :vartype is_primary_key: bool
    :ivar name: Name of the column.
    :vartype name: str
    :ivar quoted_name: Quoted name of the column.
    :vartype quoted_name: str
    """

    data_size: Optional[str] = rest_field(name="dataSize", visibility=["read"])
    """Data size of the column."""
    data_type: Optional[str] = rest_field(name="dataType", visibility=["read"])
    """Data type of the column."""
    error_id: Optional[str] = rest_field(name="errorId", visibility=["read"])
    """Error id of the column."""
    has_error: Optional[bool] = rest_field(name="hasError", visibility=["read"])
    """If there is error in the table."""
    is_primary_key: Optional[bool] = rest_field(name="isPrimaryKey", visibility=["read"])
    """If it is the primary key of the table."""
    name: Optional[str] = rest_field(visibility=["read"])
    """Name of the column."""
    quoted_name: Optional[str] = rest_field(name="quotedName", visibility=["read"])
    """Quoted name of the column."""


class SyncGroup(ProxyResource):
    """An Azure SQL Database sync group.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SyncGroupProperties
    :ivar sku: The name and capacity of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    """

    properties: Optional["_models.SyncGroupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name and capacity of the SKU."""

    __flattened_items = [
        "interval",
        "last_sync_time",
        "conflict_resolution_policy",
        "sync_database_id",
        "hub_database_user_name",
        "hub_database_password",
        "sync_state",
        "schema",
        "enable_conflict_logging",
        "conflict_logging_retention_in_days",
        "use_private_link_connection",
        "private_endpoint_name",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SyncGroupProperties"] = None,
        sku: Optional["_models.Sku"] = 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 SyncGroupLogProperties(_Model):
    """Properties of an Azure SQL Database sync group log.

    :ivar timestamp: Timestamp of the sync group log.
    :vartype timestamp: ~datetime.datetime
    :ivar type: Type of the sync group log. Known values are: "All", "Error", "Warning", and
     "Success".
    :vartype type: str or ~azure.mgmt.sql.models.SyncGroupLogType
    :ivar source: Source of the sync group log.
    :vartype source: str
    :ivar details: Details of the sync group log.
    :vartype details: str
    :ivar tracing_id: TracingId of the sync group log.
    :vartype tracing_id: str
    :ivar operation_status: OperationStatus of the sync group log.
    :vartype operation_status: str
    """

    timestamp: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339")
    """Timestamp of the sync group log."""
    type: Optional[Union[str, "_models.SyncGroupLogType"]] = rest_field(visibility=["read"])
    """Type of the sync group log. Known values are: \"All\", \"Error\", \"Warning\", and \"Success\"."""
    source: Optional[str] = rest_field(visibility=["read"])
    """Source of the sync group log."""
    details: Optional[str] = rest_field(visibility=["read"])
    """Details of the sync group log."""
    tracing_id: Optional[str] = rest_field(name="tracingId", visibility=["read"])
    """TracingId of the sync group log."""
    operation_status: Optional[str] = rest_field(name="operationStatus", visibility=["read"])
    """OperationStatus of the sync group log."""


class SyncGroupProperties(_Model):
    """Properties of a sync group with support to MI.

    :ivar interval: Sync interval of the sync group.
    :vartype interval: int
    :ivar last_sync_time: Last sync time of the sync group.
    :vartype last_sync_time: ~datetime.datetime
    :ivar conflict_resolution_policy: Conflict resolution policy of the sync group. Known values
     are: "HubWin" and "MemberWin".
    :vartype conflict_resolution_policy: str or ~azure.mgmt.sql.models.SyncConflictResolutionPolicy
    :ivar sync_database_id: ARM resource id of the sync database in the sync group.
    :vartype sync_database_id: str
    :ivar hub_database_user_name: User name for the sync group hub database credential.
    :vartype hub_database_user_name: str
    :ivar hub_database_password: Password for the sync group hub database credential.
    :vartype hub_database_password: str
    :ivar sync_state: Sync state of the sync group. Known values are: "NotReady", "Error",
     "Warning", "Progressing", and "Good".
    :vartype sync_state: str or ~azure.mgmt.sql.models.SyncGroupState
    :ivar schema: Sync schema of the sync group.
    :vartype schema: ~azure.mgmt.sql.models.SyncGroupSchema
    :ivar enable_conflict_logging: If conflict logging is enabled.
    :vartype enable_conflict_logging: bool
    :ivar conflict_logging_retention_in_days: Conflict logging retention period.
    :vartype conflict_logging_retention_in_days: int
    :ivar use_private_link_connection: If use private link connection is enabled.
    :vartype use_private_link_connection: bool
    :ivar private_endpoint_name: Private endpoint name of the sync group if use private link
     connection is enabled.
    :vartype private_endpoint_name: str
    """

    interval: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Sync interval of the sync group."""
    last_sync_time: Optional[datetime.datetime] = rest_field(name="lastSyncTime", visibility=["read"], format="rfc3339")
    """Last sync time of the sync group."""
    conflict_resolution_policy: Optional[Union[str, "_models.SyncConflictResolutionPolicy"]] = rest_field(
        name="conflictResolutionPolicy", visibility=["read", "create", "update", "delete", "query"]
    )
    """Conflict resolution policy of the sync group. Known values are: \"HubWin\" and \"MemberWin\"."""
    sync_database_id: Optional[str] = rest_field(
        name="syncDatabaseId", visibility=["read", "create", "update", "delete", "query"]
    )
    """ARM resource id of the sync database in the sync group."""
    hub_database_user_name: Optional[str] = rest_field(
        name="hubDatabaseUserName", visibility=["read", "create", "update", "delete", "query"]
    )
    """User name for the sync group hub database credential."""
    hub_database_password: Optional[str] = rest_field(name="hubDatabasePassword", visibility=["create", "update"])
    """Password for the sync group hub database credential."""
    sync_state: Optional[Union[str, "_models.SyncGroupState"]] = rest_field(name="syncState", visibility=["read"])
    """Sync state of the sync group. Known values are: \"NotReady\", \"Error\", \"Warning\",
     \"Progressing\", and \"Good\"."""
    schema: Optional["_models.SyncGroupSchema"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Sync schema of the sync group."""
    enable_conflict_logging: Optional[bool] = rest_field(
        name="enableConflictLogging", visibility=["read", "create", "update", "delete", "query"]
    )
    """If conflict logging is enabled."""
    conflict_logging_retention_in_days: Optional[int] = rest_field(
        name="conflictLoggingRetentionInDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """Conflict logging retention period."""
    use_private_link_connection: Optional[bool] = rest_field(
        name="usePrivateLinkConnection", visibility=["read", "create", "update", "delete", "query"]
    )
    """If use private link connection is enabled."""
    private_endpoint_name: Optional[str] = rest_field(name="privateEndpointName", visibility=["read"])
    """Private endpoint name of the sync group if use private link connection is enabled."""

    @overload
    def __init__(
        self,
        *,
        interval: Optional[int] = None,
        conflict_resolution_policy: Optional[Union[str, "_models.SyncConflictResolutionPolicy"]] = None,
        sync_database_id: Optional[str] = None,
        hub_database_user_name: Optional[str] = None,
        hub_database_password: Optional[str] = None,
        schema: Optional["_models.SyncGroupSchema"] = None,
        enable_conflict_logging: Optional[bool] = None,
        conflict_logging_retention_in_days: Optional[int] = None,
        use_private_link_connection: Optional[bool] = 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 SyncGroupSchema(_Model):
    """Properties of sync group schema.

    :ivar tables: List of tables in sync group schema.
    :vartype tables: list[~azure.mgmt.sql.models.SyncGroupSchemaTable]
    :ivar master_sync_member_name: Name of master sync member where the schema is from.
    :vartype master_sync_member_name: str
    """

    tables: Optional[list["_models.SyncGroupSchemaTable"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of tables in sync group schema."""
    master_sync_member_name: Optional[str] = rest_field(
        name="masterSyncMemberName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Name of master sync member where the schema is from."""

    @overload
    def __init__(
        self,
        *,
        tables: Optional[list["_models.SyncGroupSchemaTable"]] = None,
        master_sync_member_name: 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 SyncGroupSchemaTable(_Model):
    """Properties of table in sync group schema.

    :ivar columns: List of columns in sync group schema.
    :vartype columns: list[~azure.mgmt.sql.models.SyncGroupSchemaTableColumn]
    :ivar quoted_name: Quoted name of sync group schema table.
    :vartype quoted_name: str
    """

    columns: Optional[list["_models.SyncGroupSchemaTableColumn"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of columns in sync group schema."""
    quoted_name: Optional[str] = rest_field(
        name="quotedName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Quoted name of sync group schema table."""

    @overload
    def __init__(
        self,
        *,
        columns: Optional[list["_models.SyncGroupSchemaTableColumn"]] = None,
        quoted_name: 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 SyncGroupSchemaTableColumn(_Model):
    """Properties of column in sync group table.

    :ivar quoted_name: Quoted name of sync group table column.
    :vartype quoted_name: str
    :ivar data_size: Data size of the column.
    :vartype data_size: str
    :ivar data_type: Data type of the column.
    :vartype data_type: str
    """

    quoted_name: Optional[str] = rest_field(
        name="quotedName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Quoted name of sync group table column."""
    data_size: Optional[str] = rest_field(name="dataSize", visibility=["read", "create", "update", "delete", "query"])
    """Data size of the column."""
    data_type: Optional[str] = rest_field(name="dataType", visibility=["read", "create", "update", "delete", "query"])
    """Data type of the column."""

    @overload
    def __init__(
        self,
        *,
        quoted_name: Optional[str] = None,
        data_size: Optional[str] = None,
        data_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 SyncMember(ProxyResource):
    """An Azure SQL Database sync member.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.SyncMemberProperties
    """

    properties: Optional["_models.SyncMemberProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "database_type",
        "sync_agent_id",
        "sql_server_database_id",
        "sync_member_azure_database_resource_id",
        "use_private_link_connection",
        "private_endpoint_name",
        "server_name",
        "database_name",
        "user_name",
        "password",
        "sync_direction",
        "sync_state",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.SyncMemberProperties"] = 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 SyncMemberProperties(_Model):
    """Properties of a sync member with support to MI.

    :ivar database_type: Database type of the sync member. Known values are: "AzureSqlDatabase" and
     "SqlServerDatabase".
    :vartype database_type: str or ~azure.mgmt.sql.models.SyncMemberDbType
    :ivar sync_agent_id: ARM resource id of the sync agent in the sync member.
    :vartype sync_agent_id: str
    :ivar sql_server_database_id: SQL Server database id of the sync member.
    :vartype sql_server_database_id: str
    :ivar sync_member_azure_database_resource_id: ARM resource id of the sync member logical
     database, for sync members in Azure.
    :vartype sync_member_azure_database_resource_id: str
    :ivar use_private_link_connection: Whether to use private link connection.
    :vartype use_private_link_connection: bool
    :ivar private_endpoint_name: Private endpoint name of the sync member if use private link
     connection is enabled, for sync members in Azure.
    :vartype private_endpoint_name: str
    :ivar server_name: Server name of the member database in the sync member.
    :vartype server_name: str
    :ivar database_name: Database name of the member database in the sync member.
    :vartype database_name: str
    :ivar user_name: User name of the member database in the sync member.
    :vartype user_name: str
    :ivar password: Password of the member database in the sync member.
    :vartype password: str
    :ivar sync_direction: Sync direction of the sync member. Known values are: "Bidirectional",
     "OneWayMemberToHub", and "OneWayHubToMember".
    :vartype sync_direction: str or ~azure.mgmt.sql.models.SyncDirection
    :ivar sync_state: Sync state of the sync member. Known values are: "SyncInProgress",
     "SyncSucceeded", "SyncFailed", "DisabledTombstoneCleanup", "DisabledBackupRestore",
     "SyncSucceededWithWarnings", "SyncCancelling", "SyncCancelled", "UnProvisioned",
     "Provisioning", "Provisioned", "ProvisionFailed", "DeProvisioning", "DeProvisioned",
     "DeProvisionFailed", "Reprovisioning", "ReprovisionFailed", and "UnReprovisioned".
    :vartype sync_state: str or ~azure.mgmt.sql.models.SyncMemberState
    """

    database_type: Optional[Union[str, "_models.SyncMemberDbType"]] = rest_field(
        name="databaseType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Database type of the sync member. Known values are: \"AzureSqlDatabase\" and
     \"SqlServerDatabase\"."""
    sync_agent_id: Optional[str] = rest_field(
        name="syncAgentId", visibility=["read", "create", "update", "delete", "query"]
    )
    """ARM resource id of the sync agent in the sync member."""
    sql_server_database_id: Optional[str] = rest_field(
        name="sqlServerDatabaseId", visibility=["read", "create", "update", "delete", "query"]
    )
    """SQL Server database id of the sync member."""
    sync_member_azure_database_resource_id: Optional[str] = rest_field(
        name="syncMemberAzureDatabaseResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """ARM resource id of the sync member logical database, for sync members in Azure."""
    use_private_link_connection: Optional[bool] = rest_field(
        name="usePrivateLinkConnection", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether to use private link connection."""
    private_endpoint_name: Optional[str] = rest_field(name="privateEndpointName", visibility=["read"])
    """Private endpoint name of the sync member if use private link connection is enabled, for sync
     members in Azure."""
    server_name: Optional[str] = rest_field(
        name="serverName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Server name of the member database in the sync member."""
    database_name: Optional[str] = rest_field(
        name="databaseName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Database name of the member database in the sync member."""
    user_name: Optional[str] = rest_field(name="userName", visibility=["read", "create", "update", "delete", "query"])
    """User name of the member database in the sync member."""
    password: Optional[str] = rest_field(visibility=["create", "update"])
    """Password of the member database in the sync member."""
    sync_direction: Optional[Union[str, "_models.SyncDirection"]] = rest_field(
        name="syncDirection", visibility=["read", "create", "update", "delete", "query"]
    )
    """Sync direction of the sync member. Known values are: \"Bidirectional\", \"OneWayMemberToHub\",
     and \"OneWayHubToMember\"."""
    sync_state: Optional[Union[str, "_models.SyncMemberState"]] = rest_field(name="syncState", visibility=["read"])
    """Sync state of the sync member. Known values are: \"SyncInProgress\", \"SyncSucceeded\",
     \"SyncFailed\", \"DisabledTombstoneCleanup\", \"DisabledBackupRestore\",
     \"SyncSucceededWithWarnings\", \"SyncCancelling\", \"SyncCancelled\", \"UnProvisioned\",
     \"Provisioning\", \"Provisioned\", \"ProvisionFailed\", \"DeProvisioning\", \"DeProvisioned\",
     \"DeProvisionFailed\", \"Reprovisioning\", \"ReprovisionFailed\", and \"UnReprovisioned\"."""

    @overload
    def __init__(
        self,
        *,
        database_type: Optional[Union[str, "_models.SyncMemberDbType"]] = None,
        sync_agent_id: Optional[str] = None,
        sql_server_database_id: Optional[str] = None,
        sync_member_azure_database_resource_id: Optional[str] = None,
        use_private_link_connection: Optional[bool] = None,
        server_name: Optional[str] = None,
        database_name: Optional[str] = None,
        user_name: Optional[str] = None,
        password: Optional[str] = None,
        sync_direction: Optional[Union[str, "_models.SyncDirection"]] = 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 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.sql.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.sql.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)


class TdeCertificate(ProxyResource):
    """A TDE certificate that can be uploaded into a server.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.TdeCertificateProperties
    """

    properties: Optional["_models.TdeCertificateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["private_blob", "cert_password"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.TdeCertificateProperties"] = 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 TdeCertificateProperties(_Model):
    """Properties of a TDE certificate.

    :ivar private_blob: The base64 encoded certificate private blob. Required.
    :vartype private_blob: str
    :ivar cert_password: The certificate password.
    :vartype cert_password: str
    """

    private_blob: str = rest_field(name="privateBlob", visibility=["create", "update"])
    """The base64 encoded certificate private blob. Required."""
    cert_password: Optional[str] = rest_field(name="certPassword", visibility=["create", "update"])
    """The certificate password."""

    @overload
    def __init__(
        self,
        *,
        private_blob: str,
        cert_password: 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 TimeZone(ProxyResource):
    """Time Zone property.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.TimeZoneProperties
    """

    properties: Optional["_models.TimeZoneProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["time_zone_id", "display_name"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.TimeZoneProperties"] = 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 TimeZoneProperties(_Model):
    """The properties of a time zone.

    :ivar time_zone_id: The time zone id.
    :vartype time_zone_id: str
    :ivar display_name: The time zone display name.
    :vartype display_name: str
    """

    time_zone_id: Optional[str] = rest_field(name="timeZoneId", visibility=["read"])
    """The time zone id."""
    display_name: Optional[str] = rest_field(name="displayName", visibility=["read"])
    """The time zone display name."""


class TopQueries(_Model):
    """TopQueries.

    :ivar number_of_queries: Requested number of top queries.
    :vartype number_of_queries: int
    :ivar aggregation_function: Aggregation function used to calculate query metrics.
    :vartype aggregation_function: str
    :ivar observation_metric: Metric used to rank queries.
    :vartype observation_metric: str
    :ivar interval_type: Interval type (length). Known values are: "PT1H" and "P1D".
    :vartype interval_type: str or ~azure.mgmt.sql.models.QueryTimeGrainType
    :ivar start_time: The start time for the metric (ISO-8601 format).
    :vartype start_time: str
    :ivar end_time: The end time for the metric (ISO-8601 format).
    :vartype end_time: str
    :ivar queries: List of top resource consuming queries with appropriate metric data.
    :vartype queries: list[~azure.mgmt.sql.models.QueryStatisticsProperties]
    """

    number_of_queries: Optional[int] = rest_field(name="numberOfQueries", visibility=["read"])
    """Requested number of top queries."""
    aggregation_function: Optional[str] = rest_field(name="aggregationFunction", visibility=["read"])
    """Aggregation function used to calculate query metrics."""
    observation_metric: Optional[str] = rest_field(name="observationMetric", visibility=["read"])
    """Metric used to rank queries."""
    interval_type: Optional[Union[str, "_models.QueryTimeGrainType"]] = rest_field(
        name="intervalType", visibility=["read"]
    )
    """Interval type (length). Known values are: \"PT1H\" and \"P1D\"."""
    start_time: Optional[str] = rest_field(name="startTime", visibility=["read"])
    """The start time for the metric (ISO-8601 format)."""
    end_time: Optional[str] = rest_field(name="endTime", visibility=["read"])
    """The end time for the metric (ISO-8601 format)."""
    queries: Optional[list["_models.QueryStatisticsProperties"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of top resource consuming queries with appropriate metric data."""

    @overload
    def __init__(
        self,
        *,
        queries: Optional[list["_models.QueryStatisticsProperties"]] = 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 TransparentDataEncryptionProperties(_Model):
    """Properties of a transparent data encryption scan.

    :ivar state: Specifies the state of the transparent data encryption. Required. Known values
     are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.TransparentDataEncryptionState
    :ivar scan_state: Specifies the encryption scan state of the transparent data encryption. Known
     values are: "None", "Resume", "Running", "Suspend", "Aborted", and "Completed".
    :vartype scan_state: str or ~azure.mgmt.sql.models.TransparentDataEncryptionScanState
    """

    state: Union[str, "_models.TransparentDataEncryptionState"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the state of the transparent data encryption. Required. Known values are: \"Enabled\"
     and \"Disabled\"."""
    scan_state: Optional[Union[str, "_models.TransparentDataEncryptionScanState"]] = rest_field(
        name="scanState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the encryption scan state of the transparent data encryption. Known values are:
     \"None\", \"Resume\", \"Running\", \"Suspend\", \"Aborted\", and \"Completed\"."""

    @overload
    def __init__(
        self,
        *,
        state: Union[str, "_models.TransparentDataEncryptionState"],
        scan_state: Optional[Union[str, "_models.TransparentDataEncryptionScanState"]] = 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 UpdateLongTermRetentionBackupParameters(_Model):
    """Contains the information necessary to perform long term retention backup update operation.

    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.UpdateLongTermRetentionBackupParametersProperties
    """

    properties: Optional["_models.UpdateLongTermRetentionBackupParametersProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["requested_backup_storage_redundancy"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.UpdateLongTermRetentionBackupParametersProperties"] = 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 UpdateLongTermRetentionBackupParametersProperties(_Model):  # pylint: disable=name-too-long
    """Contains the properties to perform long term retention backup copy operation.

    :ivar requested_backup_storage_redundancy: The storage redundancy type of the copied backup.
     Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    """

    requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field(
        name="requestedBackupStorageRedundancy", visibility=["create"]
    )
    """The storage redundancy type of the copied backup. Known values are: \"Geo\", \"Local\",
     \"Zone\", and \"GeoZone\"."""

    @overload
    def __init__(
        self,
        *,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = 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 UpdateVirtualClusterDnsServersOperation(ProxyResource):
    """A refresh DNS servers operation.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.VirtualClusterDnsServersProperties
    """

    properties: Optional["_models.VirtualClusterDnsServersProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["status"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.VirtualClusterDnsServersProperties"] = 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 UpsertManagedServerOperationParameters(_Model):
    """UpsertManagedServerOperationParameters.

    :ivar family:
    :vartype family: str
    :ivar tier:
    :vartype tier: str
    :ivar v_cores:
    :vartype v_cores: int
    :ivar storage_size_in_gb:
    :vartype storage_size_in_gb: int
    """

    family: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    tier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    v_cores: Optional[int] = rest_field(name="vCores", visibility=["read", "create", "update", "delete", "query"])
    storage_size_in_gb: Optional[int] = rest_field(
        name="storageSizeInGB", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        family: Optional[str] = None,
        tier: Optional[str] = None,
        v_cores: Optional[int] = None,
        storage_size_in_gb: 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 UpsertManagedServerOperationStepWithEstimatesAndDuration(_Model):  # pylint: disable=name-too-long
    """UpsertManagedServerOperationStepWithEstimatesAndDuration.

    :ivar step_start_time:
    :vartype step_start_time: ~datetime.datetime
    :ivar step_end_time:
    :vartype step_end_time: ~datetime.datetime
    :ivar time_elapsed:
    :vartype time_elapsed: str
    :ivar order:
    :vartype order: int
    :ivar name:
    :vartype name: str
    :ivar status: Known values are: "NotStarted", "InProgress", "SlowedDown", "Completed",
     "Failed", and "Canceled".
    :vartype status: str or
     ~azure.mgmt.sql.models.UpsertManagedServerOperationStepWithEstimatesAndDurationStatus
    """

    step_start_time: Optional[datetime.datetime] = rest_field(
        name="stepStartTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    step_end_time: Optional[datetime.datetime] = rest_field(
        name="stepEndTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    time_elapsed: Optional[str] = rest_field(
        name="timeElapsed", visibility=["read", "create", "update", "delete", "query"]
    )
    order: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    status: Optional[Union[str, "_models.UpsertManagedServerOperationStepWithEstimatesAndDurationStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Known values are: \"NotStarted\", \"InProgress\", \"SlowedDown\", \"Completed\", \"Failed\",
     and \"Canceled\"."""

    @overload
    def __init__(
        self,
        *,
        step_start_time: Optional[datetime.datetime] = None,
        step_end_time: Optional[datetime.datetime] = None,
        time_elapsed: Optional[str] = None,
        order: Optional[int] = None,
        name: Optional[str] = None,
        status: Optional[Union[str, "_models.UpsertManagedServerOperationStepWithEstimatesAndDurationStatus"]] = 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 Usage(_Model):
    """ARM usage.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: ~azure.mgmt.sql.models.Name
    :ivar type: Resource type.
    :vartype type: str
    :ivar unit: Usage unit.
    :vartype unit: str
    :ivar current_value: Usage current value.
    :vartype current_value: int
    :ivar limit: Usage limit.
    :vartype limit: int
    :ivar requested_limit: Usage requested limit.
    :vartype requested_limit: int
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """Resource ID."""
    name: Optional["_models.Name"] = rest_field(visibility=["read"])
    """Resource name."""
    type: Optional[str] = rest_field(visibility=["read"])
    """Resource type."""
    unit: Optional[str] = rest_field(visibility=["read"])
    """Usage unit."""
    current_value: Optional[int] = rest_field(name="currentValue", visibility=["read"])
    """Usage current value."""
    limit: Optional[int] = rest_field(visibility=["read"])
    """Usage limit."""
    requested_limit: Optional[int] = rest_field(name="requestedLimit", visibility=["read"])
    """Usage requested limit."""


class UserIdentity(_Model):
    """Azure Active Directory identity configuration for a resource.

    :ivar principal_id: The Azure Active Directory principal id.
    :vartype principal_id: str
    :ivar client_id: The Azure Active Directory client id.
    :vartype client_id: str
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The Azure Active Directory principal id."""
    client_id: Optional[str] = rest_field(name="clientId", visibility=["read"])
    """The Azure Active Directory client id."""


class VaRule(_Model):
    """SQL Vulnerability Assessment rule metadata details.

    :ivar rule_id: SQL Vulnerability Assessment rule Id.
    :vartype rule_id: str
    :ivar severity: SQL Vulnerability Assessment rule severity. Known values are: "High", "Medium",
     "Low", "Informational", and "Obsolete".
    :vartype severity: str or ~azure.mgmt.sql.models.RuleSeverity
    :ivar category: SQL Vulnerability Assessment rule category.
    :vartype category: str
    :ivar rule_type: SQL Vulnerability Assessment rule type. Known values are: "Binary",
     "BaselineExpected", "PositiveList", and "NegativeList".
    :vartype rule_type: str or ~azure.mgmt.sql.models.RuleType
    :ivar title: SQL Vulnerability Assessment rule title.
    :vartype title: str
    :ivar description: SQL Vulnerability Assessment rule description.
    :vartype description: str
    :ivar rationale: SQL Vulnerability Assessment rule rationale.
    :vartype rationale: str
    :ivar query_check: SQL Vulnerability Assessment rule query details.
    :vartype query_check: ~azure.mgmt.sql.models.QueryCheck
    :ivar benchmark_references: SQL Vulnerability Assessment benchmark references.
    :vartype benchmark_references: list[~azure.mgmt.sql.models.BenchmarkReference]
    """

    rule_id: Optional[str] = rest_field(name="ruleId", visibility=["read"])
    """SQL Vulnerability Assessment rule Id."""
    severity: Optional[Union[str, "_models.RuleSeverity"]] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment rule severity. Known values are: \"High\", \"Medium\", \"Low\",
     \"Informational\", and \"Obsolete\"."""
    category: Optional[str] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment rule category."""
    rule_type: Optional[Union[str, "_models.RuleType"]] = rest_field(name="ruleType", visibility=["read"])
    """SQL Vulnerability Assessment rule type. Known values are: \"Binary\", \"BaselineExpected\",
     \"PositiveList\", and \"NegativeList\"."""
    title: Optional[str] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment rule title."""
    description: Optional[str] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment rule description."""
    rationale: Optional[str] = rest_field(visibility=["read"])
    """SQL Vulnerability Assessment rule rationale."""
    query_check: Optional["_models.QueryCheck"] = rest_field(name="queryCheck", visibility=["read"])
    """SQL Vulnerability Assessment rule query details."""
    benchmark_references: Optional[list["_models.BenchmarkReference"]] = rest_field(
        name="benchmarkReferences", visibility=["read"]
    )
    """SQL Vulnerability Assessment benchmark references."""


class VirtualCluster(TrackedResource):
    """An Azure SQL virtual cluster.

    :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.sql.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: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.VirtualClusterProperties
    """

    properties: Optional["_models.VirtualClusterProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["subnet_id", "version", "child_resources"]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.VirtualClusterProperties"] = 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 VirtualClusterDnsServersProperties(_Model):
    """The properties of dns servers on virtual cluster.

    :ivar status: The status of the DNS refresh operation. Known values are: "Succeeded", "Failed",
     and "InProgress".
    :vartype status: str or ~azure.mgmt.sql.models.DNSRefreshOperationStatus
    """

    status: Optional[Union[str, "_models.DNSRefreshOperationStatus"]] = rest_field(visibility=["read"])
    """The status of the DNS refresh operation. Known values are: \"Succeeded\", \"Failed\", and
     \"InProgress\"."""


class VirtualClusterProperties(_Model):
    """The properties of a virtual cluster.

    :ivar subnet_id: Subnet resource ID for the virtual cluster.
    :vartype subnet_id: str
    :ivar version: Virtual cluster version.
    :vartype version: str
    :ivar child_resources: List of resources in this virtual cluster.
    :vartype child_resources: list[str]
    """

    subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read"])
    """Subnet resource ID for the virtual cluster."""
    version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Virtual cluster version."""
    child_resources: Optional[list[str]] = rest_field(name="childResources", visibility=["read"])
    """List of resources in this virtual cluster."""

    @overload
    def __init__(
        self,
        *,
        version: 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 VirtualClusterUpdate(_Model):
    """An update request for virtual cluster.

    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.VirtualClusterProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    properties: Optional["_models.VirtualClusterProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = ["subnet_id", "version", "child_resources"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.VirtualClusterProperties"] = 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 VirtualNetworkRule(ProxyResource):
    """A virtual network rule.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.VirtualNetworkRuleProperties
    """

    properties: Optional["_models.VirtualNetworkRuleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["virtual_network_subnet_id", "ignore_missing_vnet_service_endpoint", "state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.VirtualNetworkRuleProperties"] = 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 VirtualNetworkRuleProperties(_Model):
    """Properties of a virtual network rule.

    :ivar virtual_network_subnet_id: The ARM resource id of the virtual network subnet. Required.
    :vartype virtual_network_subnet_id: str
    :ivar ignore_missing_vnet_service_endpoint: Create firewall rule before the virtual network has
     vnet service endpoint enabled.
    :vartype ignore_missing_vnet_service_endpoint: bool
    :ivar state: Virtual Network Rule State. Known values are: "Initializing", "InProgress",
     "Ready", "Failed", "Deleting", and "Unknown".
    :vartype state: str or ~azure.mgmt.sql.models.VirtualNetworkRuleState
    """

    virtual_network_subnet_id: str = rest_field(
        name="virtualNetworkSubnetId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The ARM resource id of the virtual network subnet. Required."""
    ignore_missing_vnet_service_endpoint: Optional[bool] = rest_field(
        name="ignoreMissingVnetServiceEndpoint", visibility=["read", "create", "update", "delete", "query"]
    )
    """Create firewall rule before the virtual network has vnet service endpoint enabled."""
    state: Optional[Union[str, "_models.VirtualNetworkRuleState"]] = rest_field(visibility=["read"])
    """Virtual Network Rule State. Known values are: \"Initializing\", \"InProgress\", \"Ready\",
     \"Failed\", \"Deleting\", and \"Unknown\"."""

    @overload
    def __init__(
        self,
        *,
        virtual_network_subnet_id: str,
        ignore_missing_vnet_service_endpoint: Optional[bool] = 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 VulnerabilityAssessmentRecurringScansProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a Vulnerability Assessment recurring scans.

    :ivar is_enabled: Recurring scans state.
    :vartype is_enabled: bool
    :ivar email_subscription_admins: Specifies that the schedule scan notification will be is sent
     to the subscription administrators.
    :vartype email_subscription_admins: bool
    :ivar emails: Specifies an array of e-mail addresses to which the scan notification is sent.
    :vartype emails: list[str]
    """

    is_enabled: Optional[bool] = rest_field(
        name="isEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Recurring scans state."""
    email_subscription_admins: Optional[bool] = rest_field(
        name="emailSubscriptionAdmins", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies that the schedule scan notification will be is sent to the subscription
     administrators."""
    emails: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Specifies an array of e-mail addresses to which the scan notification is sent."""

    @overload
    def __init__(
        self,
        *,
        is_enabled: Optional[bool] = None,
        email_subscription_admins: Optional[bool] = None,
        emails: 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 VulnerabilityAssessmentScanError(_Model):
    """Properties of a vulnerability assessment scan error.

    :ivar code: The error code.
    :vartype code: str
    :ivar message: The error message.
    :vartype message: str
    """

    code: Optional[str] = rest_field(visibility=["read"])
    """The error code."""
    message: Optional[str] = rest_field(visibility=["read"])
    """The error message."""


class VulnerabilityAssessmentScanRecord(ProxyResource):
    """A vulnerability assessment scan record.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.VulnerabilityAssessmentScanRecordProperties
    """

    properties: Optional["_models.VulnerabilityAssessmentScanRecordProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "scan_id",
        "trigger_type",
        "state",
        "start_time",
        "end_time",
        "errors",
        "storage_container_path",
        "number_of_failed_security_checks",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.VulnerabilityAssessmentScanRecordProperties"] = 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 VulnerabilityAssessmentScanRecordProperties(_Model):  # pylint: disable=name-too-long
    """Properties of a vulnerability assessment scan record.

    :ivar scan_id: The scan ID.
    :vartype scan_id: str
    :ivar trigger_type: The scan trigger type. Known values are: "OnDemand" and "Recurring".
    :vartype trigger_type: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentScanTriggerType
    :ivar state: The scan status. Known values are: "Passed", "Failed", "FailedToRun", and
     "InProgress".
    :vartype state: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentScanState
    :ivar start_time: The scan start time (UTC).
    :vartype start_time: ~datetime.datetime
    :ivar end_time: The scan end time (UTC).
    :vartype end_time: ~datetime.datetime
    :ivar errors: The scan errors.
    :vartype errors: list[~azure.mgmt.sql.models.VulnerabilityAssessmentScanError]
    :ivar storage_container_path: The scan results storage container path.
    :vartype storage_container_path: str
    :ivar number_of_failed_security_checks: The number of failed security checks.
    :vartype number_of_failed_security_checks: int
    """

    scan_id: Optional[str] = rest_field(name="scanId", visibility=["read"])
    """The scan ID."""
    trigger_type: Optional[Union[str, "_models.VulnerabilityAssessmentScanTriggerType"]] = rest_field(
        name="triggerType", visibility=["read"]
    )
    """The scan trigger type. Known values are: \"OnDemand\" and \"Recurring\"."""
    state: Optional[Union[str, "_models.VulnerabilityAssessmentScanState"]] = rest_field(visibility=["read"])
    """The scan status. Known values are: \"Passed\", \"Failed\", \"FailedToRun\", and \"InProgress\"."""
    start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339")
    """The scan start time (UTC)."""
    end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339")
    """The scan end time (UTC)."""
    errors: Optional[list["_models.VulnerabilityAssessmentScanError"]] = rest_field(visibility=["read"])
    """The scan errors."""
    storage_container_path: Optional[str] = rest_field(name="storageContainerPath", visibility=["read"])
    """The scan results storage container path."""
    number_of_failed_security_checks: Optional[int] = rest_field(
        name="numberOfFailedSecurityChecks", visibility=["read"]
    )
    """The number of failed security checks."""


class WorkloadClassifier(ProxyResource):
    """Workload classifier operations for a data warehouse.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.WorkloadClassifierProperties
    """

    properties: Optional["_models.WorkloadClassifierProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = ["member_name", "label", "context", "start_time", "end_time", "importance"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.WorkloadClassifierProperties"] = 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 WorkloadClassifierProperties(_Model):
    """Workload classifier definition. For more information look at
    sys.workload_management_workload_classifiers (DMV).

    :ivar member_name: The workload classifier member name. Required.
    :vartype member_name: str
    :ivar label: The workload classifier label.
    :vartype label: str
    :ivar context: The workload classifier context.
    :vartype context: str
    :ivar start_time: The workload classifier start time for classification.
    :vartype start_time: str
    :ivar end_time: The workload classifier end time for classification.
    :vartype end_time: str
    :ivar importance: The workload classifier importance.
    :vartype importance: str
    """

    member_name: str = rest_field(name="memberName", visibility=["read", "create", "update", "delete", "query"])
    """The workload classifier member name. Required."""
    label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The workload classifier label."""
    context: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The workload classifier context."""
    start_time: Optional[str] = rest_field(name="startTime", visibility=["read", "create", "update", "delete", "query"])
    """The workload classifier start time for classification."""
    end_time: Optional[str] = rest_field(name="endTime", visibility=["read", "create", "update", "delete", "query"])
    """The workload classifier end time for classification."""
    importance: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The workload classifier importance."""

    @overload
    def __init__(
        self,
        *,
        member_name: str,
        label: Optional[str] = None,
        context: Optional[str] = None,
        start_time: Optional[str] = None,
        end_time: Optional[str] = None,
        importance: 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 WorkloadGroup(ProxyResource):
    """Workload group operations for a data warehouse.

    :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.sql.models.SystemData
    :ivar properties: Resource properties.
    :vartype properties: ~azure.mgmt.sql.models.WorkloadGroupProperties
    """

    properties: Optional["_models.WorkloadGroupProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource properties."""

    __flattened_items = [
        "min_resource_percent",
        "max_resource_percent",
        "min_resource_percent_per_request",
        "max_resource_percent_per_request",
        "importance",
        "query_execution_timeout",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.WorkloadGroupProperties"] = 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 WorkloadGroupProperties(_Model):
    """Workload group definition. For more information look at sys.workload_management_workload_groups
    (DMV).

    :ivar min_resource_percent: The workload group minimum percentage resource. Required.
    :vartype min_resource_percent: int
    :ivar max_resource_percent: The workload group cap percentage resource. Required.
    :vartype max_resource_percent: int
    :ivar min_resource_percent_per_request: The workload group request minimum grant percentage.
     Required.
    :vartype min_resource_percent_per_request: float
    :ivar max_resource_percent_per_request: The workload group request maximum grant percentage.
    :vartype max_resource_percent_per_request: float
    :ivar importance: The workload group importance level.
    :vartype importance: str
    :ivar query_execution_timeout: The workload group query execution timeout.
    :vartype query_execution_timeout: int
    """

    min_resource_percent: int = rest_field(
        name="minResourcePercent", visibility=["read", "create", "update", "delete", "query"]
    )
    """The workload group minimum percentage resource. Required."""
    max_resource_percent: int = rest_field(
        name="maxResourcePercent", visibility=["read", "create", "update", "delete", "query"]
    )
    """The workload group cap percentage resource. Required."""
    min_resource_percent_per_request: float = rest_field(
        name="minResourcePercentPerRequest", visibility=["read", "create", "update", "delete", "query"]
    )
    """The workload group request minimum grant percentage. Required."""
    max_resource_percent_per_request: Optional[float] = rest_field(
        name="maxResourcePercentPerRequest", visibility=["read", "create", "update", "delete", "query"]
    )
    """The workload group request maximum grant percentage."""
    importance: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The workload group importance level."""
    query_execution_timeout: Optional[int] = rest_field(
        name="queryExecutionTimeout", visibility=["read", "create", "update", "delete", "query"]
    )
    """The workload group query execution timeout."""

    @overload
    def __init__(
        self,
        *,
        min_resource_percent: int,
        max_resource_percent: int,
        min_resource_percent_per_request: float,
        max_resource_percent_per_request: Optional[float] = None,
        importance: Optional[str] = None,
        query_execution_timeout: 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 ZonePinningCapability(_Model):
    """The zone pinning capability.

    :ivar availability_zone: Name of the availability zone.
    :vartype availability_zone: str
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    availability_zone: Optional[str] = rest_field(name="availabilityZone", visibility=["read"])
    """Name of the availability zone."""
    status: Optional[Union[str, "_models.CapabilityStatus"]] = rest_field(visibility=["read"])
    """The status of the capability. Known values are: \"Visible\", \"Available\", \"Default\", and
     \"Disabled\"."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the capability not being available."""

    @overload
    def __init__(
        self,
        *,
        reason: 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)
