# 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, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload

from .._utils.model_base import Model as _Model, rest_discriminator, rest_field
from ._enums import AccessReviewDecisionInsightType, DecisionTargetType, RoleManagementPolicyRuleType

if TYPE_CHECKING:
    from .. import models as _models


class AccessReviewActorIdentity(_Model):
    """Details of the actor identity.

    :ivar principal_id: The identity id.
    :vartype principal_id: str
    :ivar principal_type: The identity type : user/servicePrincipal. Known values are: "user" and
     "servicePrincipal".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.AccessReviewActorIdentityType
    :ivar principal_name: The identity display name.
    :vartype principal_name: str
    :ivar user_principal_name: The user principal name(if valid).
    :vartype user_principal_name: str
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The identity id."""
    principal_type: Optional[Union[str, "_models.AccessReviewActorIdentityType"]] = rest_field(
        name="principalType", visibility=["read"]
    )
    """The identity type : user/servicePrincipal. Known values are: \"user\" and \"servicePrincipal\"."""
    principal_name: Optional[str] = rest_field(name="principalName", visibility=["read"])
    """The identity display name."""
    user_principal_name: Optional[str] = rest_field(name="userPrincipalName", visibility=["read"])
    """The user principal name(if valid)."""


class AccessReviewContactedReviewer(_Model):
    """Access Review Contacted Reviewer.

    :ivar id: The access review reviewer id.
    :vartype id: str
    :ivar name: The access review reviewer id.
    :vartype name: str
    :ivar type: The resource type.
    :vartype type: str
    :ivar properties: Access Review Contacted Reviewer properties.
    :vartype properties: ~azure.mgmt.authorization.models.AccessReviewContactedReviewerProperties
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """The access review reviewer id."""
    name: Optional[str] = rest_field(visibility=["read"])
    """The access review reviewer id."""
    type: Optional[str] = rest_field(visibility=["read"])
    """The resource type."""
    properties: Optional["_models.AccessReviewContactedReviewerProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review Contacted Reviewer properties."""

    __flattened_items = ["user_display_name", "user_principal_name", "created_date_time"]

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

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewContactedReviewerProperties(_Model):
    """Properties of access review contacted reviewer.

    :ivar user_display_name: The display name of the reviewer.
    :vartype user_display_name: str
    :ivar user_principal_name: The user principal name of the reviewer.
    :vartype user_principal_name: str
    :ivar created_date_time: Date Time when the reviewer was contacted.
    :vartype created_date_time: ~datetime.datetime
    """

    user_display_name: Optional[str] = rest_field(name="userDisplayName", visibility=["read"])
    """The display name of the reviewer."""
    user_principal_name: Optional[str] = rest_field(name="userPrincipalName", visibility=["read"])
    """The user principal name of the reviewer."""
    created_date_time: Optional[datetime.datetime] = rest_field(
        name="createdDateTime", visibility=["read"], format="rfc3339"
    )
    """Date Time when the reviewer was contacted."""


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


class AccessReviewDecision(ProxyResource):
    """Access Review.

    :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.authorization.models.SystemData
    :ivar properties: Access Review Decision properties.
    :vartype properties: ~azure.mgmt.authorization.models.AccessReviewDecisionProperties
    """

    properties: Optional["_models.AccessReviewDecisionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review Decision properties."""

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

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewDecisionIdentity(_Model):
    """Target of the decision.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    AccessReviewDecisionServicePrincipalIdentity, AccessReviewDecisionUserIdentity

    :ivar type: The type of decision target : User/ServicePrincipal. Required. Known values are:
     "user" and "servicePrincipal".
    :vartype type: str or ~azure.mgmt.authorization.models.DecisionTargetType
    :ivar id: The id of principal whose access was reviewed.
    :vartype id: str
    :ivar display_name: The display name of the user whose access was reviewed.
    :vartype display_name: str
    """

    __mapping__: dict[str, _Model] = {}
    type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])
    """The type of decision target : User/ServicePrincipal. Required. Known values are: \"user\" and
     \"servicePrincipal\"."""
    id: Optional[str] = rest_field(visibility=["read"])
    """The id of principal whose access was reviewed."""
    display_name: Optional[str] = rest_field(name="displayName", visibility=["read"])
    """The display name of the user whose access was reviewed."""

    @overload
    def __init__(
        self,
        *,
        type: 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 AccessReviewDecisionInsight(_Model):
    """Access Review Decision Insight.

    :ivar id: The access review insight id.
    :vartype id: str
    :ivar name: The access review insight name.
    :vartype name: str
    :ivar type: The resource type.
    :vartype type: str
    :ivar properties: Access Review Decision Insight properties.
    :vartype properties: ~azure.mgmt.authorization.models.AccessReviewDecisionInsightProperties
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """The access review insight id."""
    name: Optional[str] = rest_field(visibility=["read"])
    """The access review insight name."""
    type: Optional[str] = rest_field(visibility=["read"])
    """The resource type."""
    properties: Optional["_models.AccessReviewDecisionInsightProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review Decision Insight properties."""

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

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewDecisionInsightProperties(_Model):
    """Details of the Insight.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    AccessReviewDecisionUserSignInInsightProperties

    :ivar type: The type of insight. Required. "userSignInInsight"
    :vartype type: str or ~azure.mgmt.authorization.models.AccessReviewDecisionInsightType
    :ivar insight_created_date_time: Date Time when the insight was created.
    :vartype insight_created_date_time: ~datetime.datetime
    """

    __mapping__: dict[str, _Model] = {}
    type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])
    """The type of insight. Required. \"userSignInInsight\""""
    insight_created_date_time: Optional[datetime.datetime] = rest_field(
        name="insightCreatedDateTime", visibility=["read"], format="rfc3339"
    )
    """Date Time when the insight was created."""

    @overload
    def __init__(
        self,
        *,
        type: 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 AccessReviewDecisionPrincipalResourceMembership(_Model):  # pylint: disable=name-too-long
    """Target of the decision.

    :ivar membership_types: Every decision item in an access review represents a principal's
     membership to a resource. This property represents details of the membership. Examples of this
     detail might be whether the principal has direct access or indirect access.
    :vartype membership_types: list[str or
     ~azure.mgmt.authorization.models.AccessReviewDecisionPrincipalResourceMembershipType]
    """

    membership_types: Optional[list[Union[str, "_models.AccessReviewDecisionPrincipalResourceMembershipType"]]] = (
        rest_field(name="membershipTypes", visibility=["read", "create", "update", "delete", "query"])
    )
    """Every decision item in an access review represents a principal's membership to a resource. This
     property represents details of the membership. Examples of this detail might be whether the
     principal has direct access or indirect access."""

    @overload
    def __init__(
        self,
        *,
        membership_types: Optional[
            list[Union[str, "_models.AccessReviewDecisionPrincipalResourceMembershipType"]]
        ] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewDecisionProperties(_Model):
    """Approval Step.

    :ivar principal: Principal associated with the decision record. Can be
     AccessReviewDecisionUserIdentity or AccessReviewDecisionServicePrincipalIdentity.
    :vartype principal: ~azure.mgmt.authorization.models.AccessReviewDecisionIdentity
    :ivar resource: Resource associated with this decision record.
    :vartype resource: ~azure.mgmt.authorization.models.AccessReviewDecisionResource
    :ivar recommendation: The feature- generated recommendation shown to the reviewer. Known values
     are: "Approve", "Deny", and "NoInfoAvailable".
    :vartype recommendation: str or ~azure.mgmt.authorization.models.AccessRecommendationType
    :ivar decision: The decision on the approval step. This value is initially set to NotReviewed.
     Approvers can take action of Approve/Deny. Known values are: "Approve", "Deny", "NotReviewed",
     "DontKnow", and "NotNotified".
    :vartype decision: str or ~azure.mgmt.authorization.models.AccessReviewResult
    :ivar justification: Justification provided by approvers for their action.
    :vartype justification: str
    :ivar reviewed_date_time: Date Time when a decision was taken.
    :vartype reviewed_date_time: ~datetime.datetime
    :ivar reviewed_by: Details of the approver.
    :vartype reviewed_by: ~azure.mgmt.authorization.models.AccessReviewActorIdentity
    :ivar apply_result: The outcome of applying the decision. Known values are: "New", "Applying",
     "AppliedSuccessfully", "AppliedWithUnknownFailure", "AppliedSuccessfullyButObjectNotFound", and
     "ApplyNotSupported".
    :vartype apply_result: str or ~azure.mgmt.authorization.models.AccessReviewApplyResult
    :ivar applied_date_time: The date and time when the review decision was applied.
    :vartype applied_date_time: ~datetime.datetime
    :ivar applied_by: Details of the approver.
    :vartype applied_by: ~azure.mgmt.authorization.models.AccessReviewActorIdentity
    :ivar insights: This is the collection of insights for this decision item.
    :vartype insights: list[~azure.mgmt.authorization.models.AccessReviewDecisionInsight]
    :ivar principal_resource_membership: Details of the membership type.
    :vartype principal_resource_membership:
     ~azure.mgmt.authorization.models.AccessReviewDecisionPrincipalResourceMembership
    """

    principal: Optional["_models.AccessReviewDecisionIdentity"] = rest_field(visibility=["read"])
    """Principal associated with the decision record. Can be AccessReviewDecisionUserIdentity or
     AccessReviewDecisionServicePrincipalIdentity."""
    resource: Optional["_models.AccessReviewDecisionResource"] = rest_field(visibility=["read"])
    """Resource associated with this decision record."""
    recommendation: Optional[Union[str, "_models.AccessRecommendationType"]] = rest_field(visibility=["read"])
    """The feature- generated recommendation shown to the reviewer. Known values are: \"Approve\",
     \"Deny\", and \"NoInfoAvailable\"."""
    decision: Optional[Union[str, "_models.AccessReviewResult"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The decision on the approval step. This value is initially set to NotReviewed. Approvers can
     take action of Approve/Deny. Known values are: \"Approve\", \"Deny\", \"NotReviewed\",
     \"DontKnow\", and \"NotNotified\"."""
    justification: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Justification provided by approvers for their action."""
    reviewed_date_time: Optional[datetime.datetime] = rest_field(
        name="reviewedDateTime", visibility=["read"], format="rfc3339"
    )
    """Date Time when a decision was taken."""
    reviewed_by: Optional["_models.AccessReviewActorIdentity"] = rest_field(name="reviewedBy", visibility=["read"])
    """Details of the approver."""
    apply_result: Optional[Union[str, "_models.AccessReviewApplyResult"]] = rest_field(
        name="applyResult", visibility=["read"]
    )
    """The outcome of applying the decision. Known values are: \"New\", \"Applying\",
     \"AppliedSuccessfully\", \"AppliedWithUnknownFailure\",
     \"AppliedSuccessfullyButObjectNotFound\", and \"ApplyNotSupported\"."""
    applied_date_time: Optional[datetime.datetime] = rest_field(
        name="appliedDateTime", visibility=["read"], format="rfc3339"
    )
    """The date and time when the review decision was applied."""
    applied_by: Optional["_models.AccessReviewActorIdentity"] = rest_field(name="appliedBy", visibility=["read"])
    """Details of the approver."""
    insights: Optional[list["_models.AccessReviewDecisionInsight"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """This is the collection of insights for this decision item."""
    principal_resource_membership: Optional["_models.AccessReviewDecisionPrincipalResourceMembership"] = rest_field(
        name="principalResourceMembership", visibility=["read"]
    )
    """Details of the membership type."""

    __flattened_items = [
        "type",
        "id",
        "display_name",
        "principal_id",
        "principal_type",
        "principal_name",
        "user_principal_name",
        "principal_id",
        "principal_type",
        "principal_name",
        "user_principal_name",
        "membership_types",
    ]

    @overload
    def __init__(
        self,
        *,
        decision: Optional[Union[str, "_models.AccessReviewResult"]] = None,
        justification: Optional[str] = None,
        insights: Optional[list["_models.AccessReviewDecisionInsight"]] = None,
    ) -> None: ...

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


class AccessReviewDecisionResource(_Model):
    """Target of the decision.

    :ivar type: The type of resource. Required. "azureRole"
    :vartype type: str or ~azure.mgmt.authorization.models.DecisionResourceType
    :ivar id: The id of resource associated with a decision record.
    :vartype id: str
    :ivar display_name: The display name of resource associated with a decision record.
    :vartype display_name: str
    """

    type: Union[str, "_models.DecisionResourceType"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of resource. Required. \"azureRole\""""
    id: Optional[str] = rest_field(visibility=["read"])
    """The id of resource associated with a decision record."""
    display_name: Optional[str] = rest_field(name="displayName", visibility=["read"])
    """The display name of resource associated with a decision record."""

    @overload
    def __init__(
        self,
        *,
        type: Union[str, "_models.DecisionResourceType"],
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewDecisionServicePrincipalIdentity(
    AccessReviewDecisionIdentity, discriminator="servicePrincipal"
):  # pylint: disable=name-too-long
    """Service Principal Decision Target.

    :ivar id: The id of principal whose access was reviewed.
    :vartype id: str
    :ivar display_name: The display name of the user whose access was reviewed.
    :vartype display_name: str
    :ivar app_id: The appId for the service principal entity being reviewed.
    :vartype app_id: str
    :ivar type: The type of decision target : User/ServicePrincipal. Required. servicePrincipal.
    :vartype type: str or ~azure.mgmt.authorization.models.SERVICE_PRINCIPAL
    """

    app_id: Optional[str] = rest_field(name="appId", visibility=["read"])
    """The appId for the service principal entity being reviewed."""
    type: Literal[DecisionTargetType.SERVICE_PRINCIPAL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of decision target : User/ServicePrincipal. Required. servicePrincipal."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.type = DecisionTargetType.SERVICE_PRINCIPAL  # type: ignore


class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity, discriminator="user"):
    """User Decision Target.

    :ivar id: The id of principal whose access was reviewed.
    :vartype id: str
    :ivar display_name: The display name of the user whose access was reviewed.
    :vartype display_name: str
    :ivar user_principal_name: The user principal name of the user whose access was reviewed.
    :vartype user_principal_name: str
    :ivar type: The type of decision target : User/ServicePrincipal. Required. user.
    :vartype type: str or ~azure.mgmt.authorization.models.USER
    """

    user_principal_name: Optional[str] = rest_field(name="userPrincipalName", visibility=["read"])
    """The user principal name of the user whose access was reviewed."""
    type: Literal[DecisionTargetType.USER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of decision target : User/ServicePrincipal. Required. user."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.type = DecisionTargetType.USER  # type: ignore


class AccessReviewDecisionUserSignInInsightProperties(
    AccessReviewDecisionInsightProperties, discriminator="userSignInInsight"
):  # pylint: disable=name-too-long
    """User Decision Target.

    :ivar insight_created_date_time: Date Time when the insight was created.
    :vartype insight_created_date_time: ~datetime.datetime
    :ivar last_sign_in_date_time: Date Time when the user signed into the tenant.
    :vartype last_sign_in_date_time: ~datetime.datetime
    :ivar type: The type of insight. Required. userSignInInsight.
    :vartype type: str or ~azure.mgmt.authorization.models.USER_SIGN_IN_INSIGHT
    """

    last_sign_in_date_time: Optional[datetime.datetime] = rest_field(
        name="lastSignInDateTime", visibility=["read"], format="rfc3339"
    )
    """Date Time when the user signed into the tenant."""
    type: Literal[AccessReviewDecisionInsightType.USER_SIGN_IN_INSIGHT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of insight. Required. userSignInInsight."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.type = AccessReviewDecisionInsightType.USER_SIGN_IN_INSIGHT  # type: ignore


class AccessReviewDefaultSettings(ProxyResource):
    """Access Review Default 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.authorization.models.SystemData
    :ivar properties: Access Review properties.
    :vartype properties: ~azure.mgmt.authorization.models.AccessReviewScheduleSettings
    """

    properties: Optional["_models.AccessReviewScheduleSettings"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review properties."""

    __flattened_items = [
        "mail_notifications_enabled",
        "reminder_notifications_enabled",
        "default_decision_enabled",
        "justification_required_on_approval",
        "default_decision",
        "auto_apply_decisions_enabled",
        "recommendations_enabled",
        "recommendation_look_back_duration",
        "instance_duration_in_days",
        "recurrence",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewHistoryDefinition(ProxyResource):
    """Access Review History Definition.

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

    properties: Optional["_models.AccessReviewHistoryDefinitionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review History Definition properties."""

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

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewHistoryDefinitionProperties(_Model):
    """Access Review History Instances.

    :ivar display_name: The display name for the history definition.
    :vartype display_name: str
    :ivar review_history_period_start_date_time: Date time used when selecting review data, all
     reviews included in data start on or after this date. For use only with one-time/non-recurring
     reports.
    :vartype review_history_period_start_date_time: ~datetime.datetime
    :ivar review_history_period_end_date_time: Date time used when selecting review data, all
     reviews included in data end on or before this date. For use only with one-time/non-recurring
     reports.
    :vartype review_history_period_end_date_time: ~datetime.datetime
    :ivar decisions: Collection of review decisions which the history data should be filtered on.
     For example if Approve and Deny are supplied the data will only contain review results in which
     the decision maker approved or denied a review request.
    :vartype decisions: list[str or ~azure.mgmt.authorization.models.AccessReviewResult]
    :ivar status: This read-only field specifies the of the requested review history data. This is
     either requested, in-progress, done or error. Known values are: "Requested", "InProgress",
     "Done", and "Error".
    :vartype status: str or ~azure.mgmt.authorization.models.AccessReviewHistoryDefinitionStatus
    :ivar created_date_time: Date time when history definition was created.
    :vartype created_date_time: ~datetime.datetime
    :ivar created_by: The user or other identity who created this history definition.
    :vartype created_by: ~azure.mgmt.authorization.models.AccessReviewActorIdentity
    :ivar scopes: A collection of scopes used when selecting review history data.
    :vartype scopes: list[~azure.mgmt.authorization.models.AccessReviewScope]
    :ivar settings: Recurrence settings for recurring history reports, skip for one-time reports.
    :vartype settings: ~azure.mgmt.authorization.models.AccessReviewHistoryScheduleSettings
    :ivar instances: Set of access review history instances for this history definition.
    :vartype instances: list[~azure.mgmt.authorization.models.AccessReviewHistoryInstance]
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The display name for the history definition."""
    review_history_period_start_date_time: Optional[datetime.datetime] = rest_field(
        name="reviewHistoryPeriodStartDateTime", visibility=["read"], format="rfc3339"
    )
    """Date time used when selecting review data, all reviews included in data start on or after this
     date. For use only with one-time/non-recurring reports."""
    review_history_period_end_date_time: Optional[datetime.datetime] = rest_field(
        name="reviewHistoryPeriodEndDateTime", visibility=["read"], format="rfc3339"
    )
    """Date time used when selecting review data, all reviews included in data end on or before this
     date. For use only with one-time/non-recurring reports."""
    decisions: Optional[list[Union[str, "_models.AccessReviewResult"]]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Collection of review decisions which the history data should be filtered on. For example if
     Approve and Deny are supplied the data will only contain review results in which the decision
     maker approved or denied a review request."""
    status: Optional[Union[str, "_models.AccessReviewHistoryDefinitionStatus"]] = rest_field(visibility=["read"])
    """This read-only field specifies the of the requested review history data. This is either
     requested, in-progress, done or error. Known values are: \"Requested\", \"InProgress\",
     \"Done\", and \"Error\"."""
    created_date_time: Optional[datetime.datetime] = rest_field(
        name="createdDateTime", visibility=["read"], format="rfc3339"
    )
    """Date time when history definition was created."""
    created_by: Optional["_models.AccessReviewActorIdentity"] = rest_field(name="createdBy", visibility=["read"])
    """The user or other identity who created this history definition."""
    scopes: Optional[list["_models.AccessReviewScope"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """A collection of scopes used when selecting review history data."""
    settings: Optional["_models.AccessReviewHistoryScheduleSettings"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Recurrence settings for recurring history reports, skip for one-time reports."""
    instances: Optional[list["_models.AccessReviewHistoryInstance"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Set of access review history instances for this history definition."""

    __flattened_items = ["principal_id", "principal_type", "principal_name", "user_principal_name"]

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        decisions: Optional[list[Union[str, "_models.AccessReviewResult"]]] = None,
        scopes: Optional[list["_models.AccessReviewScope"]] = None,
        settings: Optional["_models.AccessReviewHistoryScheduleSettings"] = None,
        instances: Optional[list["_models.AccessReviewHistoryInstance"]] = None,
    ) -> None: ...

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


class AccessReviewHistoryInstance(_Model):
    """Access Review History Definition Instance.

    :ivar id: The access review history definition instance id.
    :vartype id: str
    :ivar name: The access review history definition instance unique id.
    :vartype name: str
    :ivar type: The resource type.
    :vartype type: str
    :ivar properties: Access Review History Definition Instance properties.
    :vartype properties: ~azure.mgmt.authorization.models.AccessReviewHistoryInstanceProperties
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """The access review history definition instance id."""
    name: Optional[str] = rest_field(visibility=["read"])
    """The access review history definition instance unique id."""
    type: Optional[str] = rest_field(visibility=["read"])
    """The resource type."""
    properties: Optional["_models.AccessReviewHistoryInstanceProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review History Definition Instance properties."""

    __flattened_items = [
        "review_history_period_start_date_time",
        "review_history_period_end_date_time",
        "display_name",
        "status",
        "run_date_time",
        "fulfilled_date_time",
        "download_uri",
        "expiration",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewHistoryInstanceProperties(_Model):
    """Access Review History Definition Instance properties.

    :ivar review_history_period_start_date_time: Date time used when selecting review data, all
     reviews included in data start on or after this date. For use only with one-time/non-recurring
     reports.
    :vartype review_history_period_start_date_time: ~datetime.datetime
    :ivar review_history_period_end_date_time: Date time used when selecting review data, all
     reviews included in data end on or before this date. For use only with one-time/non-recurring
     reports.
    :vartype review_history_period_end_date_time: ~datetime.datetime
    :ivar display_name: The display name for the parent history definition.
    :vartype display_name: str
    :ivar status: Status of the requested review history instance data. This is either requested,
     in-progress, done or error. The state transitions are as follows - Requested -> InProgress ->
     Done -> Expired. Known values are: "Requested", "InProgress", "Done", and "Error".
    :vartype status: str or ~azure.mgmt.authorization.models.AccessReviewHistoryDefinitionStatus
    :ivar run_date_time: Date time when the history data report is scheduled to be generated.
    :vartype run_date_time: ~datetime.datetime
    :ivar fulfilled_date_time: Date time when the history data report is scheduled to be generated.
    :vartype fulfilled_date_time: ~datetime.datetime
    :ivar download_uri: Uri which can be used to retrieve review history data. To generate this
     Uri, generateDownloadUri() must be called for a specific accessReviewHistoryDefinitionInstance.
     The link expires after a 24 hour period. Callers can see the expiration date time by looking at
     the 'se' parameter in the generated uri.
    :vartype download_uri: str
    :ivar expiration: Date time when history data report expires and the associated data is
     deleted.
    :vartype expiration: ~datetime.datetime
    """

    review_history_period_start_date_time: Optional[datetime.datetime] = rest_field(
        name="reviewHistoryPeriodStartDateTime",
        visibility=["read", "create", "update", "delete", "query"],
        format="rfc3339",
    )
    """Date time used when selecting review data, all reviews included in data start on or after this
     date. For use only with one-time/non-recurring reports."""
    review_history_period_end_date_time: Optional[datetime.datetime] = rest_field(
        name="reviewHistoryPeriodEndDateTime",
        visibility=["read", "create", "update", "delete", "query"],
        format="rfc3339",
    )
    """Date time used when selecting review data, all reviews included in data end on or before this
     date. For use only with one-time/non-recurring reports."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The display name for the parent history definition."""
    status: Optional[Union[str, "_models.AccessReviewHistoryDefinitionStatus"]] = rest_field(visibility=["read"])
    """Status of the requested review history instance data. This is either requested, in-progress,
     done or error. The state transitions are as follows - Requested -> InProgress -> Done ->
     Expired. Known values are: \"Requested\", \"InProgress\", \"Done\", and \"Error\"."""
    run_date_time: Optional[datetime.datetime] = rest_field(
        name="runDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Date time when the history data report is scheduled to be generated."""
    fulfilled_date_time: Optional[datetime.datetime] = rest_field(
        name="fulfilledDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Date time when the history data report is scheduled to be generated."""
    download_uri: Optional[str] = rest_field(name="downloadUri", visibility=["read"])
    """Uri which can be used to retrieve review history data. To generate this Uri,
     generateDownloadUri() must be called for a specific accessReviewHistoryDefinitionInstance. The
     link expires after a 24 hour period. Callers can see the expiration date time by looking at the
     'se' parameter in the generated uri."""
    expiration: Optional[datetime.datetime] = rest_field(
        visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Date time when history data report expires and the associated data is deleted."""

    @overload
    def __init__(
        self,
        *,
        review_history_period_start_date_time: Optional[datetime.datetime] = None,
        review_history_period_end_date_time: Optional[datetime.datetime] = None,
        display_name: Optional[str] = None,
        run_date_time: Optional[datetime.datetime] = None,
        fulfilled_date_time: Optional[datetime.datetime] = None,
        expiration: 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 AccessReviewHistoryScheduleSettings(_Model):
    """Recurrence settings of an Access Review History Definition.

    :ivar pattern: Access Review History Definition recurrence settings.
    :vartype pattern: ~azure.mgmt.authorization.models.AccessReviewRecurrencePattern
    :ivar range: Access Review History Definition recurrence settings.
    :vartype range: ~azure.mgmt.authorization.models.AccessReviewRecurrenceRange
    """

    pattern: Optional["_models.AccessReviewRecurrencePattern"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review History Definition recurrence settings."""
    range: Optional["_models.AccessReviewRecurrenceRange"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review History Definition recurrence settings."""

    __flattened_items = ["type", "interval", "type", "number_of_occurrences", "start_date", "end_date"]

    @overload
    def __init__(
        self,
        *,
        pattern: Optional["_models.AccessReviewRecurrencePattern"] = None,
        range: Optional["_models.AccessReviewRecurrenceRange"] = None,
    ) -> None: ...

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


class AccessReviewInstance(ProxyResource):
    """Access Review 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.authorization.models.SystemData
    :ivar properties: Access Review properties.
    :vartype properties: ~azure.mgmt.authorization.models.AccessReviewInstanceProperties
    """

    properties: Optional["_models.AccessReviewInstanceProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review properties."""

    __flattened_items = [
        "status",
        "start_date_time",
        "end_date_time",
        "reviewers",
        "backup_reviewers",
        "reviewers_type",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewInstanceProperties(_Model):
    """Access Review Instance properties.

    :ivar status: This read-only field specifies the status of an access review instance. Known
     values are: "NotStarted", "InProgress", "Completed", "Applied", "Initializing", "Applying",
     "Completing", "Scheduled", "AutoReviewing", "AutoReviewed", and "Starting".
    :vartype status: str or ~azure.mgmt.authorization.models.AccessReviewInstanceStatus
    :ivar start_date_time: The DateTime when the review instance is scheduled to be start.
    :vartype start_date_time: ~datetime.datetime
    :ivar end_date_time: The DateTime when the review instance is scheduled to end.
    :vartype end_date_time: ~datetime.datetime
    :ivar reviewers: This is the collection of reviewers.
    :vartype reviewers: list[~azure.mgmt.authorization.models.AccessReviewReviewer]
    :ivar backup_reviewers: This is the collection of backup reviewers.
    :vartype backup_reviewers: list[~azure.mgmt.authorization.models.AccessReviewReviewer]
    :ivar reviewers_type: This field specifies the type of reviewers for a review. Usually for a
     review, reviewers are explicitly assigned. However, in some cases, the reviewers may not be
     assigned and instead be chosen dynamically. For example managers review or self review. Known
     values are: "Assigned", "Self", and "Managers".
    :vartype reviewers_type: str or
     ~azure.mgmt.authorization.models.AccessReviewInstanceReviewersType
    """

    status: Optional[Union[str, "_models.AccessReviewInstanceStatus"]] = rest_field(visibility=["read"])
    """This read-only field specifies the status of an access review instance. Known values are:
     \"NotStarted\", \"InProgress\", \"Completed\", \"Applied\", \"Initializing\", \"Applying\",
     \"Completing\", \"Scheduled\", \"AutoReviewing\", \"AutoReviewed\", and \"Starting\"."""
    start_date_time: Optional[datetime.datetime] = rest_field(
        name="startDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The DateTime when the review instance is scheduled to be start."""
    end_date_time: Optional[datetime.datetime] = rest_field(
        name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The DateTime when the review instance is scheduled to end."""
    reviewers: Optional[list["_models.AccessReviewReviewer"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """This is the collection of reviewers."""
    backup_reviewers: Optional[list["_models.AccessReviewReviewer"]] = rest_field(
        name="backupReviewers", visibility=["read", "create", "update", "delete", "query"]
    )
    """This is the collection of backup reviewers."""
    reviewers_type: Optional[Union[str, "_models.AccessReviewInstanceReviewersType"]] = rest_field(
        name="reviewersType", visibility=["read"]
    )
    """This field specifies the type of reviewers for a review. Usually for a review, reviewers are
     explicitly assigned. However, in some cases, the reviewers may not be assigned and instead be
     chosen dynamically. For example managers review or self review. Known values are: \"Assigned\",
     \"Self\", and \"Managers\"."""

    @overload
    def __init__(
        self,
        *,
        start_date_time: Optional[datetime.datetime] = None,
        end_date_time: Optional[datetime.datetime] = None,
        reviewers: Optional[list["_models.AccessReviewReviewer"]] = None,
        backup_reviewers: Optional[list["_models.AccessReviewReviewer"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewRecurrencePattern(_Model):
    """Recurrence Pattern of an Access Review Schedule Definition.

    :ivar type: The recurrence type : weekly, monthly, etc. Known values are: "weekly" and
     "absoluteMonthly".
    :vartype type: str or ~azure.mgmt.authorization.models.AccessReviewRecurrencePatternType
    :ivar interval: The interval for recurrence. For a quarterly review, the interval is 3 for type
     : absoluteMonthly.
    :vartype interval: int
    """

    type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The recurrence type : weekly, monthly, etc. Known values are: \"weekly\" and
     \"absoluteMonthly\"."""
    interval: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The interval for recurrence. For a quarterly review, the interval is 3 for type :
     absoluteMonthly."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.AccessReviewRecurrencePatternType"]] = None,
        interval: 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 AccessReviewRecurrenceRange(_Model):
    """Recurrence Range of an Access Review Schedule Definition.

    :ivar type: The recurrence range type. The possible values are: endDate, noEnd, numbered. Known
     values are: "endDate", "noEnd", and "numbered".
    :vartype type: str or ~azure.mgmt.authorization.models.AccessReviewRecurrenceRangeType
    :ivar number_of_occurrences: The number of times to repeat the access review. Required and must
     be positive if type is numbered.
    :vartype number_of_occurrences: int
    :ivar start_date: The DateTime when the review is scheduled to be start. This could be a date
     in the future. Required on create.
    :vartype start_date: ~datetime.datetime
    :ivar end_date: The DateTime when the review is scheduled to end. Required if type is endDate.
    :vartype end_date: ~datetime.datetime
    """

    type: Optional[Union[str, "_models.AccessReviewRecurrenceRangeType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The recurrence range type. The possible values are: endDate, noEnd, numbered. Known values are:
     \"endDate\", \"noEnd\", and \"numbered\"."""
    number_of_occurrences: Optional[int] = rest_field(
        name="numberOfOccurrences", visibility=["read", "create", "update", "delete", "query"]
    )
    """The number of times to repeat the access review. Required and must be positive if type is
     numbered."""
    start_date: Optional[datetime.datetime] = rest_field(
        name="startDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The DateTime when the review is scheduled to be start. This could be a date in the future.
     Required on create."""
    end_date: Optional[datetime.datetime] = rest_field(
        name="endDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The DateTime when the review is scheduled to end. Required if type is endDate."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.AccessReviewRecurrenceRangeType"]] = None,
        number_of_occurrences: Optional[int] = None,
        start_date: Optional[datetime.datetime] = None,
        end_date: 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 AccessReviewRecurrenceSettings(_Model):
    """Recurrence Settings of an Access Review Schedule Definition.

    :ivar pattern: Access Review schedule definition recurrence pattern.
    :vartype pattern: ~azure.mgmt.authorization.models.AccessReviewRecurrencePattern
    :ivar range: Access Review schedule definition recurrence range.
    :vartype range: ~azure.mgmt.authorization.models.AccessReviewRecurrenceRange
    """

    pattern: Optional["_models.AccessReviewRecurrencePattern"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review schedule definition recurrence pattern."""
    range: Optional["_models.AccessReviewRecurrenceRange"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review schedule definition recurrence range."""

    __flattened_items = ["type", "interval", "type", "number_of_occurrences", "start_date", "end_date"]

    @overload
    def __init__(
        self,
        *,
        pattern: Optional["_models.AccessReviewRecurrencePattern"] = None,
        range: Optional["_models.AccessReviewRecurrenceRange"] = None,
    ) -> None: ...

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


class AccessReviewReviewer(_Model):
    """Descriptor for what needs to be reviewed.

    :ivar principal_id: The id of the reviewer(user/servicePrincipal).
    :vartype principal_id: str
    :ivar principal_type: The identity type : user/servicePrincipal. Known values are: "user" and
     "servicePrincipal".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.AccessReviewReviewerType
    """

    principal_id: Optional[str] = rest_field(
        name="principalId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The id of the reviewer(user/servicePrincipal)."""
    principal_type: Optional[Union[str, "_models.AccessReviewReviewerType"]] = rest_field(
        name="principalType", visibility=["read"]
    )
    """The identity type : user/servicePrincipal. Known values are: \"user\" and \"servicePrincipal\"."""

    @overload
    def __init__(
        self,
        *,
        principal_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 AccessReviewScheduleDefinition(ProxyResource):
    """Access Review Schedule Definition.

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

    properties: Optional["_models.AccessReviewScheduleDefinitionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review properties."""

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

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewScheduleDefinitionProperties(_Model):
    """Access Review.

    :ivar display_name: The display name for the schedule definition.
    :vartype display_name: str
    :ivar status: This read-only field specifies the status of an accessReview. Known values are:
     "NotStarted", "InProgress", "Completed", "Applied", "Initializing", "Applying", "Completing",
     "Scheduled", "AutoReviewing", "AutoReviewed", and "Starting".
    :vartype status: str or ~azure.mgmt.authorization.models.AccessReviewScheduleDefinitionStatus
    :ivar description_for_admins: The description provided by the access review creator and visible
     to admins.
    :vartype description_for_admins: str
    :ivar description_for_reviewers: The description provided by the access review creator to be
     shown to reviewers.
    :vartype description_for_reviewers: str
    :ivar created_by: The user or other identity who created this review.
    :vartype created_by: ~azure.mgmt.authorization.models.AccessReviewActorIdentity
    :ivar settings: Access Review Settings.
    :vartype settings: ~azure.mgmt.authorization.models.AccessReviewScheduleSettings
    :ivar scope: This is used to define what to include in scope of the review. The scope
     definition includes the resourceId and roleDefinitionId.
    :vartype scope: ~azure.mgmt.authorization.models.AccessReviewScope
    :ivar reviewers: This is the collection of reviewers.
    :vartype reviewers: list[~azure.mgmt.authorization.models.AccessReviewReviewer]
    :ivar backup_reviewers: This is the collection of backup reviewers.
    :vartype backup_reviewers: list[~azure.mgmt.authorization.models.AccessReviewReviewer]
    :ivar reviewers_type: This field specifies the type of reviewers for a review. Usually for a
     review, reviewers are explicitly assigned. However, in some cases, the reviewers may not be
     assigned and instead be chosen dynamically. For example managers review or self review. Known
     values are: "Assigned", "Self", and "Managers".
    :vartype reviewers_type: str or
     ~azure.mgmt.authorization.models.AccessReviewScheduleDefinitionReviewersType
    :ivar instances: This is the collection of instances returned when one does an expand on it.
    :vartype instances: list[~azure.mgmt.authorization.models.AccessReviewInstance]
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The display name for the schedule definition."""
    status: Optional[Union[str, "_models.AccessReviewScheduleDefinitionStatus"]] = rest_field(visibility=["read"])
    """This read-only field specifies the status of an accessReview. Known values are: \"NotStarted\",
     \"InProgress\", \"Completed\", \"Applied\", \"Initializing\", \"Applying\", \"Completing\",
     \"Scheduled\", \"AutoReviewing\", \"AutoReviewed\", and \"Starting\"."""
    description_for_admins: Optional[str] = rest_field(
        name="descriptionForAdmins", visibility=["read", "create", "update", "delete", "query"]
    )
    """The description provided by the access review creator and visible to admins."""
    description_for_reviewers: Optional[str] = rest_field(
        name="descriptionForReviewers", visibility=["read", "create", "update", "delete", "query"]
    )
    """The description provided by the access review creator to be shown to reviewers."""
    created_by: Optional["_models.AccessReviewActorIdentity"] = rest_field(name="createdBy", visibility=["read"])
    """The user or other identity who created this review."""
    settings: Optional["_models.AccessReviewScheduleSettings"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review Settings."""
    scope: Optional["_models.AccessReviewScope"] = rest_field(visibility=["read"])
    """This is used to define what to include in scope of the review. The scope definition includes
     the resourceId and roleDefinitionId."""
    reviewers: Optional[list["_models.AccessReviewReviewer"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """This is the collection of reviewers."""
    backup_reviewers: Optional[list["_models.AccessReviewReviewer"]] = rest_field(
        name="backupReviewers", visibility=["read", "create", "update", "delete", "query"]
    )
    """This is the collection of backup reviewers."""
    reviewers_type: Optional[Union[str, "_models.AccessReviewScheduleDefinitionReviewersType"]] = rest_field(
        name="reviewersType", visibility=["read"]
    )
    """This field specifies the type of reviewers for a review. Usually for a review, reviewers are
     explicitly assigned. However, in some cases, the reviewers may not be assigned and instead be
     chosen dynamically. For example managers review or self review. Known values are: \"Assigned\",
     \"Self\", and \"Managers\"."""
    instances: Optional[list["_models.AccessReviewInstance"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """This is the collection of instances returned when one does an expand on it."""

    __flattened_items = [
        "principal_id",
        "principal_type",
        "principal_name",
        "user_principal_name",
        "mail_notifications_enabled",
        "reminder_notifications_enabled",
        "default_decision_enabled",
        "justification_required_on_approval",
        "default_decision",
        "auto_apply_decisions_enabled",
        "recommendations_enabled",
        "recommendation_look_back_duration",
        "instance_duration_in_days",
        "recurrence",
        "resource_id",
        "role_definition_id",
        "principal_type",
        "assignment_state",
        "inactive_duration",
        "expand_nested_memberships",
        "include_inherited_access",
        "include_access_below_resource",
        "exclude_resource_id",
        "exclude_role_definition_id",
    ]

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        description_for_admins: Optional[str] = None,
        description_for_reviewers: Optional[str] = None,
        settings: Optional["_models.AccessReviewScheduleSettings"] = None,
        reviewers: Optional[list["_models.AccessReviewReviewer"]] = None,
        backup_reviewers: Optional[list["_models.AccessReviewReviewer"]] = None,
        instances: Optional[list["_models.AccessReviewInstance"]] = None,
    ) -> None: ...

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


class AccessReviewScheduleSettings(_Model):
    """Settings of an Access Review.

    :ivar mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the
     review creator is enabled.
    :vartype mail_notifications_enabled: bool
    :ivar reminder_notifications_enabled: Flag to indicate whether sending reminder emails to
     reviewers are enabled.
    :vartype reminder_notifications_enabled: bool
    :ivar default_decision_enabled: Flag to indicate whether reviewers are required to provide a
     justification when reviewing access.
    :vartype default_decision_enabled: bool
    :ivar justification_required_on_approval: Flag to indicate whether the reviewer is required to
     pass justification when recording a decision.
    :vartype justification_required_on_approval: bool
    :ivar default_decision: This specifies the behavior for the autoReview feature when an access
     review completes. Known values are: "Approve", "Deny", and "Recommendation".
    :vartype default_decision: str or ~azure.mgmt.authorization.models.DefaultDecisionType
    :ivar auto_apply_decisions_enabled: Flag to indicate whether auto-apply capability, to
     automatically change the target object access resource, is enabled. If not enabled, a user
     must, after the review completes, apply the access review.
    :vartype auto_apply_decisions_enabled: bool
    :ivar recommendations_enabled: Flag to indicate whether showing recommendations to reviewers is
     enabled.
    :vartype recommendations_enabled: bool
    :ivar recommendation_look_back_duration: Recommendations for access reviews are calculated by
     looking back at 30 days of data(w.r.t the start date of the review) by default. However, in
     some scenarios, customers want to change how far back to look at and want to configure 60 days,
     90 days, etc. instead. This setting allows customers to configure this duration. The value
     should be in ISO  8601 format (`http://en.wikipedia.org/wiki/ISO_8601#Durations).This
     <http://en.wikipedia.org/wiki/ISO_8601#Durations).This>`_ code can be used to convert TimeSpan
     to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)).
    :vartype recommendation_look_back_duration: ~datetime.timedelta
    :ivar instance_duration_in_days: The duration in days for an instance.
    :vartype instance_duration_in_days: int
    :ivar recurrence: Access Review Settings.
    :vartype recurrence: ~azure.mgmt.authorization.models.AccessReviewRecurrenceSettings
    """

    mail_notifications_enabled: Optional[bool] = rest_field(
        name="mailNotificationsEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether sending mails to reviewers and the review creator is enabled."""
    reminder_notifications_enabled: Optional[bool] = rest_field(
        name="reminderNotificationsEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether sending reminder emails to reviewers are enabled."""
    default_decision_enabled: Optional[bool] = rest_field(
        name="defaultDecisionEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether reviewers are required to provide a justification when reviewing
     access."""
    justification_required_on_approval: Optional[bool] = rest_field(
        name="justificationRequiredOnApproval", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether the reviewer is required to pass justification when recording a
     decision."""
    default_decision: Optional[Union[str, "_models.DefaultDecisionType"]] = rest_field(
        name="defaultDecision", visibility=["read", "create", "update", "delete", "query"]
    )
    """This specifies the behavior for the autoReview feature when an access review completes. Known
     values are: \"Approve\", \"Deny\", and \"Recommendation\"."""
    auto_apply_decisions_enabled: Optional[bool] = rest_field(
        name="autoApplyDecisionsEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether auto-apply capability, to automatically change the target object
     access resource, is enabled. If not enabled, a user must, after the review completes, apply the
     access review."""
    recommendations_enabled: Optional[bool] = rest_field(
        name="recommendationsEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether showing recommendations to reviewers is enabled."""
    recommendation_look_back_duration: Optional[datetime.timedelta] = rest_field(
        name="recommendationLookBackDuration", visibility=["read", "create", "update", "delete", "query"]
    )
    """Recommendations for access reviews are calculated by looking back at 30 days of data(w.r.t the
     start date of the review) by default. However, in some scenarios, customers want to change how
     far back to look at and want to configure 60 days, 90 days, etc. instead. This setting allows
     customers to configure this duration. The value should be in ISO  8601 format
     (`http://en.wikipedia.org/wiki/ISO_8601#Durations).This
     <http://en.wikipedia.org/wiki/ISO_8601#Durations).This>`_ code can be used to convert TimeSpan
     to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds))."""
    instance_duration_in_days: Optional[int] = rest_field(
        name="instanceDurationInDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """The duration in days for an instance."""
    recurrence: Optional["_models.AccessReviewRecurrenceSettings"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Access Review Settings."""

    @overload
    def __init__(
        self,
        *,
        mail_notifications_enabled: Optional[bool] = None,
        reminder_notifications_enabled: Optional[bool] = None,
        default_decision_enabled: Optional[bool] = None,
        justification_required_on_approval: Optional[bool] = None,
        default_decision: Optional[Union[str, "_models.DefaultDecisionType"]] = None,
        auto_apply_decisions_enabled: Optional[bool] = None,
        recommendations_enabled: Optional[bool] = None,
        recommendation_look_back_duration: Optional[datetime.timedelta] = None,
        instance_duration_in_days: Optional[int] = None,
        recurrence: Optional["_models.AccessReviewRecurrenceSettings"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 AccessReviewScope(_Model):
    """Descriptor for what needs to be reviewed.

    :ivar resource_id: ResourceId in which this review is getting created.
    :vartype resource_id: str
    :ivar role_definition_id: This is used to indicate the role being reviewed.
    :vartype role_definition_id: str
    :ivar principal_type: The identity type user/servicePrincipal to review. Known values are:
     "user", "guestUser", "servicePrincipal", "user,group", and "redeemedGuestUser".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.AccessReviewScopePrincipalType
    :ivar assignment_state: The role assignment state eligible/active to review. Known values are:
     "eligible" and "active".
    :vartype assignment_state: str or
     ~azure.mgmt.authorization.models.AccessReviewScopeAssignmentState
    :ivar inactive_duration: Duration users are inactive for. The value should be in ISO  8601
     format (`http://en.wikipedia.org/wiki/ISO_8601#Durations).This
     <http://en.wikipedia.org/wiki/ISO_8601#Durations).This>`_ code can be used to convert TimeSpan
     to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)).
    :vartype inactive_duration: ~datetime.timedelta
    :ivar expand_nested_memberships: Flag to indicate whether to expand nested memberships or not.
    :vartype expand_nested_memberships: bool
    :ivar include_inherited_access: Flag to indicate whether to expand nested memberships or not.
    :vartype include_inherited_access: bool
    :ivar include_access_below_resource: Flag to indicate whether to expand nested memberships or
     not.
    :vartype include_access_below_resource: bool
    :ivar exclude_resource_id: This is used to indicate the resource id(s) to exclude.
    :vartype exclude_resource_id: str
    :ivar exclude_role_definition_id: This is used to indicate the role definition id(s) to
     exclude.
    :vartype exclude_role_definition_id: str
    """

    resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"])
    """ResourceId in which this review is getting created."""
    role_definition_id: Optional[str] = rest_field(name="roleDefinitionId", visibility=["read"])
    """This is used to indicate the role being reviewed."""
    principal_type: Optional[Union[str, "_models.AccessReviewScopePrincipalType"]] = rest_field(
        name="principalType", visibility=["read"]
    )
    """The identity type user/servicePrincipal to review. Known values are: \"user\", \"guestUser\",
     \"servicePrincipal\", \"user,group\", and \"redeemedGuestUser\"."""
    assignment_state: Optional[Union[str, "_models.AccessReviewScopeAssignmentState"]] = rest_field(
        name="assignmentState", visibility=["read"]
    )
    """The role assignment state eligible/active to review. Known values are: \"eligible\" and
     \"active\"."""
    inactive_duration: Optional[datetime.timedelta] = rest_field(
        name="inactiveDuration", visibility=["read", "create", "update", "delete", "query"]
    )
    """Duration users are inactive for. The value should be in ISO  8601 format
     (`http://en.wikipedia.org/wiki/ISO_8601#Durations).This
     <http://en.wikipedia.org/wiki/ISO_8601#Durations).This>`_ code can be used to convert TimeSpan
     to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds))."""
    expand_nested_memberships: Optional[bool] = rest_field(
        name="expandNestedMemberships", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether to expand nested memberships or not."""
    include_inherited_access: Optional[bool] = rest_field(
        name="includeInheritedAccess", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether to expand nested memberships or not."""
    include_access_below_resource: Optional[bool] = rest_field(
        name="includeAccessBelowResource", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag to indicate whether to expand nested memberships or not."""
    exclude_resource_id: Optional[str] = rest_field(
        name="excludeResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """This is used to indicate the resource id(s) to exclude."""
    exclude_role_definition_id: Optional[str] = rest_field(
        name="excludeRoleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """This is used to indicate the role definition id(s) to exclude."""

    @overload
    def __init__(
        self,
        *,
        inactive_duration: Optional[datetime.timedelta] = None,
        expand_nested_memberships: Optional[bool] = None,
        include_inherited_access: Optional[bool] = None,
        include_access_below_resource: Optional[bool] = None,
        exclude_resource_id: Optional[str] = None,
        exclude_role_definition_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 ExtensionResource(Resource):
    """The base extension 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.authorization.models.SystemData
    """


class Alert(ExtensionResource):
    """The alert.

    :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.authorization.models.SystemData
    :ivar properties: Alert properties.
    :vartype properties: ~azure.mgmt.authorization.models.AlertProperties
    """

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

    __flattened_items = [
        "scope",
        "is_active",
        "incident_count",
        "last_modified_date_time",
        "last_scanned_date_time",
        "alert_definition",
        "alert_incidents",
        "alert_configuration",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 AlertConfiguration(ExtensionResource):
    """Alert configuration.

    :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.authorization.models.SystemData
    :ivar properties: Alert configuration properties.
    :vartype properties: ~azure.mgmt.authorization.models.AlertConfigurationProperties
    """

    properties: Optional["_models.AlertConfigurationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Alert configuration properties."""

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

    @overload
    def __init__(self, mapping: Mapping[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 AlertConfigurationProperties(_Model):
    """Alert configuration properties.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    AzureRolesAssignedOutsidePimAlertConfigurationProperties,
    DuplicateRoleCreatedAlertConfigurationProperties,
    TooManyOwnersAssignedToResourceAlertConfigurationProperties,
    TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties

    :ivar alert_definition_id: The alert definition ID.
    :vartype alert_definition_id: str
    :ivar scope: The alert scope.
    :vartype scope: str
    :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the
     specific alert.
    :vartype is_enabled: bool
    :ivar alert_configuration_type: The alert configuration type. Required. Default value is None.
    :vartype alert_configuration_type: str
    :ivar alert_definition: The alert definition.
    :vartype alert_definition: ~azure.mgmt.authorization.models.AlertDefinition
    """

    __mapping__: dict[str, _Model] = {}
    alert_definition_id: Optional[str] = rest_field(name="alertDefinitionId", visibility=["read"])
    """The alert definition ID."""
    scope: Optional[str] = rest_field(visibility=["read"])
    """The alert scope."""
    is_enabled: Optional[bool] = rest_field(
        name="isEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """True if the alert is enabled, false will disable the scanning for the specific alert."""
    alert_configuration_type: str = rest_discriminator(
        name="alertConfigurationType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The alert configuration type. Required. Default value is None."""
    alert_definition: Optional["_models.AlertDefinition"] = rest_field(name="alertDefinition", visibility=["read"])
    """The alert definition."""

    @overload
    def __init__(
        self,
        *,
        alert_configuration_type: str,
        is_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 AlertDefinition(ExtensionResource):
    """Alert definition.

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

    properties: Optional["_models.AlertDefinitionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Alert definition properties."""

    __flattened_items = [
        "display_name",
        "scope",
        "description",
        "severity_level",
        "security_impact",
        "mitigation_steps",
        "how_to_prevent",
        "is_remediatable",
        "is_configurable",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 AlertDefinitionProperties(_Model):
    """Alert definition properties.

    :ivar display_name: The alert display name.
    :vartype display_name: str
    :ivar scope: The alert scope.
    :vartype scope: str
    :ivar description: The alert description.
    :vartype description: str
    :ivar severity_level: Severity level of the alert. Known values are: "Low", "Medium", and
     "High".
    :vartype severity_level: str or ~azure.mgmt.authorization.models.SeverityLevel
    :ivar security_impact: Security impact of the alert.
    :vartype security_impact: str
    :ivar mitigation_steps: The methods to mitigate the alert.
    :vartype mitigation_steps: str
    :ivar how_to_prevent: The ways to prevent the alert.
    :vartype how_to_prevent: str
    :ivar is_remediatable: True if the alert can be remediated; false, otherwise.
    :vartype is_remediatable: bool
    :ivar is_configurable: True if the alert configuration can be configured; false, otherwise.
    :vartype is_configurable: bool
    """

    display_name: Optional[str] = rest_field(name="displayName", visibility=["read"])
    """The alert display name."""
    scope: Optional[str] = rest_field(visibility=["read"])
    """The alert scope."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The alert description."""
    severity_level: Optional[Union[str, "_models.SeverityLevel"]] = rest_field(
        name="severityLevel", visibility=["read"]
    )
    """Severity level of the alert. Known values are: \"Low\", \"Medium\", and \"High\"."""
    security_impact: Optional[str] = rest_field(name="securityImpact", visibility=["read"])
    """Security impact of the alert."""
    mitigation_steps: Optional[str] = rest_field(name="mitigationSteps", visibility=["read"])
    """The methods to mitigate the alert."""
    how_to_prevent: Optional[str] = rest_field(name="howToPrevent", visibility=["read"])
    """The ways to prevent the alert."""
    is_remediatable: Optional[bool] = rest_field(name="isRemediatable", visibility=["read"])
    """True if the alert can be remediated; false, otherwise."""
    is_configurable: Optional[bool] = rest_field(name="isConfigurable", visibility=["read"])
    """True if the alert configuration can be configured; false, otherwise."""


class AlertIncident(ExtensionResource):
    """Alert incident.

    :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.authorization.models.SystemData
    :ivar properties: Alert incident properties.
    :vartype properties: ~azure.mgmt.authorization.models.AlertIncidentProperties
    """

    properties: Optional["_models.AlertIncidentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Alert incident properties."""

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

    @overload
    def __init__(self, mapping: Mapping[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 AlertIncidentProperties(_Model):
    """Alert incident properties.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    AzureRolesAssignedOutsidePimAlertIncidentProperties,
    DuplicateRoleCreatedAlertIncidentProperties,
    TooManyOwnersAssignedToResourceAlertIncidentProperties,
    TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties

    :ivar alert_incident_type: The alert incident type. Required. Default value is None.
    :vartype alert_incident_type: str
    """

    __mapping__: dict[str, _Model] = {}
    alert_incident_type: str = rest_discriminator(
        name="alertIncidentType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The alert incident type. Required. Default value is None."""

    @overload
    def __init__(
        self,
        *,
        alert_incident_type: 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 AlertOperationResult(_Model):
    """Alert operation result.

    :ivar id: The id of the alert operation.
    :vartype id: str
    :ivar status: The status of the alert operation.
    :vartype status: str
    :ivar status_detail: The status detail of the alert operation.
    :vartype status_detail: str
    :ivar created_date_time: The created date of the alert operation.
    :vartype created_date_time: ~datetime.datetime
    :ivar last_action_date_time: The last action date of the alert operation.
    :vartype last_action_date_time: ~datetime.datetime
    :ivar resource_location: The location of the alert associated with the operation.
    :vartype resource_location: str
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """The id of the alert operation."""
    status: Optional[str] = rest_field(visibility=["read"])
    """The status of the alert operation."""
    status_detail: Optional[str] = rest_field(name="statusDetail", visibility=["read"])
    """The status detail of the alert operation."""
    created_date_time: Optional[datetime.datetime] = rest_field(
        name="createdDateTime", visibility=["read"], format="rfc3339"
    )
    """The created date of the alert operation."""
    last_action_date_time: Optional[datetime.datetime] = rest_field(
        name="lastActionDateTime", visibility=["read"], format="rfc3339"
    )
    """The last action date of the alert operation."""
    resource_location: Optional[str] = rest_field(name="resourceLocation", visibility=["read"])
    """The location of the alert associated with the operation."""


class AlertProperties(_Model):
    """Alert properties.

    :ivar scope: The alert scope.
    :vartype scope: str
    :ivar is_active: False by default; true if the alert is active.
    :vartype is_active: bool
    :ivar incident_count: The number of generated incidents of the alert.
    :vartype incident_count: int
    :ivar last_modified_date_time: The date time when the alert configuration was updated or new
     incidents were generated.
    :vartype last_modified_date_time: ~datetime.datetime
    :ivar last_scanned_date_time: The date time when the alert was last scanned.
    :vartype last_scanned_date_time: ~datetime.datetime
    :ivar alert_definition: The alert definition.
    :vartype alert_definition: ~azure.mgmt.authorization.models.AlertDefinition
    :ivar alert_incidents: The alert incidents.
    :vartype alert_incidents: list[~azure.mgmt.authorization.models.AlertIncident]
    :ivar alert_configuration: The alert configuration.
    :vartype alert_configuration: ~azure.mgmt.authorization.models.AlertConfiguration
    """

    scope: Optional[str] = rest_field(visibility=["read"])
    """The alert scope."""
    is_active: Optional[bool] = rest_field(name="isActive", visibility=["read", "create", "update", "delete", "query"])
    """False by default; true if the alert is active."""
    incident_count: Optional[int] = rest_field(name="incidentCount", visibility=["read"])
    """The number of generated incidents of the alert."""
    last_modified_date_time: Optional[datetime.datetime] = rest_field(
        name="lastModifiedDateTime", visibility=["read"], format="rfc3339"
    )
    """The date time when the alert configuration was updated or new incidents were generated."""
    last_scanned_date_time: Optional[datetime.datetime] = rest_field(
        name="lastScannedDateTime", visibility=["read"], format="rfc3339"
    )
    """The date time when the alert was last scanned."""
    alert_definition: Optional["_models.AlertDefinition"] = rest_field(name="alertDefinition", visibility=["read"])
    """The alert definition."""
    alert_incidents: Optional[list["_models.AlertIncident"]] = rest_field(name="alertIncidents", visibility=["read"])
    """The alert incidents."""
    alert_configuration: Optional["_models.AlertConfiguration"] = rest_field(
        name="alertConfiguration", visibility=["read"]
    )
    """The alert configuration."""

    @overload
    def __init__(
        self,
        *,
        is_active: 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 ApprovalSettings(_Model):
    """The approval settings.

    :ivar is_approval_required: Determines whether approval is required or not.
    :vartype is_approval_required: bool
    :ivar is_approval_required_for_extension: Determines whether approval is required for
     assignment extension.
    :vartype is_approval_required_for_extension: bool
    :ivar is_requestor_justification_required: Determine whether requestor justification is
     required.
    :vartype is_requestor_justification_required: bool
    :ivar approval_mode: The type of rule. Known values are: "SingleStage", "Serial", "Parallel",
     and "NoApproval".
    :vartype approval_mode: str or ~azure.mgmt.authorization.models.ApprovalMode
    :ivar approval_stages: The approval stages of the request.
    :vartype approval_stages: list[~azure.mgmt.authorization.models.ApprovalStage]
    """

    is_approval_required: Optional[bool] = rest_field(
        name="isApprovalRequired", visibility=["read", "create", "update", "delete", "query"]
    )
    """Determines whether approval is required or not."""
    is_approval_required_for_extension: Optional[bool] = rest_field(
        name="isApprovalRequiredForExtension", visibility=["read", "create", "update", "delete", "query"]
    )
    """Determines whether approval is required for assignment extension."""
    is_requestor_justification_required: Optional[bool] = rest_field(
        name="isRequestorJustificationRequired", visibility=["read", "create", "update", "delete", "query"]
    )
    """Determine whether requestor justification is required."""
    approval_mode: Optional[Union[str, "_models.ApprovalMode"]] = rest_field(
        name="approvalMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of rule. Known values are: \"SingleStage\", \"Serial\", \"Parallel\", and
     \"NoApproval\"."""
    approval_stages: Optional[list["_models.ApprovalStage"]] = rest_field(
        name="approvalStages", visibility=["read", "create", "update", "delete", "query"]
    )
    """The approval stages of the request."""

    @overload
    def __init__(
        self,
        *,
        is_approval_required: Optional[bool] = None,
        is_approval_required_for_extension: Optional[bool] = None,
        is_requestor_justification_required: Optional[bool] = None,
        approval_mode: Optional[Union[str, "_models.ApprovalMode"]] = None,
        approval_stages: Optional[list["_models.ApprovalStage"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 ApprovalStage(_Model):
    """The approval stage.

    :ivar approval_stage_time_out_in_days: The time in days when approval request would be timed
     out.
    :vartype approval_stage_time_out_in_days: int
    :ivar is_approver_justification_required: Determines whether approver need to provide
     justification for his decision.
    :vartype is_approver_justification_required: bool
    :ivar escalation_time_in_minutes: The time in minutes when the approval request would be
     escalated if the primary approver does not approve.
    :vartype escalation_time_in_minutes: int
    :ivar primary_approvers: The primary approver of the request.
    :vartype primary_approvers: list[~azure.mgmt.authorization.models.UserSet]
    :ivar is_escalation_enabled: The value determine whether escalation feature is enabled.
    :vartype is_escalation_enabled: bool
    :ivar escalation_approvers: The escalation approver of the request.
    :vartype escalation_approvers: list[~azure.mgmt.authorization.models.UserSet]
    """

    approval_stage_time_out_in_days: Optional[int] = rest_field(
        name="approvalStageTimeOutInDays", visibility=["read", "create", "update", "delete", "query"]
    )
    """The time in days when approval request would be timed out."""
    is_approver_justification_required: Optional[bool] = rest_field(
        name="isApproverJustificationRequired", visibility=["read", "create", "update", "delete", "query"]
    )
    """Determines whether approver need to provide justification for his decision."""
    escalation_time_in_minutes: Optional[int] = rest_field(
        name="escalationTimeInMinutes", visibility=["read", "create", "update", "delete", "query"]
    )
    """The time in minutes when the approval request would be escalated if the primary approver does
     not approve."""
    primary_approvers: Optional[list["_models.UserSet"]] = rest_field(
        name="primaryApprovers", visibility=["read", "create", "update", "delete", "query"]
    )
    """The primary approver of the request."""
    is_escalation_enabled: Optional[bool] = rest_field(
        name="isEscalationEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """The value determine whether escalation feature is enabled."""
    escalation_approvers: Optional[list["_models.UserSet"]] = rest_field(
        name="escalationApprovers", visibility=["read", "create", "update", "delete", "query"]
    )
    """The escalation approver of the request."""

    @overload
    def __init__(
        self,
        *,
        approval_stage_time_out_in_days: Optional[int] = None,
        is_approver_justification_required: Optional[bool] = None,
        escalation_time_in_minutes: Optional[int] = None,
        primary_approvers: Optional[list["_models.UserSet"]] = None,
        is_escalation_enabled: Optional[bool] = None,
        escalation_approvers: Optional[list["_models.UserSet"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 AttributeNamespace(ProxyResource):
    """An attribute namespace 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.authorization.models.SystemData
    """


class AttributeNamespaceCreateRequest(_Model):
    """Request body for creating an attribute namespace.

    :ivar namespace_owner_principal_id: The principal ID of the namespace owner. Required.
    :vartype namespace_owner_principal_id: str
    """

    namespace_owner_principal_id: str = rest_field(
        name="namespaceOwnerPrincipalId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal ID of the namespace owner. Required."""

    @overload
    def __init__(
        self,
        *,
        namespace_owner_principal_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 AzureRolesAssignedOutsidePimAlertConfigurationProperties(
    AlertConfigurationProperties, discriminator="AzureRolesAssignedOutsidePimAlertConfiguration"
):  # pylint: disable=name-too-long
    """The Azure roles assigned outside PIM alert configuration properties.

    :ivar alert_definition_id: The alert definition ID.
    :vartype alert_definition_id: str
    :ivar scope: The alert scope.
    :vartype scope: str
    :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the
     specific alert.
    :vartype is_enabled: bool
    :ivar alert_definition: The alert definition.
    :vartype alert_definition: ~azure.mgmt.authorization.models.AlertDefinition
    :ivar alert_configuration_type: The alert configuration type. Required. Default value is
     "AzureRolesAssignedOutsidePimAlertConfiguration".
    :vartype alert_configuration_type: str
    """

    alert_configuration_type: Literal["AzureRolesAssignedOutsidePimAlertConfiguration"] = rest_discriminator(name="alertConfigurationType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The alert configuration type. Required. Default value is
     \"AzureRolesAssignedOutsidePimAlertConfiguration\"."""

    @overload
    def __init__(
        self,
        *,
        is_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)
        self.alert_configuration_type = "AzureRolesAssignedOutsidePimAlertConfiguration"  # type: ignore


class AzureRolesAssignedOutsidePimAlertIncidentProperties(
    AlertIncidentProperties, discriminator="AzureRolesAssignedOutsidePimAlertIncident"
):  # pylint: disable=name-too-long
    """Azure roles assigned outside PIM alert incident properties.

    :ivar assignee_display_name: The assignee display name.
    :vartype assignee_display_name: str
    :ivar assignee_user_principal_name: The assignee user principal name.
    :vartype assignee_user_principal_name: str
    :ivar assignee_id: The assignee ID.
    :vartype assignee_id: str
    :ivar role_display_name: The role display name.
    :vartype role_display_name: str
    :ivar role_template_id: The role template ID.
    :vartype role_template_id: str
    :ivar role_definition_id: The role definition ID.
    :vartype role_definition_id: str
    :ivar assignment_activated_date: The date the assignment was activated.
    :vartype assignment_activated_date: ~datetime.datetime
    :ivar requestor_id: The requestor ID.
    :vartype requestor_id: str
    :ivar requestor_display_name: The requestor display name.
    :vartype requestor_display_name: str
    :ivar requestor_user_principal_name: The requestor user principal name.
    :vartype requestor_user_principal_name: str
    :ivar alert_incident_type: The alert incident type. Required. Default value is
     "AzureRolesAssignedOutsidePimAlertIncident".
    :vartype alert_incident_type: str
    """

    assignee_display_name: Optional[str] = rest_field(name="assigneeDisplayName", visibility=["read"])
    """The assignee display name."""
    assignee_user_principal_name: Optional[str] = rest_field(name="assigneeUserPrincipalName", visibility=["read"])
    """The assignee user principal name."""
    assignee_id: Optional[str] = rest_field(name="assigneeId", visibility=["read"])
    """The assignee ID."""
    role_display_name: Optional[str] = rest_field(name="roleDisplayName", visibility=["read"])
    """The role display name."""
    role_template_id: Optional[str] = rest_field(name="roleTemplateId", visibility=["read"])
    """The role template ID."""
    role_definition_id: Optional[str] = rest_field(name="roleDefinitionId", visibility=["read"])
    """The role definition ID."""
    assignment_activated_date: Optional[datetime.datetime] = rest_field(
        name="assignmentActivatedDate", visibility=["read"], format="rfc3339"
    )
    """The date the assignment was activated."""
    requestor_id: Optional[str] = rest_field(name="requestorId", visibility=["read"])
    """The requestor ID."""
    requestor_display_name: Optional[str] = rest_field(name="requestorDisplayName", visibility=["read"])
    """The requestor display name."""
    requestor_user_principal_name: Optional[str] = rest_field(name="requestorUserPrincipalName", visibility=["read"])
    """The requestor user principal name."""
    alert_incident_type: Literal["AzureRolesAssignedOutsidePimAlertIncident"] = rest_discriminator(name="alertIncidentType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The alert incident type. Required. Default value is
     \"AzureRolesAssignedOutsidePimAlertIncident\"."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.alert_incident_type = "AzureRolesAssignedOutsidePimAlertIncident"  # type: ignore


class ClassicAdministrator(_Model):
    """Classic Administrators.

    :ivar id: The ID of the administrator.
    :vartype id: str
    :ivar name: The name of the administrator.
    :vartype name: str
    :ivar type: The type of the administrator.
    :vartype type: str
    :ivar properties: Properties for the classic administrator.
    :vartype properties: ~azure.mgmt.authorization.models.ClassicAdministratorProperties
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The ID of the administrator."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name of the administrator."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The type of the administrator."""
    properties: Optional["_models.ClassicAdministratorProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties for the classic administrator."""

    __flattened_items = ["email_address", "role"]

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

    @overload
    def __init__(self, mapping: Mapping[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 ClassicAdministratorProperties(_Model):
    """Classic Administrator properties.

    :ivar email_address: The email address of the administrator.
    :vartype email_address: str
    :ivar role: The role of the administrator.
    :vartype role: str
    """

    email_address: Optional[str] = rest_field(
        name="emailAddress", visibility=["read", "create", "update", "delete", "query"]
    )
    """The email address of the administrator."""
    role: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role of the administrator."""

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

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

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


class CloudError(_Model):
    """An error response from the service.

    :ivar error: An error response from the service.
    :vartype error: ~azure.mgmt.authorization.models.CloudErrorBody
    """

    error: Optional["_models.CloudErrorBody"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """An error response from the service."""

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

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

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


class CloudErrorBody(_Model):
    """An error response from the service.

    :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed
     programmatically.
    :vartype code: str
    :ivar message: A message describing the error, intended to be suitable for display in a user
     interface.
    :vartype message: str
    """

    code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """An identifier for the error. Codes are invariant and are intended to be consumed
     programmatically."""
    message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """A message describing the error, intended to be suitable for display in a user interface."""

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

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

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


class DenyAssignment(ExtensionResource):
    """Deny Assignment.

    :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.authorization.models.SystemData
    :ivar properties: Deny assignment properties.
    :vartype properties: ~azure.mgmt.authorization.models.DenyAssignmentProperties
    """

    properties: Optional["_models.DenyAssignmentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Deny assignment properties."""

    __flattened_items = [
        "deny_assignment_name",
        "description",
        "permissions",
        "scope",
        "do_not_apply_to_child_scopes",
        "principals",
        "exclude_principals",
        "is_system_protected",
        "deny_assignment_effect",
        "condition",
        "condition_version",
        "created_on",
        "updated_on",
        "created_by",
        "updated_by",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 DenyAssignmentPermission(_Model):
    """Deny assignment permissions.

    :ivar actions: Actions to which the deny assignment does not grant access.
    :vartype actions: list[str]
    :ivar not_actions: Actions to exclude from that the deny assignment does not grant access.
    :vartype not_actions: list[str]
    :ivar data_actions: Data actions to which the deny assignment does not grant access.
    :vartype data_actions: list[str]
    :ivar not_data_actions: Data actions to exclude from that the deny assignment does not grant
     access.
    :vartype not_data_actions: list[str]
    :ivar condition: The conditions on the Deny assignment permission. This limits the resources it
     applies to.
    :vartype condition: str
    :ivar condition_version: Version of the condition.
    :vartype condition_version: str
    """

    actions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Actions to which the deny assignment does not grant access."""
    not_actions: Optional[list[str]] = rest_field(
        name="notActions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Actions to exclude from that the deny assignment does not grant access."""
    data_actions: Optional[list[str]] = rest_field(
        name="dataActions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Data actions to which the deny assignment does not grant access."""
    not_data_actions: Optional[list[str]] = rest_field(
        name="notDataActions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Data actions to exclude from that the deny assignment does not grant access."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the Deny assignment permission. This limits the resources it applies to."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition."""

    @overload
    def __init__(
        self,
        *,
        actions: Optional[list[str]] = None,
        not_actions: Optional[list[str]] = None,
        data_actions: Optional[list[str]] = None,
        not_data_actions: Optional[list[str]] = None,
        condition: Optional[str] = None,
        condition_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 DenyAssignmentPrincipal(_Model):
    """Deny assignment principal.

    :ivar id: The object ID of the principal.
    :vartype id: str
    :ivar type: The type of the principal such as user, group, servicePrincipal, etc.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The object ID of the principal."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The type of the principal such as user, group, servicePrincipal, etc."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        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 DenyAssignmentProperties(_Model):
    """Deny assignment properties.

    :ivar deny_assignment_name: The display name of the deny assignment.
    :vartype deny_assignment_name: str
    :ivar description: The description of the deny assignment.
    :vartype description: str
    :ivar permissions: An array of permissions that are denied by the deny assignment.
    :vartype permissions: list[~azure.mgmt.authorization.models.DenyAssignmentPermission]
    :ivar scope: The deny assignment scope.
    :vartype scope: str
    :ivar do_not_apply_to_child_scopes: Determines if the deny assignment applies to child scopes.
     Default value is false.
    :vartype do_not_apply_to_child_scopes: bool
    :ivar principals: Array of principals to which the deny assignment applies.
    :vartype principals: list[~azure.mgmt.authorization.models.DenyAssignmentPrincipal]
    :ivar exclude_principals: Array of principals to which the deny assignment does not apply.
    :vartype exclude_principals: list[~azure.mgmt.authorization.models.DenyAssignmentPrincipal]
    :ivar is_system_protected: Specifies whether this deny assignment was created by Azure and
     cannot be edited or deleted.
    :vartype is_system_protected: bool
    :ivar deny_assignment_effect: The effect of the deny assignment. 'enforced' blocks access,
     'audit' logs without blocking. Known values are: "enforced" and "audit".
    :vartype deny_assignment_effect: str or ~azure.mgmt.authorization.models.DenyAssignmentEffect
    :ivar condition: The conditions on the deny assignment. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition.
    :vartype condition_version: str
    :ivar created_on: Time it was created.
    :vartype created_on: ~datetime.datetime
    :ivar updated_on: Time it was updated.
    :vartype updated_on: ~datetime.datetime
    :ivar created_by: Id of the user who created the assignment.
    :vartype created_by: str
    :ivar updated_by: Id of the user who updated the assignment.
    :vartype updated_by: str
    """

    deny_assignment_name: Optional[str] = rest_field(
        name="denyAssignmentName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The display name of the deny assignment."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The description of the deny assignment."""
    permissions: Optional[list["_models.DenyAssignmentPermission"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """An array of permissions that are denied by the deny assignment."""
    scope: Optional[str] = rest_field(visibility=["read"])
    """The deny assignment scope."""
    do_not_apply_to_child_scopes: Optional[bool] = rest_field(
        name="doNotApplyToChildScopes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Determines if the deny assignment applies to child scopes. Default value is false."""
    principals: Optional[list["_models.DenyAssignmentPrincipal"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Array of principals to which the deny assignment applies."""
    exclude_principals: Optional[list["_models.DenyAssignmentPrincipal"]] = rest_field(
        name="excludePrincipals", visibility=["read", "create", "update", "delete", "query"]
    )
    """Array of principals to which the deny assignment does not apply."""
    is_system_protected: Optional[bool] = rest_field(
        name="isSystemProtected", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies whether this deny assignment was created by Azure and cannot be edited or deleted."""
    deny_assignment_effect: Optional[Union[str, "_models.DenyAssignmentEffect"]] = rest_field(
        name="denyAssignmentEffect", visibility=["read", "create", "update", "delete", "query"]
    )
    """The effect of the deny assignment. 'enforced' blocks access, 'audit' logs without blocking.
     Known values are: \"enforced\" and \"audit\"."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the deny assignment. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition."""
    created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339")
    """Time it was created."""
    updated_on: Optional[datetime.datetime] = rest_field(name="updatedOn", visibility=["read"], format="rfc3339")
    """Time it was updated."""
    created_by: Optional[str] = rest_field(name="createdBy", visibility=["read"])
    """Id of the user who created the assignment."""
    updated_by: Optional[str] = rest_field(name="updatedBy", visibility=["read"])
    """Id of the user who updated the assignment."""

    @overload
    def __init__(
        self,
        *,
        deny_assignment_name: Optional[str] = None,
        description: Optional[str] = None,
        permissions: Optional[list["_models.DenyAssignmentPermission"]] = None,
        do_not_apply_to_child_scopes: Optional[bool] = None,
        principals: Optional[list["_models.DenyAssignmentPrincipal"]] = None,
        exclude_principals: Optional[list["_models.DenyAssignmentPrincipal"]] = None,
        is_system_protected: Optional[bool] = None,
        deny_assignment_effect: Optional[Union[str, "_models.DenyAssignmentEffect"]] = None,
        condition: Optional[str] = None,
        condition_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 DuplicateRoleCreatedAlertConfigurationProperties(
    AlertConfigurationProperties, discriminator="DuplicateRoleCreatedAlertConfiguration"
):  # pylint: disable=name-too-long
    """The duplicate role created alert configuration.

    :ivar alert_definition_id: The alert definition ID.
    :vartype alert_definition_id: str
    :ivar scope: The alert scope.
    :vartype scope: str
    :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the
     specific alert.
    :vartype is_enabled: bool
    :ivar alert_definition: The alert definition.
    :vartype alert_definition: ~azure.mgmt.authorization.models.AlertDefinition
    :ivar alert_configuration_type: The alert configuration type. Required. Default value is
     "DuplicateRoleCreatedAlertConfiguration".
    :vartype alert_configuration_type: str
    """

    alert_configuration_type: Literal["DuplicateRoleCreatedAlertConfiguration"] = rest_discriminator(name="alertConfigurationType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The alert configuration type. Required. Default value is
     \"DuplicateRoleCreatedAlertConfiguration\"."""

    @overload
    def __init__(
        self,
        *,
        is_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)
        self.alert_configuration_type = "DuplicateRoleCreatedAlertConfiguration"  # type: ignore


class DuplicateRoleCreatedAlertIncidentProperties(
    AlertIncidentProperties, discriminator="DuplicateRoleCreatedAlertIncident"
):  # pylint: disable=name-too-long
    """Duplicate role created alert incident properties.

    :ivar role_name: The role name.
    :vartype role_name: str
    :ivar duplicate_roles: The duplicate roles.
    :vartype duplicate_roles: str
    :ivar reason: The reason for the incident.
    :vartype reason: str
    :ivar alert_incident_type: The alert incident type. Required. Default value is
     "DuplicateRoleCreatedAlertIncident".
    :vartype alert_incident_type: str
    """

    role_name: Optional[str] = rest_field(name="roleName", visibility=["read"])
    """The role name."""
    duplicate_roles: Optional[str] = rest_field(name="duplicateRoles", visibility=["read"])
    """The duplicate roles."""
    reason: Optional[str] = rest_field(visibility=["read"])
    """The reason for the incident."""
    alert_incident_type: Literal["DuplicateRoleCreatedAlertIncident"] = rest_discriminator(name="alertIncidentType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The alert incident type. Required. Default value is \"DuplicateRoleCreatedAlertIncident\"."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.alert_incident_type = "DuplicateRoleCreatedAlertIncident"  # type: ignore


class EligibleChildResource(_Model):
    """Eligible child resource.

    :ivar id: The resource scope Id.
    :vartype id: str
    :ivar name: The resource name.
    :vartype name: str
    :ivar type: The resource type.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """The resource scope Id."""
    name: Optional[str] = rest_field(visibility=["read"])
    """The resource name."""
    type: Optional[str] = rest_field(visibility=["read"])
    """The resource type."""


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 ErrorDefinition(_Model):
    """Error.

    :ivar error: Error of the list gateway status.
    :vartype error: ~azure.mgmt.authorization.models.ErrorDefinitionProperties
    """

    error: Optional["_models.ErrorDefinitionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Error of the list gateway status."""

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

    @overload
    def __init__(self, mapping: Mapping[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 ErrorDefinitionProperties(_Model):
    """Error.

    :ivar message: Description of the error.
    :vartype message: str
    :ivar code: Error code of list gateway.
    :vartype code: str
    """

    message: Optional[str] = rest_field(visibility=["read"])
    """Description of the error."""
    code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Error code of list gateway."""

    @overload
    def __init__(
        self,
        *,
        code: 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 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.authorization.models.ErrorDetail]
    :ivar additional_info: The error additional info.
    :vartype additional_info: list[~azure.mgmt.authorization.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.authorization.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 ExpandedProperties(_Model):
    """ExpandedProperties.

    :ivar scope: Details of the resource scope.
    :vartype scope: ~azure.mgmt.authorization.models.ExpandedPropertiesScope
    :ivar role_definition: Details of role definition.
    :vartype role_definition: ~azure.mgmt.authorization.models.ExpandedPropertiesRoleDefinition
    :ivar principal: Details of the principal.
    :vartype principal: ~azure.mgmt.authorization.models.ExpandedPropertiesPrincipal
    """

    scope: Optional["_models.ExpandedPropertiesScope"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Details of the resource scope."""
    role_definition: Optional["_models.ExpandedPropertiesRoleDefinition"] = rest_field(
        name="roleDefinition", visibility=["read", "create", "update", "delete", "query"]
    )
    """Details of role definition."""
    principal: Optional["_models.ExpandedPropertiesPrincipal"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Details of the principal."""

    @overload
    def __init__(
        self,
        *,
        scope: Optional["_models.ExpandedPropertiesScope"] = None,
        role_definition: Optional["_models.ExpandedPropertiesRoleDefinition"] = None,
        principal: Optional["_models.ExpandedPropertiesPrincipal"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 ExpandedPropertiesPrincipal(_Model):
    """Details of the principal.

    :ivar id: Id of the principal.
    :vartype id: str
    :ivar display_name: Display name of the principal.
    :vartype display_name: str
    :ivar email: Email id of the principal.
    :vartype email: str
    :ivar type: Type of the principal.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Id of the principal."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name of the principal."""
    email: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Email id of the principal."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of the principal."""

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

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

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


class ExpandedPropertiesRoleDefinition(_Model):
    """Details of role definition.

    :ivar id: Id of the role definition.
    :vartype id: str
    :ivar display_name: Display name of the role definition.
    :vartype display_name: str
    :ivar type: Type of the role definition.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Id of the role definition."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name of the role definition."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of the role definition."""

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

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

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


class ExpandedPropertiesScope(_Model):
    """Details of the resource scope.

    :ivar id: Scope id of the resource.
    :vartype id: str
    :ivar display_name: Display name of the resource.
    :vartype display_name: str
    :ivar type: Type of the resource.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Scope id of the resource."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name of the resource."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of the resource."""

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

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

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


class Operation(_Model):
    """The definition of a Microsoft.Authorization operation.

    :ivar name: Name of the operation.
    :vartype name: str
    :ivar is_data_action: Indicates whether the operation is a data action.
    :vartype is_data_action: bool
    :ivar display: Display of the operation.
    :vartype display: ~azure.mgmt.authorization.models.OperationDisplay
    :ivar origin: Origin of the operation.
    :vartype origin: str
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Name of the operation."""
    is_data_action: Optional[bool] = rest_field(
        name="isDataAction", visibility=["read", "create", "update", "delete", "query"]
    )
    """Indicates whether the operation is a data action."""
    display: Optional["_models.OperationDisplay"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Display of the operation."""
    origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Origin of the operation."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        is_data_action: Optional[bool] = None,
        display: Optional["_models.OperationDisplay"] = None,
        origin: 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 OperationDisplay(_Model):
    """The display information for a Microsoft.Authorization operation.

    :ivar provider: The resource provider name: Microsoft.Authorization.
    :vartype provider: str
    :ivar resource: The resource on which the operation is performed.
    :vartype resource: str
    :ivar operation: The operation that users can perform.
    :vartype operation: str
    :ivar description: The description for the operation.
    :vartype description: str
    """

    provider: Optional[str] = rest_field(visibility=["read"])
    """The resource provider name: Microsoft.Authorization."""
    resource: Optional[str] = rest_field(visibility=["read"])
    """The resource on which the operation is performed."""
    operation: Optional[str] = rest_field(visibility=["read"])
    """The operation that users can perform."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The description for the operation."""


class Permission(_Model):
    """Role definition permissions.

    :ivar actions: Allowed actions.
    :vartype actions: list[str]
    :ivar not_actions: Denied actions.
    :vartype not_actions: list[str]
    :ivar data_actions: Allowed Data actions.
    :vartype data_actions: list[str]
    :ivar not_data_actions: Denied Data actions.
    :vartype not_data_actions: list[str]
    :ivar condition: The conditions on the role definition. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition. Currently the only accepted value is '2.0'.
    :vartype condition_version: str
    """

    actions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Allowed actions."""
    not_actions: Optional[list[str]] = rest_field(
        name="notActions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Denied actions."""
    data_actions: Optional[list[str]] = rest_field(
        name="dataActions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Allowed Data actions."""
    not_data_actions: Optional[list[str]] = rest_field(
        name="notDataActions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Denied Data actions."""
    condition: Optional[str] = rest_field(visibility=["read"])
    """The conditions on the role definition. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(name="conditionVersion", visibility=["read"])
    """Version of the condition. Currently the only accepted value is '2.0'."""

    @overload
    def __init__(
        self,
        *,
        actions: Optional[list[str]] = None,
        not_actions: Optional[list[str]] = None,
        data_actions: Optional[list[str]] = None,
        not_data_actions: 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 PIMOnlyModeSettings(_Model):
    """The PIM Only Mode settings.

    :ivar mode: Determines whether the setting is enabled, disabled or report only. Known values
     are: "Disabled", "Enabled", and "ReportOnly".
    :vartype mode: str or ~azure.mgmt.authorization.models.PIMOnlyMode
    :ivar excludes: The list of excluded entities that the rule does not apply to.
    :vartype excludes: list[~azure.mgmt.authorization.models.UsersOrServicePrincipalSet]
    :ivar excluded_assignment_types: The list of excluded assignment types allowed.
    :vartype excluded_assignment_types: list[str or
     ~azure.mgmt.authorization.models.ExcludedPrincipalTypes]
    """

    mode: Optional[Union[str, "_models.PIMOnlyMode"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Determines whether the setting is enabled, disabled or report only. Known values are:
     \"Disabled\", \"Enabled\", and \"ReportOnly\"."""
    excludes: Optional[list["_models.UsersOrServicePrincipalSet"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of excluded entities that the rule does not apply to."""
    excluded_assignment_types: Optional[list[Union[str, "_models.ExcludedPrincipalTypes"]]] = rest_field(
        name="excludedAssignmentTypes", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of excluded assignment types allowed."""

    @overload
    def __init__(
        self,
        *,
        mode: Optional[Union[str, "_models.PIMOnlyMode"]] = None,
        excludes: Optional[list["_models.UsersOrServicePrincipalSet"]] = None,
        excluded_assignment_types: Optional[list[Union[str, "_models.ExcludedPrincipalTypes"]]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 PolicyAssignmentProperties(_Model):
    """Expanded info of resource scope, role definition and policy.

    :ivar scope: Details of the resource scope.
    :vartype scope: ~azure.mgmt.authorization.models.PolicyAssignmentPropertiesScope
    :ivar role_definition: Details of role definition.
    :vartype role_definition:
     ~azure.mgmt.authorization.models.PolicyAssignmentPropertiesRoleDefinition
    :ivar policy: Details of the policy.
    :vartype policy: ~azure.mgmt.authorization.models.PolicyAssignmentPropertiesPolicy
    """

    scope: Optional["_models.PolicyAssignmentPropertiesScope"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Details of the resource scope."""
    role_definition: Optional["_models.PolicyAssignmentPropertiesRoleDefinition"] = rest_field(
        name="roleDefinition", visibility=["read", "create", "update", "delete", "query"]
    )
    """Details of role definition."""
    policy: Optional["_models.PolicyAssignmentPropertiesPolicy"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Details of the policy."""

    @overload
    def __init__(
        self,
        *,
        scope: Optional["_models.PolicyAssignmentPropertiesScope"] = None,
        role_definition: Optional["_models.PolicyAssignmentPropertiesRoleDefinition"] = None,
        policy: Optional["_models.PolicyAssignmentPropertiesPolicy"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 PolicyAssignmentPropertiesPolicy(_Model):
    """Details of the policy.

    :ivar id: Id of the policy.
    :vartype id: str
    :ivar last_modified_by: The name of the entity last modified it.
    :vartype last_modified_by: ~azure.mgmt.authorization.models.Principal
    :ivar last_modified_date_time: The last modified date time.
    :vartype last_modified_date_time: ~datetime.datetime
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Id of the policy."""
    last_modified_by: Optional["_models.Principal"] = rest_field(name="lastModifiedBy", visibility=["read"])
    """The name of the entity last modified it."""
    last_modified_date_time: Optional[datetime.datetime] = rest_field(
        name="lastModifiedDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The last modified date time."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        last_modified_date_time: 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 PolicyAssignmentPropertiesRoleDefinition(_Model):
    """Details of role definition.

    :ivar id: Id of the role definition.
    :vartype id: str
    :ivar display_name: Display name of the role definition.
    :vartype display_name: str
    :ivar type: Type of the role definition.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Id of the role definition."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name of the role definition."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of the role definition."""

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

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

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


class PolicyAssignmentPropertiesScope(_Model):
    """Details of the resource scope.

    :ivar id: Scope id of the resource.
    :vartype id: str
    :ivar display_name: Display name of the resource.
    :vartype display_name: str
    :ivar type: Type of the resource.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Scope id of the resource."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name of the resource."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of the resource."""

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

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

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


class PolicyProperties(_Model):
    """Expanded info of resource scope.

    :ivar scope: Details of the resource scope.
    :vartype scope: ~azure.mgmt.authorization.models.PolicyPropertiesScope
    """

    scope: Optional["_models.PolicyPropertiesScope"] = rest_field(visibility=["read"])
    """Details of the resource scope."""


class PolicyPropertiesScope(_Model):
    """Details of the resource scope.

    :ivar id: Scope id of the resource.
    :vartype id: str
    :ivar display_name: Display name of the resource.
    :vartype display_name: str
    :ivar type: Type of the resource.
    :vartype type: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Scope id of the resource."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name of the resource."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of the resource."""

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

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

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


class Principal(_Model):
    """The name of the entity last modified it.

    :ivar id: The id of the principal made changes.
    :vartype id: str
    :ivar display_name: The name of the principal made changes.
    :vartype display_name: str
    :ivar type: Type of principal such as user , group etc.
    :vartype type: str
    :ivar email: Email of principal.
    :vartype email: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The id of the principal made changes."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The name of the principal made changes."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of principal such as user , group etc."""
    email: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Email of principal."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        display_name: Optional[str] = None,
        type: Optional[str] = None,
        email: 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 ProviderOperation(_Model):
    """Operation.

    :ivar name: The operation name.
    :vartype name: str
    :ivar display_name: The operation display name.
    :vartype display_name: str
    :ivar description: The operation description.
    :vartype description: str
    :ivar origin: The operation origin.
    :vartype origin: str
    :ivar properties: The operation properties.
    :vartype properties: any
    :ivar is_data_action: The dataAction flag to specify the operation type.
    :vartype is_data_action: bool
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The operation name."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The operation display name."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The operation description."""
    origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The operation origin."""
    properties: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The operation properties."""
    is_data_action: Optional[bool] = rest_field(
        name="isDataAction", visibility=["read", "create", "update", "delete", "query"]
    )
    """The dataAction flag to specify the operation type."""

    __flattened_items = [""]

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        display_name: Optional[str] = None,
        description: Optional[str] = None,
        origin: Optional[str] = None,
        properties: Optional[Any] = None,
        is_data_action: 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:
        _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 SettableResource(_Model):
    """The resource model definition for resource.

    :ivar id: The provider ID.
    :vartype id: str
    :ivar name: The provider name.
    :vartype name: str
    :ivar type: The provider type.
    :vartype type: str
    """

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

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

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

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


class ProviderOperationsMetadata(SettableResource):
    """Provider Operations metadata.

    :ivar id: The provider ID.
    :vartype id: str
    :ivar name: The provider name.
    :vartype name: str
    :ivar type: The provider type.
    :vartype type: str
    :ivar display_name: The provider display name.
    :vartype display_name: str
    :ivar resource_types: The provider resource types.
    :vartype resource_types: list[~azure.mgmt.authorization.models.ResourceType]
    :ivar operations: The provider operations.
    :vartype operations: list[~azure.mgmt.authorization.models.ProviderOperation]
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The provider display name."""
    resource_types: Optional[list["_models.ResourceType"]] = rest_field(
        name="resourceTypes", visibility=["read", "create", "update", "delete", "query"]
    )
    """The provider resource types."""
    operations: Optional[list["_models.ProviderOperation"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The provider operations."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        name: Optional[str] = None,
        type: Optional[str] = None,
        display_name: Optional[str] = None,
        resource_types: Optional[list["_models.ResourceType"]] = None,
        operations: Optional[list["_models.ProviderOperation"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RecordAllDecisionsProperties(_Model):
    """Record All Decisions payload.

    :ivar principal_id: The id of principal which needs to be approved/denied.
    :vartype principal_id: str
    :ivar resource_id: The id of resource which needs to be approved/denied.
    :vartype resource_id: str
    :ivar decision: The decision to make. Approvers can take action of Approve/Deny. Known values
     are: "Approve" and "Deny".
    :vartype decision: str or ~azure.mgmt.authorization.models.RecordAllDecisionsResult
    :ivar justification: Justification provided by approvers for their action.
    :vartype justification: str
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The id of principal which needs to be approved/denied."""
    resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"])
    """The id of resource which needs to be approved/denied."""
    decision: Optional[Union[str, "_models.RecordAllDecisionsResult"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The decision to make. Approvers can take action of Approve/Deny. Known values are: \"Approve\"
     and \"Deny\"."""
    justification: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Justification provided by approvers for their action."""

    @overload
    def __init__(
        self,
        *,
        decision: Optional[Union[str, "_models.RecordAllDecisionsResult"]] = None,
        justification: 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 ResourceType(_Model):
    """Resource Type.

    :ivar name: The resource type name.
    :vartype name: str
    :ivar display_name: The resource type display name.
    :vartype display_name: str
    :ivar operations: The resource type operations.
    :vartype operations: list[~azure.mgmt.authorization.models.ProviderOperation]
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource type name."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource type display name."""
    operations: Optional[list["_models.ProviderOperation"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource type operations."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        display_name: Optional[str] = None,
        operations: Optional[list["_models.ProviderOperation"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignment(ExtensionResource):
    """Role Assignments.

    :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.authorization.models.SystemData
    :ivar properties: Role assignment properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleAssignmentProperties
    """

    properties: Optional["_models.RoleAssignmentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role assignment properties."""

    __flattened_items = [
        "scope",
        "role_definition_id",
        "principal_id",
        "principal_type",
        "description",
        "condition",
        "condition_version",
        "created_on",
        "updated_on",
        "created_by",
        "updated_by",
        "delegated_managed_identity_resource_id",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignmentCreateParameters(_Model):
    """Role assignment create parameters.

    :ivar properties: Role assignment properties. Required.
    :vartype properties: ~azure.mgmt.authorization.models.RoleAssignmentProperties
    """

    properties: "_models.RoleAssignmentProperties" = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role assignment properties. Required."""

    __flattened_items = [
        "scope",
        "role_definition_id",
        "principal_id",
        "principal_type",
        "description",
        "condition",
        "condition_version",
        "created_on",
        "updated_on",
        "created_by",
        "updated_by",
        "delegated_managed_identity_resource_id",
    ]

    @overload
    def __init__(
        self,
        *,
        properties: "_models.RoleAssignmentProperties",
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignmentProperties(_Model):
    """Role assignment properties.

    :ivar scope: The role assignment scope.
    :vartype scope: str
    :ivar role_definition_id: The role definition ID. Required.
    :vartype role_definition_id: str
    :ivar principal_id: The principal ID. Required.
    :vartype principal_id: str
    :ivar principal_type: The principal type of the assigned principal ID. Known values are:
     "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.PrincipalType
    :ivar description: Description of role assignment.
    :vartype description: str
    :ivar condition: The conditions on the role assignment. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition. Currently the only accepted value is '2.0'.
    :vartype condition_version: str
    :ivar created_on: Time it was created.
    :vartype created_on: ~datetime.datetime
    :ivar updated_on: Time it was updated.
    :vartype updated_on: ~datetime.datetime
    :ivar created_by: Id of the user who created the assignment.
    :vartype created_by: str
    :ivar updated_by: Id of the user who updated the assignment.
    :vartype updated_by: str
    :ivar delegated_managed_identity_resource_id: Id of the delegated managed identity resource.
    :vartype delegated_managed_identity_resource_id: str
    """

    scope: Optional[str] = rest_field(visibility=["read"])
    """The role assignment scope."""
    role_definition_id: str = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role definition ID. Required."""
    principal_id: str = rest_field(name="principalId", visibility=["read", "create", "update", "delete", "query"])
    """The principal ID. Required."""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal type of the assigned principal ID. Known values are: \"User\", \"Group\",
     \"ServicePrincipal\", \"ForeignGroup\", and \"Device\"."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Description of role assignment."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the role assignment. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition. Currently the only accepted value is '2.0'."""
    created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339")
    """Time it was created."""
    updated_on: Optional[datetime.datetime] = rest_field(name="updatedOn", visibility=["read"], format="rfc3339")
    """Time it was updated."""
    created_by: Optional[str] = rest_field(name="createdBy", visibility=["read"])
    """Id of the user who created the assignment."""
    updated_by: Optional[str] = rest_field(name="updatedBy", visibility=["read"])
    """Id of the user who updated the assignment."""
    delegated_managed_identity_resource_id: Optional[str] = rest_field(
        name="delegatedManagedIdentityResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Id of the delegated managed identity resource."""

    @overload
    def __init__(
        self,
        *,
        role_definition_id: str,
        principal_id: str,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        description: Optional[str] = None,
        condition: Optional[str] = None,
        condition_version: Optional[str] = None,
        delegated_managed_identity_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 RoleAssignmentSchedule(ExtensionResource):
    """Role Assignment 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.authorization.models.SystemData
    :ivar properties: Role assignment schedule properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleAssignmentScheduleProperties
    """

    properties: Optional["_models.RoleAssignmentScheduleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role assignment schedule properties."""

    __flattened_items = [
        "scope",
        "role_definition_id",
        "principal_id",
        "principal_type",
        "role_assignment_schedule_request_id",
        "linked_role_eligibility_schedule_id",
        "assignment_type",
        "member_type",
        "status",
        "start_date_time",
        "end_date_time",
        "condition",
        "condition_version",
        "created_on",
        "updated_on",
        "expanded_properties",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignmentScheduleInstance(ExtensionResource):
    """Information about current or upcoming role assignment schedule 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.authorization.models.SystemData
    :ivar properties: Role assignment schedule instance properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleAssignmentScheduleInstanceProperties
    """

    properties: Optional["_models.RoleAssignmentScheduleInstanceProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role assignment schedule instance properties."""

    __flattened_items = [
        "scope",
        "role_definition_id",
        "principal_id",
        "principal_type",
        "role_assignment_schedule_id",
        "origin_role_assignment_id",
        "status",
        "start_date_time",
        "end_date_time",
        "linked_role_eligibility_schedule_id",
        "linked_role_eligibility_schedule_instance_id",
        "assignment_type",
        "member_type",
        "condition",
        "condition_version",
        "created_on",
        "expanded_properties",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignmentScheduleInstanceProperties(_Model):
    """Role assignment schedule properties with scope.

    :ivar scope: The role assignment schedule scope.
    :vartype scope: str
    :ivar role_definition_id: The role definition ID.
    :vartype role_definition_id: str
    :ivar principal_id: The principal ID.
    :vartype principal_id: str
    :ivar principal_type: The principal type of the assigned principal ID. Known values are:
     "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.PrincipalType
    :ivar role_assignment_schedule_id: Id of the master role assignment schedule.
    :vartype role_assignment_schedule_id: str
    :ivar origin_role_assignment_id: Role Assignment Id in external system.
    :vartype origin_role_assignment_id: str
    :ivar status: The status of the role assignment schedule instance. Known values are:
     "Accepted", "PendingEvaluation", "Granted", "Denied", "PendingProvisioning", "Provisioned",
     "PendingRevocation", "Revoked", "Canceled", "Failed", "PendingApprovalProvisioning",
     "PendingApproval", "FailedAsResourceIsLocked", "PendingAdminDecision", "AdminApproved",
     "AdminDenied", "TimedOut", "ProvisioningStarted", "Invalid", "PendingScheduleCreation",
     "ScheduleCreated", and "PendingExternalProvisioning".
    :vartype status: str or ~azure.mgmt.authorization.models.Status
    :ivar start_date_time: The startDateTime of the role assignment schedule instance.
    :vartype start_date_time: ~datetime.datetime
    :ivar end_date_time: The endDateTime of the role assignment schedule instance.
    :vartype end_date_time: ~datetime.datetime
    :ivar linked_role_eligibility_schedule_id: roleEligibilityScheduleId used to activate.
    :vartype linked_role_eligibility_schedule_id: str
    :ivar linked_role_eligibility_schedule_instance_id: roleEligibilityScheduleInstanceId linked to
     this roleAssignmentScheduleInstance.
    :vartype linked_role_eligibility_schedule_instance_id: str
    :ivar assignment_type: Assignment type of the role assignment schedule. Known values are:
     "Activated" and "Assigned".
    :vartype assignment_type: str or ~azure.mgmt.authorization.models.AssignmentType
    :ivar member_type: Membership type of the role assignment schedule. Known values are:
     "Inherited", "Direct", and "Group".
    :vartype member_type: str or ~azure.mgmt.authorization.models.MemberType
    :ivar condition: The conditions on the role assignment. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition. Currently accepted value is '2.0'.
    :vartype condition_version: str
    :ivar created_on: DateTime when role assignment schedule was created.
    :vartype created_on: ~datetime.datetime
    :ivar expanded_properties: Additional properties of principal, scope and role definition.
    :vartype expanded_properties: ~azure.mgmt.authorization.models.ExpandedProperties
    """

    scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role assignment schedule scope."""
    role_definition_id: Optional[str] = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role definition ID."""
    principal_id: Optional[str] = rest_field(
        name="principalId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal ID."""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal type of the assigned principal ID. Known values are: \"User\", \"Group\",
     \"ServicePrincipal\", \"ForeignGroup\", and \"Device\"."""
    role_assignment_schedule_id: Optional[str] = rest_field(
        name="roleAssignmentScheduleId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Id of the master role assignment schedule."""
    origin_role_assignment_id: Optional[str] = rest_field(
        name="originRoleAssignmentId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Role Assignment Id in external system."""
    status: Optional[Union[str, "_models.Status"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The status of the role assignment schedule instance. Known values are: \"Accepted\",
     \"PendingEvaluation\", \"Granted\", \"Denied\", \"PendingProvisioning\", \"Provisioned\",
     \"PendingRevocation\", \"Revoked\", \"Canceled\", \"Failed\", \"PendingApprovalProvisioning\",
     \"PendingApproval\", \"FailedAsResourceIsLocked\", \"PendingAdminDecision\", \"AdminApproved\",
     \"AdminDenied\", \"TimedOut\", \"ProvisioningStarted\", \"Invalid\",
     \"PendingScheduleCreation\", \"ScheduleCreated\", and \"PendingExternalProvisioning\"."""
    start_date_time: Optional[datetime.datetime] = rest_field(
        name="startDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The startDateTime of the role assignment schedule instance."""
    end_date_time: Optional[datetime.datetime] = rest_field(
        name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The endDateTime of the role assignment schedule instance."""
    linked_role_eligibility_schedule_id: Optional[str] = rest_field(
        name="linkedRoleEligibilityScheduleId", visibility=["read", "create", "update", "delete", "query"]
    )
    """roleEligibilityScheduleId used to activate."""
    linked_role_eligibility_schedule_instance_id: Optional[str] = rest_field(
        name="linkedRoleEligibilityScheduleInstanceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """roleEligibilityScheduleInstanceId linked to this roleAssignmentScheduleInstance."""
    assignment_type: Optional[Union[str, "_models.AssignmentType"]] = rest_field(
        name="assignmentType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Assignment type of the role assignment schedule. Known values are: \"Activated\" and
     \"Assigned\"."""
    member_type: Optional[Union[str, "_models.MemberType"]] = rest_field(
        name="memberType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Membership type of the role assignment schedule. Known values are: \"Inherited\", \"Direct\",
     and \"Group\"."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the role assignment. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition. Currently accepted value is '2.0'."""
    created_on: Optional[datetime.datetime] = rest_field(
        name="createdOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """DateTime when role assignment schedule was created."""
    expanded_properties: Optional["_models.ExpandedProperties"] = rest_field(
        name="expandedProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Additional properties of principal, scope and role definition."""

    @overload
    def __init__(
        self,
        *,
        scope: Optional[str] = None,
        role_definition_id: Optional[str] = None,
        principal_id: Optional[str] = None,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        role_assignment_schedule_id: Optional[str] = None,
        origin_role_assignment_id: Optional[str] = None,
        status: Optional[Union[str, "_models.Status"]] = None,
        start_date_time: Optional[datetime.datetime] = None,
        end_date_time: Optional[datetime.datetime] = None,
        linked_role_eligibility_schedule_id: Optional[str] = None,
        linked_role_eligibility_schedule_instance_id: Optional[str] = None,
        assignment_type: Optional[Union[str, "_models.AssignmentType"]] = None,
        member_type: Optional[Union[str, "_models.MemberType"]] = None,
        condition: Optional[str] = None,
        condition_version: Optional[str] = None,
        created_on: Optional[datetime.datetime] = None,
        expanded_properties: Optional["_models.ExpandedProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignmentScheduleProperties(_Model):
    """Role assignment schedule properties with scope.

    :ivar scope: The role assignment schedule scope.
    :vartype scope: str
    :ivar role_definition_id: The role definition ID.
    :vartype role_definition_id: str
    :ivar principal_id: The principal ID.
    :vartype principal_id: str
    :ivar principal_type: The principal type of the assigned principal ID. Known values are:
     "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.PrincipalType
    :ivar role_assignment_schedule_request_id: The id of roleAssignmentScheduleRequest used to
     create this roleAssignmentSchedule.
    :vartype role_assignment_schedule_request_id: str
    :ivar linked_role_eligibility_schedule_id: The id of roleEligibilitySchedule used to activated
     this roleAssignmentSchedule.
    :vartype linked_role_eligibility_schedule_id: str
    :ivar assignment_type: Assignment type of the role assignment schedule. Known values are:
     "Activated" and "Assigned".
    :vartype assignment_type: str or ~azure.mgmt.authorization.models.AssignmentType
    :ivar member_type: Membership type of the role assignment schedule. Known values are:
     "Inherited", "Direct", and "Group".
    :vartype member_type: str or ~azure.mgmt.authorization.models.MemberType
    :ivar status: The status of the role assignment schedule. Known values are: "Accepted",
     "PendingEvaluation", "Granted", "Denied", "PendingProvisioning", "Provisioned",
     "PendingRevocation", "Revoked", "Canceled", "Failed", "PendingApprovalProvisioning",
     "PendingApproval", "FailedAsResourceIsLocked", "PendingAdminDecision", "AdminApproved",
     "AdminDenied", "TimedOut", "ProvisioningStarted", "Invalid", "PendingScheduleCreation",
     "ScheduleCreated", and "PendingExternalProvisioning".
    :vartype status: str or ~azure.mgmt.authorization.models.Status
    :ivar start_date_time: Start DateTime when role assignment schedule.
    :vartype start_date_time: ~datetime.datetime
    :ivar end_date_time: End DateTime when role assignment schedule.
    :vartype end_date_time: ~datetime.datetime
    :ivar condition: The conditions on the role assignment. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition. Currently accepted value is '2.0'.
    :vartype condition_version: str
    :ivar created_on: DateTime when role assignment schedule was created.
    :vartype created_on: ~datetime.datetime
    :ivar updated_on: DateTime when role assignment schedule was modified.
    :vartype updated_on: ~datetime.datetime
    :ivar expanded_properties: Additional properties of principal, scope and role definition.
    :vartype expanded_properties: ~azure.mgmt.authorization.models.ExpandedProperties
    """

    scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role assignment schedule scope."""
    role_definition_id: Optional[str] = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role definition ID."""
    principal_id: Optional[str] = rest_field(
        name="principalId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal ID."""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal type of the assigned principal ID. Known values are: \"User\", \"Group\",
     \"ServicePrincipal\", \"ForeignGroup\", and \"Device\"."""
    role_assignment_schedule_request_id: Optional[str] = rest_field(
        name="roleAssignmentScheduleRequestId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The id of roleAssignmentScheduleRequest used to create this roleAssignmentSchedule."""
    linked_role_eligibility_schedule_id: Optional[str] = rest_field(
        name="linkedRoleEligibilityScheduleId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The id of roleEligibilitySchedule used to activated this roleAssignmentSchedule."""
    assignment_type: Optional[Union[str, "_models.AssignmentType"]] = rest_field(
        name="assignmentType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Assignment type of the role assignment schedule. Known values are: \"Activated\" and
     \"Assigned\"."""
    member_type: Optional[Union[str, "_models.MemberType"]] = rest_field(
        name="memberType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Membership type of the role assignment schedule. Known values are: \"Inherited\", \"Direct\",
     and \"Group\"."""
    status: Optional[Union[str, "_models.Status"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The status of the role assignment schedule. Known values are: \"Accepted\",
     \"PendingEvaluation\", \"Granted\", \"Denied\", \"PendingProvisioning\", \"Provisioned\",
     \"PendingRevocation\", \"Revoked\", \"Canceled\", \"Failed\", \"PendingApprovalProvisioning\",
     \"PendingApproval\", \"FailedAsResourceIsLocked\", \"PendingAdminDecision\", \"AdminApproved\",
     \"AdminDenied\", \"TimedOut\", \"ProvisioningStarted\", \"Invalid\",
     \"PendingScheduleCreation\", \"ScheduleCreated\", and \"PendingExternalProvisioning\"."""
    start_date_time: Optional[datetime.datetime] = rest_field(
        name="startDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start DateTime when role assignment schedule."""
    end_date_time: Optional[datetime.datetime] = rest_field(
        name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime when role assignment schedule."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the role assignment. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition. Currently accepted value is '2.0'."""
    created_on: Optional[datetime.datetime] = rest_field(
        name="createdOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """DateTime when role assignment schedule was created."""
    updated_on: Optional[datetime.datetime] = rest_field(
        name="updatedOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """DateTime when role assignment schedule was modified."""
    expanded_properties: Optional["_models.ExpandedProperties"] = rest_field(
        name="expandedProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Additional properties of principal, scope and role definition."""

    @overload
    def __init__(
        self,
        *,
        scope: Optional[str] = None,
        role_definition_id: Optional[str] = None,
        principal_id: Optional[str] = None,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        role_assignment_schedule_request_id: Optional[str] = None,
        linked_role_eligibility_schedule_id: Optional[str] = None,
        assignment_type: Optional[Union[str, "_models.AssignmentType"]] = None,
        member_type: Optional[Union[str, "_models.MemberType"]] = None,
        status: Optional[Union[str, "_models.Status"]] = None,
        start_date_time: Optional[datetime.datetime] = None,
        end_date_time: Optional[datetime.datetime] = None,
        condition: Optional[str] = None,
        condition_version: Optional[str] = None,
        created_on: Optional[datetime.datetime] = None,
        updated_on: Optional[datetime.datetime] = None,
        expanded_properties: Optional["_models.ExpandedProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignmentScheduleRequest(ExtensionResource):
    """Role Assignment schedule 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.authorization.models.SystemData
    :ivar properties: Role assignment schedule request properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleAssignmentScheduleRequestProperties
    """

    properties: Optional["_models.RoleAssignmentScheduleRequestProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role assignment schedule request properties."""

    __flattened_items = [
        "scope",
        "role_definition_id",
        "principal_id",
        "principal_type",
        "request_type",
        "status",
        "approval_id",
        "target_role_assignment_schedule_id",
        "target_role_assignment_schedule_instance_id",
        "schedule_info",
        "linked_role_eligibility_schedule_id",
        "justification",
        "ticket_info",
        "condition",
        "condition_version",
        "created_on",
        "requestor_id",
        "expanded_properties",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignmentScheduleRequestProperties(_Model):
    """Role assignment schedule request properties with scope.

    :ivar scope: The role assignment schedule request scope.
    :vartype scope: str
    :ivar role_definition_id: The role definition ID. Required.
    :vartype role_definition_id: str
    :ivar principal_id: The principal ID. Required.
    :vartype principal_id: str
    :ivar principal_type: The principal type of the assigned principal ID. Known values are:
     "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.PrincipalType
    :ivar request_type: The type of the role assignment schedule request. Eg: SelfActivate,
     AdminAssign etc. Required. Known values are: "AdminAssign", "AdminRemove", "AdminUpdate",
     "AdminExtend", "AdminRenew", "SelfActivate", "SelfDeactivate", "SelfExtend", and "SelfRenew".
    :vartype request_type: str or ~azure.mgmt.authorization.models.RequestType
    :ivar status: The status of the role assignment schedule request. Known values are: "Accepted",
     "PendingEvaluation", "Granted", "Denied", "PendingProvisioning", "Provisioned",
     "PendingRevocation", "Revoked", "Canceled", "Failed", "PendingApprovalProvisioning",
     "PendingApproval", "FailedAsResourceIsLocked", "PendingAdminDecision", "AdminApproved",
     "AdminDenied", "TimedOut", "ProvisioningStarted", "Invalid", "PendingScheduleCreation",
     "ScheduleCreated", and "PendingExternalProvisioning".
    :vartype status: str or ~azure.mgmt.authorization.models.Status
    :ivar approval_id: The approvalId of the role assignment schedule request.
    :vartype approval_id: str
    :ivar target_role_assignment_schedule_id: The resultant role assignment schedule id or the role
     assignment schedule id being updated.
    :vartype target_role_assignment_schedule_id: str
    :ivar target_role_assignment_schedule_instance_id: The role assignment schedule instance id
     being updated.
    :vartype target_role_assignment_schedule_instance_id: str
    :ivar schedule_info: Schedule info of the role assignment schedule.
    :vartype schedule_info:
     ~azure.mgmt.authorization.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo
    :ivar linked_role_eligibility_schedule_id: The linked role eligibility schedule id - to
     activate an eligibility.
    :vartype linked_role_eligibility_schedule_id: str
    :ivar justification: Justification for the role assignment.
    :vartype justification: str
    :ivar ticket_info: Ticket Info of the role assignment.
    :vartype ticket_info:
     ~azure.mgmt.authorization.models.RoleAssignmentScheduleRequestPropertiesTicketInfo
    :ivar condition: The conditions on the role assignment. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition. Currently accepted value is '2.0'.
    :vartype condition_version: str
    :ivar created_on: DateTime when role assignment schedule request was created.
    :vartype created_on: ~datetime.datetime
    :ivar requestor_id: Id of the user who created this request.
    :vartype requestor_id: str
    :ivar expanded_properties: Additional properties of principal, scope and role definition.
    :vartype expanded_properties: ~azure.mgmt.authorization.models.ExpandedProperties
    """

    scope: Optional[str] = rest_field(visibility=["read"])
    """The role assignment schedule request scope."""
    role_definition_id: str = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role definition ID. Required."""
    principal_id: str = rest_field(name="principalId", visibility=["read", "create", "update", "delete", "query"])
    """The principal ID. Required."""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read"]
    )
    """The principal type of the assigned principal ID. Known values are: \"User\", \"Group\",
     \"ServicePrincipal\", \"ForeignGroup\", and \"Device\"."""
    request_type: Union[str, "_models.RequestType"] = rest_field(
        name="requestType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc. Required.
     Known values are: \"AdminAssign\", \"AdminRemove\", \"AdminUpdate\", \"AdminExtend\",
     \"AdminRenew\", \"SelfActivate\", \"SelfDeactivate\", \"SelfExtend\", and \"SelfRenew\"."""
    status: Optional[Union[str, "_models.Status"]] = rest_field(visibility=["read"])
    """The status of the role assignment schedule request. Known values are: \"Accepted\",
     \"PendingEvaluation\", \"Granted\", \"Denied\", \"PendingProvisioning\", \"Provisioned\",
     \"PendingRevocation\", \"Revoked\", \"Canceled\", \"Failed\", \"PendingApprovalProvisioning\",
     \"PendingApproval\", \"FailedAsResourceIsLocked\", \"PendingAdminDecision\", \"AdminApproved\",
     \"AdminDenied\", \"TimedOut\", \"ProvisioningStarted\", \"Invalid\",
     \"PendingScheduleCreation\", \"ScheduleCreated\", and \"PendingExternalProvisioning\"."""
    approval_id: Optional[str] = rest_field(name="approvalId", visibility=["read"])
    """The approvalId of the role assignment schedule request."""
    target_role_assignment_schedule_id: Optional[str] = rest_field(
        name="targetRoleAssignmentScheduleId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resultant role assignment schedule id or the role assignment schedule id being updated."""
    target_role_assignment_schedule_instance_id: Optional[str] = rest_field(
        name="targetRoleAssignmentScheduleInstanceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role assignment schedule instance id being updated."""
    schedule_info: Optional["_models.RoleAssignmentScheduleRequestPropertiesScheduleInfo"] = rest_field(
        name="scheduleInfo", visibility=["read", "create", "update", "delete", "query"]
    )
    """Schedule info of the role assignment schedule."""
    linked_role_eligibility_schedule_id: Optional[str] = rest_field(
        name="linkedRoleEligibilityScheduleId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The linked role eligibility schedule id - to activate an eligibility."""
    justification: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Justification for the role assignment."""
    ticket_info: Optional["_models.RoleAssignmentScheduleRequestPropertiesTicketInfo"] = rest_field(
        name="ticketInfo", visibility=["read", "create", "update", "delete", "query"]
    )
    """Ticket Info of the role assignment."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the role assignment. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition. Currently accepted value is '2.0'."""
    created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339")
    """DateTime when role assignment schedule request was created."""
    requestor_id: Optional[str] = rest_field(name="requestorId", visibility=["read"])
    """Id of the user who created this request."""
    expanded_properties: Optional["_models.ExpandedProperties"] = rest_field(
        name="expandedProperties", visibility=["read"]
    )
    """Additional properties of principal, scope and role definition."""

    @overload
    def __init__(
        self,
        *,
        role_definition_id: str,
        principal_id: str,
        request_type: Union[str, "_models.RequestType"],
        target_role_assignment_schedule_id: Optional[str] = None,
        target_role_assignment_schedule_instance_id: Optional[str] = None,
        schedule_info: Optional["_models.RoleAssignmentScheduleRequestPropertiesScheduleInfo"] = None,
        linked_role_eligibility_schedule_id: Optional[str] = None,
        justification: Optional[str] = None,
        ticket_info: Optional["_models.RoleAssignmentScheduleRequestPropertiesTicketInfo"] = None,
        condition: Optional[str] = None,
        condition_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 RoleAssignmentScheduleRequestPropertiesScheduleInfo(_Model):  # pylint: disable=name-too-long
    """Schedule info of the role assignment schedule.

    :ivar start_date_time: Start DateTime of the role assignment schedule.
    :vartype start_date_time: ~datetime.datetime
    :ivar expiration: Expiration of the role assignment schedule.
    :vartype expiration:
     ~azure.mgmt.authorization.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration
    """

    start_date_time: Optional[datetime.datetime] = rest_field(
        name="startDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start DateTime of the role assignment schedule."""
    expiration: Optional["_models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Expiration of the role assignment schedule."""

    @overload
    def __init__(
        self,
        *,
        start_date_time: Optional[datetime.datetime] = None,
        expiration: Optional["_models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(_Model):  # pylint: disable=name-too-long
    """Expiration of the role assignment schedule.

    :ivar type: Type of the role assignment schedule expiration. Known values are: "AfterDuration",
     "AfterDateTime", and "NoExpiration".
    :vartype type: str or ~azure.mgmt.authorization.models.Type
    :ivar end_date_time: End DateTime of the role assignment schedule.
    :vartype end_date_time: ~datetime.datetime
    :ivar duration: Duration of the role assignment schedule in TimeSpan.
    :vartype duration: str
    """

    type: Optional[Union[str, "_models.Type"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of the role assignment schedule expiration. Known values are: \"AfterDuration\",
     \"AfterDateTime\", and \"NoExpiration\"."""
    end_date_time: Optional[datetime.datetime] = rest_field(
        name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime of the role assignment schedule."""
    duration: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Duration of the role assignment schedule in TimeSpan."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.Type"]] = None,
        end_date_time: Optional[datetime.datetime] = 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 RoleAssignmentScheduleRequestPropertiesTicketInfo(_Model):  # pylint: disable=name-too-long
    """Ticket Info of the role assignment.

    :ivar ticket_number: Ticket number for the role assignment.
    :vartype ticket_number: str
    :ivar ticket_system: Ticket system name for the role assignment.
    :vartype ticket_system: str
    """

    ticket_number: Optional[str] = rest_field(
        name="ticketNumber", visibility=["read", "create", "update", "delete", "query"]
    )
    """Ticket number for the role assignment."""
    ticket_system: Optional[str] = rest_field(
        name="ticketSystem", visibility=["read", "create", "update", "delete", "query"]
    )
    """Ticket system name for the role assignment."""

    @overload
    def __init__(
        self,
        *,
        ticket_number: Optional[str] = None,
        ticket_system: 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 RoleDefinition(ProxyResource):
    """Role definition.

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

    properties: Optional["_models.RoleDefinitionProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role definition properties."""

    __flattened_items = [
        "role_name",
        "description",
        "role_type",
        "permissions",
        "assignable_scopes",
        "created_on",
        "updated_on",
        "created_by",
        "updated_by",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleDefinitionProperties(_Model):
    """Role definition properties.

    :ivar role_name: The role name.
    :vartype role_name: str
    :ivar description: The role definition description.
    :vartype description: str
    :ivar role_type: The role type.
    :vartype role_type: str
    :ivar permissions: Role definition permissions.
    :vartype permissions: list[~azure.mgmt.authorization.models.Permission]
    :ivar assignable_scopes: Role definition assignable scopes.
    :vartype assignable_scopes: list[str]
    :ivar created_on: Time it was created.
    :vartype created_on: ~datetime.datetime
    :ivar updated_on: Time it was updated.
    :vartype updated_on: ~datetime.datetime
    :ivar created_by: Id of the user who created the assignment.
    :vartype created_by: str
    :ivar updated_by: Id of the user who updated the assignment.
    :vartype updated_by: str
    """

    role_name: Optional[str] = rest_field(name="roleName", visibility=["read", "create", "update", "delete", "query"])
    """The role name."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role definition description."""
    role_type: Optional[str] = rest_field(name="type", visibility=["read", "create", "update", "delete", "query"])
    """The role type."""
    permissions: Optional[list["_models.Permission"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role definition permissions."""
    assignable_scopes: Optional[list[str]] = rest_field(
        name="assignableScopes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Role definition assignable scopes."""
    created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339")
    """Time it was created."""
    updated_on: Optional[datetime.datetime] = rest_field(name="updatedOn", visibility=["read"], format="rfc3339")
    """Time it was updated."""
    created_by: Optional[str] = rest_field(name="createdBy", visibility=["read"])
    """Id of the user who created the assignment."""
    updated_by: Optional[str] = rest_field(name="updatedBy", visibility=["read"])
    """Id of the user who updated the assignment."""

    @overload
    def __init__(
        self,
        *,
        role_name: Optional[str] = None,
        description: Optional[str] = None,
        role_type: Optional[str] = None,
        permissions: Optional[list["_models.Permission"]] = None,
        assignable_scopes: 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 RoleEligibilitySchedule(ExtensionResource):
    """Role eligibility 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.authorization.models.SystemData
    :ivar properties: role eligibility schedule properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleEligibilityScheduleProperties
    """

    properties: Optional["_models.RoleEligibilityScheduleProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """role eligibility schedule properties."""

    __flattened_items = [
        "scope",
        "role_definition_id",
        "principal_id",
        "principal_type",
        "role_eligibility_schedule_request_id",
        "member_type",
        "status",
        "start_date_time",
        "end_date_time",
        "condition",
        "condition_version",
        "created_on",
        "updated_on",
        "expanded_properties",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleEligibilityScheduleInstance(ExtensionResource):
    """Information about current or upcoming role eligibility schedule 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.authorization.models.SystemData
    :ivar properties: Role eligibility schedule instance properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleEligibilityScheduleInstanceProperties
    """

    properties: Optional["_models.RoleEligibilityScheduleInstanceProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role eligibility schedule instance properties."""

    __flattened_items = [
        "scope",
        "role_definition_id",
        "principal_id",
        "principal_type",
        "role_eligibility_schedule_id",
        "status",
        "start_date_time",
        "end_date_time",
        "member_type",
        "condition",
        "condition_version",
        "created_on",
        "expanded_properties",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleEligibilityScheduleInstanceProperties(_Model):  # pylint: disable=name-too-long
    """Role eligibility schedule properties with scope.

    :ivar scope: The role eligibility schedule scope.
    :vartype scope: str
    :ivar role_definition_id: The role definition ID.
    :vartype role_definition_id: str
    :ivar principal_id: The principal ID.
    :vartype principal_id: str
    :ivar principal_type: The principal type of the assigned principal ID. Known values are:
     "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.PrincipalType
    :ivar role_eligibility_schedule_id: Id of the master role eligibility schedule.
    :vartype role_eligibility_schedule_id: str
    :ivar status: The status of the role eligibility schedule instance. Known values are:
     "Accepted", "PendingEvaluation", "Granted", "Denied", "PendingProvisioning", "Provisioned",
     "PendingRevocation", "Revoked", "Canceled", "Failed", "PendingApprovalProvisioning",
     "PendingApproval", "FailedAsResourceIsLocked", "PendingAdminDecision", "AdminApproved",
     "AdminDenied", "TimedOut", "ProvisioningStarted", "Invalid", "PendingScheduleCreation",
     "ScheduleCreated", and "PendingExternalProvisioning".
    :vartype status: str or ~azure.mgmt.authorization.models.Status
    :ivar start_date_time: The startDateTime of the role eligibility schedule instance.
    :vartype start_date_time: ~datetime.datetime
    :ivar end_date_time: The endDateTime of the role eligibility schedule instance.
    :vartype end_date_time: ~datetime.datetime
    :ivar member_type: Membership type of the role eligibility schedule. Known values are:
     "Inherited", "Direct", and "Group".
    :vartype member_type: str or ~azure.mgmt.authorization.models.MemberType
    :ivar condition: The conditions on the role assignment. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition. Currently accepted value is '2.0'.
    :vartype condition_version: str
    :ivar created_on: DateTime when role eligibility schedule was created.
    :vartype created_on: ~datetime.datetime
    :ivar expanded_properties: Additional properties of principal, scope and role definition.
    :vartype expanded_properties: ~azure.mgmt.authorization.models.ExpandedProperties
    """

    scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role eligibility schedule scope."""
    role_definition_id: Optional[str] = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role definition ID."""
    principal_id: Optional[str] = rest_field(
        name="principalId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal ID."""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal type of the assigned principal ID. Known values are: \"User\", \"Group\",
     \"ServicePrincipal\", \"ForeignGroup\", and \"Device\"."""
    role_eligibility_schedule_id: Optional[str] = rest_field(
        name="roleEligibilityScheduleId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Id of the master role eligibility schedule."""
    status: Optional[Union[str, "_models.Status"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The status of the role eligibility schedule instance. Known values are: \"Accepted\",
     \"PendingEvaluation\", \"Granted\", \"Denied\", \"PendingProvisioning\", \"Provisioned\",
     \"PendingRevocation\", \"Revoked\", \"Canceled\", \"Failed\", \"PendingApprovalProvisioning\",
     \"PendingApproval\", \"FailedAsResourceIsLocked\", \"PendingAdminDecision\", \"AdminApproved\",
     \"AdminDenied\", \"TimedOut\", \"ProvisioningStarted\", \"Invalid\",
     \"PendingScheduleCreation\", \"ScheduleCreated\", and \"PendingExternalProvisioning\"."""
    start_date_time: Optional[datetime.datetime] = rest_field(
        name="startDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The startDateTime of the role eligibility schedule instance."""
    end_date_time: Optional[datetime.datetime] = rest_field(
        name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The endDateTime of the role eligibility schedule instance."""
    member_type: Optional[Union[str, "_models.MemberType"]] = rest_field(
        name="memberType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Membership type of the role eligibility schedule. Known values are: \"Inherited\", \"Direct\",
     and \"Group\"."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the role assignment. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition. Currently accepted value is '2.0'."""
    created_on: Optional[datetime.datetime] = rest_field(
        name="createdOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """DateTime when role eligibility schedule was created."""
    expanded_properties: Optional["_models.ExpandedProperties"] = rest_field(
        name="expandedProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Additional properties of principal, scope and role definition."""

    @overload
    def __init__(
        self,
        *,
        scope: Optional[str] = None,
        role_definition_id: Optional[str] = None,
        principal_id: Optional[str] = None,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        role_eligibility_schedule_id: Optional[str] = None,
        status: Optional[Union[str, "_models.Status"]] = None,
        start_date_time: Optional[datetime.datetime] = None,
        end_date_time: Optional[datetime.datetime] = None,
        member_type: Optional[Union[str, "_models.MemberType"]] = None,
        condition: Optional[str] = None,
        condition_version: Optional[str] = None,
        created_on: Optional[datetime.datetime] = None,
        expanded_properties: Optional["_models.ExpandedProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleEligibilityScheduleProperties(_Model):
    """Role eligibility schedule properties with scope.

    :ivar scope: The role eligibility schedule scope.
    :vartype scope: str
    :ivar role_definition_id: The role definition ID.
    :vartype role_definition_id: str
    :ivar principal_id: The principal ID.
    :vartype principal_id: str
    :ivar principal_type: The principal type of the assigned principal ID. Known values are:
     "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.PrincipalType
    :ivar role_eligibility_schedule_request_id: The id of roleEligibilityScheduleRequest used to
     create this roleAssignmentSchedule.
    :vartype role_eligibility_schedule_request_id: str
    :ivar member_type: Membership type of the role eligibility schedule. Known values are:
     "Inherited", "Direct", and "Group".
    :vartype member_type: str or ~azure.mgmt.authorization.models.MemberType
    :ivar status: The status of the role eligibility schedule. Known values are: "Accepted",
     "PendingEvaluation", "Granted", "Denied", "PendingProvisioning", "Provisioned",
     "PendingRevocation", "Revoked", "Canceled", "Failed", "PendingApprovalProvisioning",
     "PendingApproval", "FailedAsResourceIsLocked", "PendingAdminDecision", "AdminApproved",
     "AdminDenied", "TimedOut", "ProvisioningStarted", "Invalid", "PendingScheduleCreation",
     "ScheduleCreated", and "PendingExternalProvisioning".
    :vartype status: str or ~azure.mgmt.authorization.models.Status
    :ivar start_date_time: Start DateTime when role eligibility schedule.
    :vartype start_date_time: ~datetime.datetime
    :ivar end_date_time: End DateTime when role eligibility schedule.
    :vartype end_date_time: ~datetime.datetime
    :ivar condition: The conditions on the role assignment. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition. Currently accepted value is '2.0'.
    :vartype condition_version: str
    :ivar created_on: DateTime when role eligibility schedule was created.
    :vartype created_on: ~datetime.datetime
    :ivar updated_on: DateTime when role eligibility schedule was modified.
    :vartype updated_on: ~datetime.datetime
    :ivar expanded_properties: Additional properties of principal, scope and role definition.
    :vartype expanded_properties: ~azure.mgmt.authorization.models.ExpandedProperties
    """

    scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role eligibility schedule scope."""
    role_definition_id: Optional[str] = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role definition ID."""
    principal_id: Optional[str] = rest_field(
        name="principalId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal ID."""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The principal type of the assigned principal ID. Known values are: \"User\", \"Group\",
     \"ServicePrincipal\", \"ForeignGroup\", and \"Device\"."""
    role_eligibility_schedule_request_id: Optional[str] = rest_field(
        name="roleEligibilityScheduleRequestId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The id of roleEligibilityScheduleRequest used to create this roleAssignmentSchedule."""
    member_type: Optional[Union[str, "_models.MemberType"]] = rest_field(
        name="memberType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Membership type of the role eligibility schedule. Known values are: \"Inherited\", \"Direct\",
     and \"Group\"."""
    status: Optional[Union[str, "_models.Status"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The status of the role eligibility schedule. Known values are: \"Accepted\",
     \"PendingEvaluation\", \"Granted\", \"Denied\", \"PendingProvisioning\", \"Provisioned\",
     \"PendingRevocation\", \"Revoked\", \"Canceled\", \"Failed\", \"PendingApprovalProvisioning\",
     \"PendingApproval\", \"FailedAsResourceIsLocked\", \"PendingAdminDecision\", \"AdminApproved\",
     \"AdminDenied\", \"TimedOut\", \"ProvisioningStarted\", \"Invalid\",
     \"PendingScheduleCreation\", \"ScheduleCreated\", and \"PendingExternalProvisioning\"."""
    start_date_time: Optional[datetime.datetime] = rest_field(
        name="startDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start DateTime when role eligibility schedule."""
    end_date_time: Optional[datetime.datetime] = rest_field(
        name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime when role eligibility schedule."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the role assignment. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition. Currently accepted value is '2.0'."""
    created_on: Optional[datetime.datetime] = rest_field(
        name="createdOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """DateTime when role eligibility schedule was created."""
    updated_on: Optional[datetime.datetime] = rest_field(
        name="updatedOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """DateTime when role eligibility schedule was modified."""
    expanded_properties: Optional["_models.ExpandedProperties"] = rest_field(
        name="expandedProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Additional properties of principal, scope and role definition."""

    @overload
    def __init__(
        self,
        *,
        scope: Optional[str] = None,
        role_definition_id: Optional[str] = None,
        principal_id: Optional[str] = None,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        role_eligibility_schedule_request_id: Optional[str] = None,
        member_type: Optional[Union[str, "_models.MemberType"]] = None,
        status: Optional[Union[str, "_models.Status"]] = None,
        start_date_time: Optional[datetime.datetime] = None,
        end_date_time: Optional[datetime.datetime] = None,
        condition: Optional[str] = None,
        condition_version: Optional[str] = None,
        created_on: Optional[datetime.datetime] = None,
        updated_on: Optional[datetime.datetime] = None,
        expanded_properties: Optional["_models.ExpandedProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleEligibilityScheduleRequest(ExtensionResource):
    """Role Eligibility schedule 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.authorization.models.SystemData
    :ivar properties: Role eligibility schedule request properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleEligibilityScheduleRequestProperties
    """

    properties: Optional["_models.RoleEligibilityScheduleRequestProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role eligibility schedule request properties."""

    __flattened_items = [
        "scope",
        "role_definition_id",
        "principal_id",
        "principal_type",
        "request_type",
        "status",
        "approval_id",
        "schedule_info",
        "target_role_eligibility_schedule_id",
        "target_role_eligibility_schedule_instance_id",
        "justification",
        "ticket_info",
        "condition",
        "condition_version",
        "created_on",
        "requestor_id",
        "expanded_properties",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleEligibilityScheduleRequestProperties(_Model):
    """Role eligibility schedule request properties with scope.

    :ivar scope: The role eligibility schedule request scope.
    :vartype scope: str
    :ivar role_definition_id: The role definition ID. Required.
    :vartype role_definition_id: str
    :ivar principal_id: The principal ID. Required.
    :vartype principal_id: str
    :ivar principal_type: The principal type of the assigned principal ID. Known values are:
     "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device".
    :vartype principal_type: str or ~azure.mgmt.authorization.models.PrincipalType
    :ivar request_type: The type of the role assignment schedule request. Eg: SelfActivate,
     AdminAssign etc. Required. Known values are: "AdminAssign", "AdminRemove", "AdminUpdate",
     "AdminExtend", "AdminRenew", "SelfActivate", "SelfDeactivate", "SelfExtend", and "SelfRenew".
    :vartype request_type: str or ~azure.mgmt.authorization.models.RequestType
    :ivar status: The status of the role eligibility schedule request. Known values are:
     "Accepted", "PendingEvaluation", "Granted", "Denied", "PendingProvisioning", "Provisioned",
     "PendingRevocation", "Revoked", "Canceled", "Failed", "PendingApprovalProvisioning",
     "PendingApproval", "FailedAsResourceIsLocked", "PendingAdminDecision", "AdminApproved",
     "AdminDenied", "TimedOut", "ProvisioningStarted", "Invalid", "PendingScheduleCreation",
     "ScheduleCreated", and "PendingExternalProvisioning".
    :vartype status: str or ~azure.mgmt.authorization.models.Status
    :ivar approval_id: The approvalId of the role eligibility schedule request.
    :vartype approval_id: str
    :ivar schedule_info: Schedule info of the role eligibility schedule.
    :vartype schedule_info:
     ~azure.mgmt.authorization.models.RoleEligibilityScheduleRequestPropertiesScheduleInfo
    :ivar target_role_eligibility_schedule_id: The resultant role eligibility schedule id or the
     role eligibility schedule id being updated.
    :vartype target_role_eligibility_schedule_id: str
    :ivar target_role_eligibility_schedule_instance_id: The role eligibility schedule instance id
     being updated.
    :vartype target_role_eligibility_schedule_instance_id: str
    :ivar justification: Justification for the role eligibility.
    :vartype justification: str
    :ivar ticket_info: Ticket Info of the role eligibility.
    :vartype ticket_info:
     ~azure.mgmt.authorization.models.RoleEligibilityScheduleRequestPropertiesTicketInfo
    :ivar condition: The conditions on the role assignment. This limits the resources it can be
     assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'.
    :vartype condition: str
    :ivar condition_version: Version of the condition. Currently accepted value is '2.0'.
    :vartype condition_version: str
    :ivar created_on: DateTime when role eligibility schedule request was created.
    :vartype created_on: ~datetime.datetime
    :ivar requestor_id: Id of the user who created this request.
    :vartype requestor_id: str
    :ivar expanded_properties: Additional properties of principal, scope and role definition.
    :vartype expanded_properties: ~azure.mgmt.authorization.models.ExpandedProperties
    """

    scope: Optional[str] = rest_field(visibility=["read"])
    """The role eligibility schedule request scope."""
    role_definition_id: str = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role definition ID. Required."""
    principal_id: str = rest_field(name="principalId", visibility=["read", "create", "update", "delete", "query"])
    """The principal ID. Required."""
    principal_type: Optional[Union[str, "_models.PrincipalType"]] = rest_field(
        name="principalType", visibility=["read"]
    )
    """The principal type of the assigned principal ID. Known values are: \"User\", \"Group\",
     \"ServicePrincipal\", \"ForeignGroup\", and \"Device\"."""
    request_type: Union[str, "_models.RequestType"] = rest_field(
        name="requestType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc. Required.
     Known values are: \"AdminAssign\", \"AdminRemove\", \"AdminUpdate\", \"AdminExtend\",
     \"AdminRenew\", \"SelfActivate\", \"SelfDeactivate\", \"SelfExtend\", and \"SelfRenew\"."""
    status: Optional[Union[str, "_models.Status"]] = rest_field(visibility=["read"])
    """The status of the role eligibility schedule request. Known values are: \"Accepted\",
     \"PendingEvaluation\", \"Granted\", \"Denied\", \"PendingProvisioning\", \"Provisioned\",
     \"PendingRevocation\", \"Revoked\", \"Canceled\", \"Failed\", \"PendingApprovalProvisioning\",
     \"PendingApproval\", \"FailedAsResourceIsLocked\", \"PendingAdminDecision\", \"AdminApproved\",
     \"AdminDenied\", \"TimedOut\", \"ProvisioningStarted\", \"Invalid\",
     \"PendingScheduleCreation\", \"ScheduleCreated\", and \"PendingExternalProvisioning\"."""
    approval_id: Optional[str] = rest_field(name="approvalId", visibility=["read"])
    """The approvalId of the role eligibility schedule request."""
    schedule_info: Optional["_models.RoleEligibilityScheduleRequestPropertiesScheduleInfo"] = rest_field(
        name="scheduleInfo", visibility=["read", "create", "update", "delete", "query"]
    )
    """Schedule info of the role eligibility schedule."""
    target_role_eligibility_schedule_id: Optional[str] = rest_field(
        name="targetRoleEligibilityScheduleId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resultant role eligibility schedule id or the role eligibility schedule id being updated."""
    target_role_eligibility_schedule_instance_id: Optional[str] = rest_field(
        name="targetRoleEligibilityScheduleInstanceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role eligibility schedule instance id being updated."""
    justification: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Justification for the role eligibility."""
    ticket_info: Optional["_models.RoleEligibilityScheduleRequestPropertiesTicketInfo"] = rest_field(
        name="ticketInfo", visibility=["read", "create", "update", "delete", "query"]
    )
    """Ticket Info of the role eligibility."""
    condition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The conditions on the role assignment. This limits the resources it can be assigned to. e.g.:
     @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]
     StringEqualsIgnoreCase 'foo_storage_container'."""
    condition_version: Optional[str] = rest_field(
        name="conditionVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Version of the condition. Currently accepted value is '2.0'."""
    created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339")
    """DateTime when role eligibility schedule request was created."""
    requestor_id: Optional[str] = rest_field(name="requestorId", visibility=["read"])
    """Id of the user who created this request."""
    expanded_properties: Optional["_models.ExpandedProperties"] = rest_field(
        name="expandedProperties", visibility=["read"]
    )
    """Additional properties of principal, scope and role definition."""

    @overload
    def __init__(
        self,
        *,
        role_definition_id: str,
        principal_id: str,
        request_type: Union[str, "_models.RequestType"],
        schedule_info: Optional["_models.RoleEligibilityScheduleRequestPropertiesScheduleInfo"] = None,
        target_role_eligibility_schedule_id: Optional[str] = None,
        target_role_eligibility_schedule_instance_id: Optional[str] = None,
        justification: Optional[str] = None,
        ticket_info: Optional["_models.RoleEligibilityScheduleRequestPropertiesTicketInfo"] = None,
        condition: Optional[str] = None,
        condition_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 RoleEligibilityScheduleRequestPropertiesScheduleInfo(_Model):  # pylint: disable=name-too-long
    """Schedule info of the role eligibility schedule.

    :ivar start_date_time: Start DateTime of the role eligibility schedule.
    :vartype start_date_time: ~datetime.datetime
    :ivar expiration: Expiration of the role eligibility schedule.
    :vartype expiration:
     ~azure.mgmt.authorization.models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration
    """

    start_date_time: Optional[datetime.datetime] = rest_field(
        name="startDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start DateTime of the role eligibility schedule."""
    expiration: Optional["_models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Expiration of the role eligibility schedule."""

    @overload
    def __init__(
        self,
        *,
        start_date_time: Optional[datetime.datetime] = None,
        expiration: Optional["_models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(_Model):  # pylint: disable=name-too-long
    """Expiration of the role eligibility schedule.

    :ivar type: Type of the role eligibility schedule expiration. Known values are:
     "AfterDuration", "AfterDateTime", and "NoExpiration".
    :vartype type: str or ~azure.mgmt.authorization.models.Type
    :ivar end_date_time: End DateTime of the role eligibility schedule.
    :vartype end_date_time: ~datetime.datetime
    :ivar duration: Duration of the role eligibility schedule in TimeSpan.
    :vartype duration: str
    """

    type: Optional[Union[str, "_models.Type"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Type of the role eligibility schedule expiration. Known values are: \"AfterDuration\",
     \"AfterDateTime\", and \"NoExpiration\"."""
    end_date_time: Optional[datetime.datetime] = rest_field(
        name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime of the role eligibility schedule."""
    duration: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Duration of the role eligibility schedule in TimeSpan."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.Type"]] = None,
        end_date_time: Optional[datetime.datetime] = 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 RoleEligibilityScheduleRequestPropertiesTicketInfo(_Model):  # pylint: disable=name-too-long
    """Ticket Info of the role eligibility.

    :ivar ticket_number: Ticket number for the role eligibility.
    :vartype ticket_number: str
    :ivar ticket_system: Ticket system name for the role eligibility.
    :vartype ticket_system: str
    """

    ticket_number: Optional[str] = rest_field(
        name="ticketNumber", visibility=["read", "create", "update", "delete", "query"]
    )
    """Ticket number for the role eligibility."""
    ticket_system: Optional[str] = rest_field(
        name="ticketSystem", visibility=["read", "create", "update", "delete", "query"]
    )
    """Ticket system name for the role eligibility."""

    @overload
    def __init__(
        self,
        *,
        ticket_number: Optional[str] = None,
        ticket_system: 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 RoleManagementPolicy(ExtensionResource):
    """Role management 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.authorization.models.SystemData
    :ivar properties: Role management policy properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleManagementPolicyProperties
    """

    properties: Optional["_models.RoleManagementPolicyProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role management policy properties."""

    __flattened_items = [
        "scope",
        "display_name",
        "description",
        "is_organization_default",
        "last_modified_by",
        "last_modified_date_time",
        "rules",
        "effective_rules",
        "policy_properties",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleManagementPolicyRule(_Model):
    """The role management policy rule.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    RoleManagementPolicyApprovalRule, RoleManagementPolicyAuthenticationContextRule,
    RoleManagementPolicyEnablementRule, RoleManagementPolicyExpirationRule,
    RoleManagementPolicyNotificationRule, RoleManagementPolicyPimOnlyModeRule

    :ivar id: The id of the rule.
    :vartype id: str
    :ivar rule_type: The type of rule. Required. Known values are:
     "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule",
     "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule",
     "RoleManagementPolicyNotificationRule", and "RoleManagementPolicyPimOnlyModeRule".
    :vartype rule_type: str or ~azure.mgmt.authorization.models.RoleManagementPolicyRuleType
    :ivar target: The target of the current rule.
    :vartype target: ~azure.mgmt.authorization.models.RoleManagementPolicyRuleTarget
    """

    __mapping__: dict[str, _Model] = {}
    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The id of the rule."""
    rule_type: str = rest_discriminator(name="ruleType", visibility=["read", "create", "update", "delete", "query"])
    """The type of rule. Required. Known values are: \"RoleManagementPolicyApprovalRule\",
     \"RoleManagementPolicyAuthenticationContextRule\", \"RoleManagementPolicyEnablementRule\",
     \"RoleManagementPolicyExpirationRule\", \"RoleManagementPolicyNotificationRule\", and
     \"RoleManagementPolicyPimOnlyModeRule\"."""
    target: Optional["_models.RoleManagementPolicyRuleTarget"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The target of the current rule."""

    @overload
    def __init__(
        self,
        *,
        rule_type: str,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        target: Optional["_models.RoleManagementPolicyRuleTarget"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleManagementPolicyApprovalRule(RoleManagementPolicyRule, discriminator="RoleManagementPolicyApprovalRule"):
    """The role management policy approval rule.

    :ivar id: The id of the rule.
    :vartype id: str
    :ivar target: The target of the current rule.
    :vartype target: ~azure.mgmt.authorization.models.RoleManagementPolicyRuleTarget
    :ivar setting: The approval setting.
    :vartype setting: ~azure.mgmt.authorization.models.ApprovalSettings
    :ivar rule_type: The type of rule. Required. RoleManagementPolicyApprovalRule.
    :vartype rule_type: str or
     ~azure.mgmt.authorization.models.ROLE_MANAGEMENT_POLICY_APPROVAL_RULE
    """

    setting: Optional["_models.ApprovalSettings"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The approval setting."""
    rule_type: Literal[RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_APPROVAL_RULE] = rest_discriminator(name="ruleType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of rule. Required. RoleManagementPolicyApprovalRule."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        target: Optional["_models.RoleManagementPolicyRuleTarget"] = None,
        setting: Optional["_models.ApprovalSettings"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.rule_type = RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_APPROVAL_RULE  # type: ignore


class RoleManagementPolicyAssignment(ExtensionResource):
    """Role management 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.authorization.models.SystemData
    :ivar properties: Role management policy properties.
    :vartype properties: ~azure.mgmt.authorization.models.RoleManagementPolicyAssignmentProperties
    """

    properties: Optional["_models.RoleManagementPolicyAssignmentProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role management policy properties."""

    __flattened_items = ["scope", "role_definition_id", "policy_id", "effective_rules", "policy_assignment_properties"]

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

    @overload
    def __init__(self, mapping: Mapping[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 RoleManagementPolicyAssignmentProperties(_Model):
    """Role management policy assignment properties with scope.

    :ivar scope: The role management policy scope.
    :vartype scope: str
    :ivar role_definition_id: The role definition of management policy assignment.
    :vartype role_definition_id: str
    :ivar policy_id: The policy id role management policy assignment.
    :vartype policy_id: str
    :ivar effective_rules: The readonly computed rule applied to the policy.
    :vartype effective_rules: list[~azure.mgmt.authorization.models.RoleManagementPolicyRule]
    :ivar policy_assignment_properties: Additional properties of scope, role definition and policy.
    :vartype policy_assignment_properties:
     ~azure.mgmt.authorization.models.PolicyAssignmentProperties
    """

    scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role management policy scope."""
    role_definition_id: Optional[str] = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role definition of management policy assignment."""
    policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"])
    """The policy id role management policy assignment."""
    effective_rules: Optional[list["_models.RoleManagementPolicyRule"]] = rest_field(
        name="effectiveRules", visibility=["read"]
    )
    """The readonly computed rule applied to the policy."""
    policy_assignment_properties: Optional["_models.PolicyAssignmentProperties"] = rest_field(
        name="policyAssignmentProperties", visibility=["read"]
    )
    """Additional properties of scope, role definition and policy."""

    @overload
    def __init__(
        self,
        *,
        scope: Optional[str] = None,
        role_definition_id: Optional[str] = None,
        policy_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 RoleManagementPolicyAuthenticationContextRule(
    RoleManagementPolicyRule, discriminator="RoleManagementPolicyAuthenticationContextRule"
):  # pylint: disable=name-too-long
    """The role management policy authentication context rule.

    :ivar id: The id of the rule.
    :vartype id: str
    :ivar target: The target of the current rule.
    :vartype target: ~azure.mgmt.authorization.models.RoleManagementPolicyRuleTarget
    :ivar is_enabled: The value indicating if rule is enabled.
    :vartype is_enabled: bool
    :ivar claim_value: The claim value.
    :vartype claim_value: str
    :ivar rule_type: The type of rule. Required. RoleManagementPolicyAuthenticationContextRule.
    :vartype rule_type: str or
     ~azure.mgmt.authorization.models.ROLE_MANAGEMENT_POLICY_AUTHENTICATION_CONTEXT_RULE
    """

    is_enabled: Optional[bool] = rest_field(
        name="isEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """The value indicating if rule is enabled."""
    claim_value: Optional[str] = rest_field(
        name="claimValue", visibility=["read", "create", "update", "delete", "query"]
    )
    """The claim value."""
    rule_type: Literal[RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_AUTHENTICATION_CONTEXT_RULE] = rest_discriminator(name="ruleType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of rule. Required. RoleManagementPolicyAuthenticationContextRule."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        target: Optional["_models.RoleManagementPolicyRuleTarget"] = None,
        is_enabled: Optional[bool] = None,
        claim_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)
        self.rule_type = RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_AUTHENTICATION_CONTEXT_RULE  # type: ignore


class RoleManagementPolicyEnablementRule(RoleManagementPolicyRule, discriminator="RoleManagementPolicyEnablementRule"):
    """The role management policy enablement rule.

    :ivar id: The id of the rule.
    :vartype id: str
    :ivar target: The target of the current rule.
    :vartype target: ~azure.mgmt.authorization.models.RoleManagementPolicyRuleTarget
    :ivar enabled_rules: The list of enabled rules.
    :vartype enabled_rules: list[str or ~azure.mgmt.authorization.models.EnablementRules]
    :ivar rule_type: The type of rule. Required. RoleManagementPolicyEnablementRule.
    :vartype rule_type: str or
     ~azure.mgmt.authorization.models.ROLE_MANAGEMENT_POLICY_ENABLEMENT_RULE
    """

    enabled_rules: Optional[list[Union[str, "_models.EnablementRules"]]] = rest_field(
        name="enabledRules", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of enabled rules."""
    rule_type: Literal[RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_ENABLEMENT_RULE] = rest_discriminator(name="ruleType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of rule. Required. RoleManagementPolicyEnablementRule."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        target: Optional["_models.RoleManagementPolicyRuleTarget"] = None,
        enabled_rules: Optional[list[Union[str, "_models.EnablementRules"]]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.rule_type = RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_ENABLEMENT_RULE  # type: ignore


class RoleManagementPolicyExpirationRule(RoleManagementPolicyRule, discriminator="RoleManagementPolicyExpirationRule"):
    """The role management policy expiration rule.

    :ivar id: The id of the rule.
    :vartype id: str
    :ivar target: The target of the current rule.
    :vartype target: ~azure.mgmt.authorization.models.RoleManagementPolicyRuleTarget
    :ivar is_expiration_required: The value indicating whether expiration is required.
    :vartype is_expiration_required: bool
    :ivar maximum_duration: The maximum duration of expiration in timespan.
    :vartype maximum_duration: str
    :ivar exception_members: The members not restricted by expiration rule.
    :vartype exception_members: list[~azure.mgmt.authorization.models.UserSet]
    :ivar rule_type: The type of rule. Required. RoleManagementPolicyExpirationRule.
    :vartype rule_type: str or
     ~azure.mgmt.authorization.models.ROLE_MANAGEMENT_POLICY_EXPIRATION_RULE
    """

    is_expiration_required: Optional[bool] = rest_field(
        name="isExpirationRequired", visibility=["read", "create", "update", "delete", "query"]
    )
    """The value indicating whether expiration is required."""
    maximum_duration: Optional[str] = rest_field(
        name="maximumDuration", visibility=["read", "create", "update", "delete", "query"]
    )
    """The maximum duration of expiration in timespan."""
    exception_members: Optional[list["_models.UserSet"]] = rest_field(
        name="exceptionMembers", visibility=["read", "create", "update", "delete", "query"]
    )
    """The members not restricted by expiration rule."""
    rule_type: Literal[RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_EXPIRATION_RULE] = rest_discriminator(name="ruleType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of rule. Required. RoleManagementPolicyExpirationRule."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        target: Optional["_models.RoleManagementPolicyRuleTarget"] = None,
        is_expiration_required: Optional[bool] = None,
        maximum_duration: Optional[str] = None,
        exception_members: Optional[list["_models.UserSet"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.rule_type = RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_EXPIRATION_RULE  # type: ignore


class RoleManagementPolicyNotificationRule(
    RoleManagementPolicyRule, discriminator="RoleManagementPolicyNotificationRule"
):
    """The role management policy notification rule.

    :ivar id: The id of the rule.
    :vartype id: str
    :ivar target: The target of the current rule.
    :vartype target: ~azure.mgmt.authorization.models.RoleManagementPolicyRuleTarget
    :ivar notification_type: The type of notification. "Email"
    :vartype notification_type: str or
     ~azure.mgmt.authorization.models.NotificationDeliveryMechanism
    :ivar notification_level: The notification level. Known values are: "None", "Critical", and
     "All".
    :vartype notification_level: str or ~azure.mgmt.authorization.models.NotificationLevel
    :ivar recipient_type: The recipient type. Known values are: "Requestor", "Approver", and
     "Admin".
    :vartype recipient_type: str or ~azure.mgmt.authorization.models.RecipientType
    :ivar notification_recipients: The list of notification recipients.
    :vartype notification_recipients: list[str]
    :ivar is_default_recipients_enabled: Determines if the notification will be sent to the
     recipient type specified in the policy rule.
    :vartype is_default_recipients_enabled: bool
    :ivar rule_type: The type of rule. Required. RoleManagementPolicyNotificationRule.
    :vartype rule_type: str or
     ~azure.mgmt.authorization.models.ROLE_MANAGEMENT_POLICY_NOTIFICATION_RULE
    """

    notification_type: Optional[Union[str, "_models.NotificationDeliveryMechanism"]] = rest_field(
        name="notificationType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of notification. \"Email\""""
    notification_level: Optional[Union[str, "_models.NotificationLevel"]] = rest_field(
        name="notificationLevel", visibility=["read", "create", "update", "delete", "query"]
    )
    """The notification level. Known values are: \"None\", \"Critical\", and \"All\"."""
    recipient_type: Optional[Union[str, "_models.RecipientType"]] = rest_field(
        name="recipientType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The recipient type. Known values are: \"Requestor\", \"Approver\", and \"Admin\"."""
    notification_recipients: Optional[list[str]] = rest_field(
        name="notificationRecipients", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of notification recipients."""
    is_default_recipients_enabled: Optional[bool] = rest_field(
        name="isDefaultRecipientsEnabled", visibility=["read", "create", "update", "delete", "query"]
    )
    """Determines if the notification will be sent to the recipient type specified in the policy rule."""
    rule_type: Literal[RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_NOTIFICATION_RULE] = rest_discriminator(name="ruleType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of rule. Required. RoleManagementPolicyNotificationRule."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        target: Optional["_models.RoleManagementPolicyRuleTarget"] = None,
        notification_type: Optional[Union[str, "_models.NotificationDeliveryMechanism"]] = None,
        notification_level: Optional[Union[str, "_models.NotificationLevel"]] = None,
        recipient_type: Optional[Union[str, "_models.RecipientType"]] = None,
        notification_recipients: Optional[list[str]] = None,
        is_default_recipients_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)
        self.rule_type = RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_NOTIFICATION_RULE  # type: ignore


class RoleManagementPolicyPimOnlyModeRule(
    RoleManagementPolicyRule, discriminator="RoleManagementPolicyPimOnlyModeRule"
):
    """The role management policy PIM only mode rule.

    :ivar id: The id of the rule.
    :vartype id: str
    :ivar target: The target of the current rule.
    :vartype target: ~azure.mgmt.authorization.models.RoleManagementPolicyRuleTarget
    :ivar pim_only_mode_settings: The PIM Only Mode settings.
    :vartype pim_only_mode_settings: ~azure.mgmt.authorization.models.PIMOnlyModeSettings
    :ivar rule_type: The type of rule. Required. RoleManagementPolicyPimOnlyModeRule.
    :vartype rule_type: str or
     ~azure.mgmt.authorization.models.ROLE_MANAGEMENT_POLICY_PIM_ONLY_MODE_RULE
    """

    pim_only_mode_settings: Optional["_models.PIMOnlyModeSettings"] = rest_field(
        name="pimOnlyModeSettings", visibility=["read", "create", "update", "delete", "query"]
    )
    """The PIM Only Mode settings."""
    rule_type: Literal[RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_PIM_ONLY_MODE_RULE] = rest_discriminator(name="ruleType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of rule. Required. RoleManagementPolicyPimOnlyModeRule."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        target: Optional["_models.RoleManagementPolicyRuleTarget"] = None,
        pim_only_mode_settings: Optional["_models.PIMOnlyModeSettings"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.rule_type = RoleManagementPolicyRuleType.ROLE_MANAGEMENT_POLICY_PIM_ONLY_MODE_RULE  # type: ignore


class RoleManagementPolicyProperties(_Model):
    """Role management policy properties with scope.

    :ivar scope: The role management policy scope.
    :vartype scope: str
    :ivar display_name: The role management policy display name.
    :vartype display_name: str
    :ivar description: The role management policy description.
    :vartype description: str
    :ivar is_organization_default: The role management policy is default policy.
    :vartype is_organization_default: bool
    :ivar last_modified_by: The name of the entity last modified it.
    :vartype last_modified_by: ~azure.mgmt.authorization.models.Principal
    :ivar last_modified_date_time: The last modified date time.
    :vartype last_modified_date_time: ~datetime.datetime
    :ivar rules: The rule applied to the policy.
    :vartype rules: list[~azure.mgmt.authorization.models.RoleManagementPolicyRule]
    :ivar effective_rules: The readonly computed rule applied to the policy.
    :vartype effective_rules: list[~azure.mgmt.authorization.models.RoleManagementPolicyRule]
    :ivar policy_properties: Additional properties of scope.
    :vartype policy_properties: ~azure.mgmt.authorization.models.PolicyProperties
    """

    scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role management policy scope."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role management policy display name."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The role management policy description."""
    is_organization_default: Optional[bool] = rest_field(
        name="isOrganizationDefault", visibility=["read", "create", "update", "delete", "query"]
    )
    """The role management policy is default policy."""
    last_modified_by: Optional["_models.Principal"] = rest_field(name="lastModifiedBy", visibility=["read"])
    """The name of the entity last modified it."""
    last_modified_date_time: Optional[datetime.datetime] = rest_field(
        name="lastModifiedDateTime", visibility=["read"], format="rfc3339"
    )
    """The last modified date time."""
    rules: Optional[list["_models.RoleManagementPolicyRule"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The rule applied to the policy."""
    effective_rules: Optional[list["_models.RoleManagementPolicyRule"]] = rest_field(
        name="effectiveRules", visibility=["read"]
    )
    """The readonly computed rule applied to the policy."""
    policy_properties: Optional["_models.PolicyProperties"] = rest_field(name="policyProperties", visibility=["read"])
    """Additional properties of scope."""

    @overload
    def __init__(
        self,
        *,
        scope: Optional[str] = None,
        display_name: Optional[str] = None,
        description: Optional[str] = None,
        is_organization_default: Optional[bool] = None,
        rules: Optional[list["_models.RoleManagementPolicyRule"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 RoleManagementPolicyRuleTarget(_Model):
    """The role management policy rule target.

    :ivar caller: The caller of the setting.
    :vartype caller: str
    :ivar operations: The type of operation.
    :vartype operations: list[str]
    :ivar level: The assignment level to which rule is applied.
    :vartype level: str
    :ivar target_objects: The list of target objects.
    :vartype target_objects: list[str]
    :ivar inheritable_settings: The list of inheritable settings.
    :vartype inheritable_settings: list[str]
    :ivar enforced_settings: The list of enforced settings.
    :vartype enforced_settings: list[str]
    """

    caller: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The caller of the setting."""
    operations: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The type of operation."""
    level: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The assignment level to which rule is applied."""
    target_objects: Optional[list[str]] = rest_field(
        name="targetObjects", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of target objects."""
    inheritable_settings: Optional[list[str]] = rest_field(
        name="inheritableSettings", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of inheritable settings."""
    enforced_settings: Optional[list[str]] = rest_field(
        name="enforcedSettings", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of enforced settings."""

    @overload
    def __init__(
        self,
        *,
        caller: Optional[str] = None,
        operations: Optional[list[str]] = None,
        level: Optional[str] = None,
        target_objects: Optional[list[str]] = None,
        inheritable_settings: Optional[list[str]] = None,
        enforced_settings: 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 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.authorization.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.authorization.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 TooManyOwnersAssignedToResourceAlertConfigurationProperties(
    AlertConfigurationProperties, discriminator="TooManyOwnersAssignedToResourceAlertConfiguration"
):  # pylint: disable=name-too-long
    """Too many owners assigned to resource alert configuration properties.

    :ivar alert_definition_id: The alert definition ID.
    :vartype alert_definition_id: str
    :ivar scope: The alert scope.
    :vartype scope: str
    :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the
     specific alert.
    :vartype is_enabled: bool
    :ivar alert_definition: The alert definition.
    :vartype alert_definition: ~azure.mgmt.authorization.models.AlertDefinition
    :ivar threshold_number_of_owners: The threshold number of owners.
    :vartype threshold_number_of_owners: int
    :ivar threshold_percentage_of_owners_out_of_all_role_members: The threshold percentage of
     owners out of all role members.
    :vartype threshold_percentage_of_owners_out_of_all_role_members: int
    :ivar alert_configuration_type: The alert configuration type. Required. Default value is
     "TooManyOwnersAssignedToResourceAlertConfiguration".
    :vartype alert_configuration_type: str
    """

    threshold_number_of_owners: Optional[int] = rest_field(
        name="thresholdNumberOfOwners", visibility=["read", "create", "update", "delete", "query"]
    )
    """The threshold number of owners."""
    threshold_percentage_of_owners_out_of_all_role_members: Optional[int] = rest_field(
        name="thresholdPercentageOfOwnersOutOfAllRoleMembers",
        visibility=["read", "create", "update", "delete", "query"],
    )
    """The threshold percentage of owners out of all role members."""
    alert_configuration_type: Literal["TooManyOwnersAssignedToResourceAlertConfiguration"] = rest_discriminator(name="alertConfigurationType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The alert configuration type. Required. Default value is
     \"TooManyOwnersAssignedToResourceAlertConfiguration\"."""

    @overload
    def __init__(
        self,
        *,
        is_enabled: Optional[bool] = None,
        threshold_number_of_owners: Optional[int] = None,
        threshold_percentage_of_owners_out_of_all_role_members: 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)
        self.alert_configuration_type = "TooManyOwnersAssignedToResourceAlertConfiguration"  # type: ignore


class TooManyOwnersAssignedToResourceAlertIncidentProperties(
    AlertIncidentProperties, discriminator="TooManyOwnersAssignedToResourceAlertIncident"
):  # pylint: disable=name-too-long
    """Too many owners assigned to resource alert incident properties.

    :ivar assignee_name: The assignee name.
    :vartype assignee_name: str
    :ivar assignee_type: The assignee type.
    :vartype assignee_type: str
    :ivar alert_incident_type: The alert incident type. Required. Default value is
     "TooManyOwnersAssignedToResourceAlertIncident".
    :vartype alert_incident_type: str
    """

    assignee_name: Optional[str] = rest_field(name="assigneeName", visibility=["read"])
    """The assignee name."""
    assignee_type: Optional[str] = rest_field(name="assigneeType", visibility=["read"])
    """The assignee type."""
    alert_incident_type: Literal["TooManyOwnersAssignedToResourceAlertIncident"] = rest_discriminator(name="alertIncidentType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The alert incident type. Required. Default value is
     \"TooManyOwnersAssignedToResourceAlertIncident\"."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.alert_incident_type = "TooManyOwnersAssignedToResourceAlertIncident"  # type: ignore


class TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties(
    AlertConfigurationProperties, discriminator="TooManyPermanentOwnersAssignedToResourceAlertConfiguration"
):  # pylint: disable=name-too-long
    """Too many permanent owners assigned to resource alert configuration properties.

    :ivar alert_definition_id: The alert definition ID.
    :vartype alert_definition_id: str
    :ivar scope: The alert scope.
    :vartype scope: str
    :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the
     specific alert.
    :vartype is_enabled: bool
    :ivar alert_definition: The alert definition.
    :vartype alert_definition: ~azure.mgmt.authorization.models.AlertDefinition
    :ivar threshold_number_of_permanent_owners: The threshold number of permanent owners.
    :vartype threshold_number_of_permanent_owners: int
    :ivar threshold_percentage_of_permanent_owners_out_of_all_owners: The threshold percentage of
     permanent owners out of all owners.
    :vartype threshold_percentage_of_permanent_owners_out_of_all_owners: int
    :ivar alert_configuration_type: The alert configuration type. Required. Default value is
     "TooManyPermanentOwnersAssignedToResourceAlertConfiguration".
    :vartype alert_configuration_type: str
    """

    threshold_number_of_permanent_owners: Optional[int] = rest_field(
        name="thresholdNumberOfPermanentOwners", visibility=["read", "create", "update", "delete", "query"]
    )
    """The threshold number of permanent owners."""
    threshold_percentage_of_permanent_owners_out_of_all_owners: Optional[int] = rest_field(
        name="thresholdPercentageOfPermanentOwnersOutOfAllOwners",
        visibility=["read", "create", "update", "delete", "query"],
    )
    """The threshold percentage of permanent owners out of all owners."""
    alert_configuration_type: Literal["TooManyPermanentOwnersAssignedToResourceAlertConfiguration"] = rest_discriminator(name="alertConfigurationType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The alert configuration type. Required. Default value is
     \"TooManyPermanentOwnersAssignedToResourceAlertConfiguration\"."""

    @overload
    def __init__(
        self,
        *,
        is_enabled: Optional[bool] = None,
        threshold_number_of_permanent_owners: Optional[int] = None,
        threshold_percentage_of_permanent_owners_out_of_all_owners: 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)
        self.alert_configuration_type = "TooManyPermanentOwnersAssignedToResourceAlertConfiguration"  # type: ignore


class TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties(
    AlertIncidentProperties, discriminator="TooManyPermanentOwnersAssignedToResourceAlertIncident"
):  # pylint: disable=name-too-long
    """Too many permanent owners assigned to resource alert incident properties.

    :ivar assignee_name: The assignee name.
    :vartype assignee_name: str
    :ivar assignee_type: The assignee type.
    :vartype assignee_type: str
    :ivar alert_incident_type: The alert incident type. Required. Default value is
     "TooManyPermanentOwnersAssignedToResourceAlertIncident".
    :vartype alert_incident_type: str
    """

    assignee_name: Optional[str] = rest_field(name="assigneeName", visibility=["read"])
    """The assignee name."""
    assignee_type: Optional[str] = rest_field(name="assigneeType", visibility=["read"])
    """The assignee type."""
    alert_incident_type: Literal["TooManyPermanentOwnersAssignedToResourceAlertIncident"] = rest_discriminator(name="alertIncidentType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The alert incident type. Required. Default value is
     \"TooManyPermanentOwnersAssignedToResourceAlertIncident\"."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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)
        self.alert_incident_type = "TooManyPermanentOwnersAssignedToResourceAlertIncident"  # type: ignore


class UserSet(_Model):
    """The detail of a user.

    :ivar user_type: The type of user. Known values are: "User" and "Group".
    :vartype user_type: str or ~azure.mgmt.authorization.models.CommonUserType
    :ivar is_backup: The value indicating whether the user is a backup fallback approver.
    :vartype is_backup: bool
    :ivar id: The object id of the user.
    :vartype id: str
    :ivar description: The description of the user.
    :vartype description: str
    """

    user_type: Optional[Union[str, "_models.CommonUserType"]] = rest_field(
        name="userType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of user. Known values are: \"User\" and \"Group\"."""
    is_backup: Optional[bool] = rest_field(name="isBackup", visibility=["read", "create", "update", "delete", "query"])
    """The value indicating whether the user is a backup fallback approver."""
    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The object id of the user."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The description of the user."""

    @overload
    def __init__(
        self,
        *,
        user_type: Optional[Union[str, "_models.CommonUserType"]] = None,
        is_backup: Optional[bool] = None,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        description: 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 UsersOrServicePrincipalSet(_Model):
    """The detail of a subject.

    :ivar type: The type of user. Known values are: "User", "Group", and "ServicePrincipal".
    :vartype type: str or ~azure.mgmt.authorization.models.UserType
    :ivar id: The object id of the entity.
    :vartype id: str
    :ivar display_name: The display Name of the entity.
    :vartype display_name: str
    """

    type: Optional[Union[str, "_models.UserType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of user. Known values are: \"User\", \"Group\", and \"ServicePrincipal\"."""
    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The object id of the entity."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """The display Name of the entity."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.UserType"]] = None,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        display_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)
