# pylint: disable=line-too-long,useless-suppression,too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=useless-super-delegation

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

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

if TYPE_CHECKING:
    from .. import models as _models


class Resource(_Model):
    """Resource.

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


class Attestation(ProxyResource):
    """An attestation 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.policyinsights.models.SystemData
    :ivar properties: Properties for the attestation. Required.
    :vartype properties: ~azure.mgmt.policyinsights.models.AttestationProperties
    """

    properties: "_models.AttestationProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Properties for the attestation. Required."""

    __flattened_items = [
        "policy_assignment_id",
        "policy_definition_reference_id",
        "compliance_state",
        "expires_on",
        "owner",
        "comments",
        "evidence",
        "provisioning_state",
        "last_compliance_state_change_at",
        "assessment_date",
        "metadata",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 AttestationEvidence(_Model):
    """A piece of evidence supporting the compliance state set in the attestation.

    :ivar description: The description for this piece of evidence.
    :vartype description: str
    :ivar source_uri: The URI location of the evidence.
    :vartype source_uri: str
    """

    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The description for this piece of evidence."""
    source_uri: Optional[str] = rest_field(name="sourceUri", visibility=["read", "create", "update", "delete", "query"])
    """The URI location of the evidence."""

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

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

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


class AttestationProperties(_Model):
    """The properties of an attestation resource.

    :ivar policy_assignment_id: The resource ID of the policy assignment that the attestation is
     setting the state for. Required.
    :vartype policy_assignment_id: str
    :ivar policy_definition_reference_id: The policy definition reference ID from a policy set
     definition that the attestation is setting the state for. If the policy assignment assigns a
     policy set definition the attestation can choose a definition within the set definition with
     this property or omit this and set the state for the entire set definition.
    :vartype policy_definition_reference_id: str
    :ivar compliance_state: The compliance state that should be set on the resource. Known values
     are: "Compliant", "NonCompliant", and "Unknown".
    :vartype compliance_state: str or ~azure.mgmt.policyinsights.models.ComplianceState
    :ivar expires_on: The time the compliance state should expire.
    :vartype expires_on: ~datetime.datetime
    :ivar owner: The person responsible for setting the state of the resource. This value is
     typically an Azure Active Directory object ID.
    :vartype owner: str
    :ivar comments: Comments describing why this attestation was created.
    :vartype comments: str
    :ivar evidence: The evidence supporting the compliance state set in this attestation.
    :vartype evidence: list[~azure.mgmt.policyinsights.models.AttestationEvidence]
    :ivar provisioning_state: The status of the attestation.
    :vartype provisioning_state: str
    :ivar last_compliance_state_change_at: The time the compliance state was last changed in this
     attestation.
    :vartype last_compliance_state_change_at: ~datetime.datetime
    :ivar assessment_date: The time the evidence was assessed.
    :vartype assessment_date: ~datetime.datetime
    :ivar metadata: Additional metadata for this attestation.
    :vartype metadata: any
    """

    policy_assignment_id: str = rest_field(
        name="policyAssignmentId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource ID of the policy assignment that the attestation is setting the state for.
     Required."""
    policy_definition_reference_id: Optional[str] = rest_field(
        name="policyDefinitionReferenceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The policy definition reference ID from a policy set definition that the attestation is setting
     the state for. If the policy assignment assigns a policy set definition the attestation can
     choose a definition within the set definition with this property or omit this and set the state
     for the entire set definition."""
    compliance_state: Optional[Union[str, "_models.ComplianceState"]] = rest_field(
        name="complianceState", visibility=["read", "create", "update", "delete", "query"]
    )
    """The compliance state that should be set on the resource. Known values are: \"Compliant\",
     \"NonCompliant\", and \"Unknown\"."""
    expires_on: Optional[datetime.datetime] = rest_field(
        name="expiresOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The time the compliance state should expire."""
    owner: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The person responsible for setting the state of the resource. This value is typically an Azure
     Active Directory object ID."""
    comments: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Comments describing why this attestation was created."""
    evidence: Optional[list["_models.AttestationEvidence"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The evidence supporting the compliance state set in this attestation."""
    provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"])
    """The status of the attestation."""
    last_compliance_state_change_at: Optional[datetime.datetime] = rest_field(
        name="lastComplianceStateChangeAt", visibility=["read"], format="rfc3339"
    )
    """The time the compliance state was last changed in this attestation."""
    assessment_date: Optional[datetime.datetime] = rest_field(
        name="assessmentDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The time the evidence was assessed."""
    metadata: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Additional metadata for this attestation."""

    @overload
    def __init__(
        self,
        *,
        policy_assignment_id: str,
        policy_definition_reference_id: Optional[str] = None,
        compliance_state: Optional[Union[str, "_models.ComplianceState"]] = None,
        expires_on: Optional[datetime.datetime] = None,
        owner: Optional[str] = None,
        comments: Optional[str] = None,
        evidence: Optional[list["_models.AttestationEvidence"]] = None,
        assessment_date: Optional[datetime.datetime] = None,
        metadata: Optional[Any] = None,
    ) -> None: ...

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

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


class CheckManagementGroupRestrictionsRequest(_Model):
    """The check policy restrictions parameters describing the resource that is being evaluated.

    :ivar resource_details: The information about the resource that will be evaluated.
    :vartype resource_details: ~azure.mgmt.policyinsights.models.CheckRestrictionsResourceDetails
    :ivar pending_fields: The list of fields and values that should be evaluated for potential
     restrictions.
    :vartype pending_fields: list[~azure.mgmt.policyinsights.models.PendingField]
    """

    resource_details: Optional["_models.CheckRestrictionsResourceDetails"] = rest_field(
        name="resourceDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """The information about the resource that will be evaluated."""
    pending_fields: Optional[list["_models.PendingField"]] = rest_field(
        name="pendingFields", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of fields and values that should be evaluated for potential restrictions."""

    @overload
    def __init__(
        self,
        *,
        resource_details: Optional["_models.CheckRestrictionsResourceDetails"] = None,
        pending_fields: Optional[list["_models.PendingField"]] = None,
    ) -> None: ...

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

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


class CheckRestrictionEvaluationDetails(_Model):
    """Policy evaluation details.

    :ivar evaluated_expressions: Details of the evaluated expressions.
    :vartype evaluated_expressions:
     list[~azure.mgmt.policyinsights.models.ExpressionEvaluationDetails]
    :ivar if_not_exists_details: Evaluation details of IfNotExists effect.
    :vartype if_not_exists_details: ~azure.mgmt.policyinsights.models.IfNotExistsEvaluationDetails
    :ivar reason: The reason for the evaluation result.
    :vartype reason: str
    """

    evaluated_expressions: Optional[list["_models.ExpressionEvaluationDetails"]] = rest_field(
        name="evaluatedExpressions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Details of the evaluated expressions."""
    if_not_exists_details: Optional["_models.IfNotExistsEvaluationDetails"] = rest_field(
        name="ifNotExistsDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """Evaluation details of IfNotExists effect."""
    reason: Optional[str] = rest_field(visibility=["read"])
    """The reason for the evaluation result."""

    @overload
    def __init__(
        self,
        *,
        evaluated_expressions: Optional[list["_models.ExpressionEvaluationDetails"]] = None,
        if_not_exists_details: Optional["_models.IfNotExistsEvaluationDetails"] = None,
    ) -> None: ...

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

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


class CheckRestrictionsRequest(_Model):
    """The check policy restrictions parameters describing the resource that is being evaluated.

    :ivar resource_details: The information about the resource that will be evaluated. Required.
    :vartype resource_details: ~azure.mgmt.policyinsights.models.CheckRestrictionsResourceDetails
    :ivar pending_fields: The list of fields and values that should be evaluated for potential
     restrictions.
    :vartype pending_fields: list[~azure.mgmt.policyinsights.models.PendingField]
    :ivar include_audit_effect: Whether to include policies with the 'audit' effect in the results.
     Defaults to false.
    :vartype include_audit_effect: bool
    """

    resource_details: "_models.CheckRestrictionsResourceDetails" = rest_field(
        name="resourceDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """The information about the resource that will be evaluated. Required."""
    pending_fields: Optional[list["_models.PendingField"]] = rest_field(
        name="pendingFields", visibility=["read", "create", "update", "delete", "query"]
    )
    """The list of fields and values that should be evaluated for potential restrictions."""
    include_audit_effect: Optional[bool] = rest_field(
        name="includeAuditEffect", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether to include policies with the 'audit' effect in the results. Defaults to false."""

    @overload
    def __init__(
        self,
        *,
        resource_details: "_models.CheckRestrictionsResourceDetails",
        pending_fields: Optional[list["_models.PendingField"]] = None,
        include_audit_effect: 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 CheckRestrictionsResourceDetails(_Model):
    """The information about the resource that will be evaluated.

    :ivar resource_content: The resource content. This should include whatever properties are
     already known and can be a partial set of all resource properties. Required.
    :vartype resource_content: any
    :ivar api_version: The api-version of the resource content.
    :vartype api_version: str
    :ivar scope: The scope where the resource is being created. For example, if the resource is a
     child resource this would be the parent resource's resource ID.
    :vartype scope: str
    """

    resource_content: Any = rest_field(
        name="resourceContent", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource content. This should include whatever properties are already known and can be a
     partial set of all resource properties. Required."""
    api_version: Optional[str] = rest_field(
        name="apiVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """The api-version of the resource content."""
    scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The scope where the resource is being created. For example, if the resource is a child resource
     this would be the parent resource's resource ID."""

    @overload
    def __init__(
        self,
        *,
        resource_content: Any,
        api_version: Optional[str] = None,
        scope: 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 CheckRestrictionsResult(_Model):
    """The result of a check policy restrictions evaluation on a resource.

    :ivar field_restrictions: The restrictions that will be placed on various fields in the
     resource by policy.
    :vartype field_restrictions: list[~azure.mgmt.policyinsights.models.FieldRestrictions]
    :ivar content_evaluation_result: Evaluation results for the provided partial resource content.
    :vartype content_evaluation_result:
     ~azure.mgmt.policyinsights.models.CheckRestrictionsResultContentEvaluationResult
    """

    field_restrictions: Optional[list["_models.FieldRestrictions"]] = rest_field(
        name="fieldRestrictions", visibility=["read"]
    )
    """The restrictions that will be placed on various fields in the resource by policy."""
    content_evaluation_result: Optional["_models.CheckRestrictionsResultContentEvaluationResult"] = rest_field(
        name="contentEvaluationResult", visibility=["read"]
    )
    """Evaluation results for the provided partial resource content."""


class CheckRestrictionsResultContentEvaluationResult(_Model):  # pylint: disable=name-too-long
    """Evaluation results for the provided partial resource content.

    :ivar policy_evaluations: Policy evaluation results against the given resource content. This
     will indicate if the partial content that was provided will be denied as-is.
    :vartype policy_evaluations: list[~azure.mgmt.policyinsights.models.PolicyEvaluationResult]
    """

    policy_evaluations: Optional[list["_models.PolicyEvaluationResult"]] = rest_field(
        name="policyEvaluations", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy evaluation results against the given resource content. This will indicate if the partial
     content that was provided will be denied as-is."""

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

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

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


class ComplianceDetail(_Model):
    """The compliance state rollup.

    :ivar compliance_state: The compliance state.
    :vartype compliance_state: str
    :ivar count: Summarized count value for this compliance state.
    :vartype count: int
    """

    compliance_state: Optional[str] = rest_field(
        name="complianceState", visibility=["read", "create", "update", "delete", "query"]
    )
    """The compliance state."""
    count: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Summarized count value for this compliance state."""

    @overload
    def __init__(
        self,
        *,
        compliance_state: Optional[str] = None,
        count: 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 ComponentEventDetails(_Model):
    """Component event details.

    :ivar id: Component Id.
    :vartype id: str
    :ivar type: Component type.
    :vartype type: str
    :ivar name: Component name.
    :vartype name: str
    :ivar timestamp: Timestamp for component policy event record.
    :vartype timestamp: ~datetime.datetime
    :ivar tenant_id: Tenant ID for the policy event record.
    :vartype tenant_id: str
    :ivar principal_oid: Principal object ID for the user who initiated the resource component
     operation that triggered the policy event.
    :vartype principal_oid: str
    :ivar policy_definition_action: Policy definition action, i.e. effect.
    :vartype policy_definition_action: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Component Id."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Component type."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Component name."""
    timestamp: Optional[datetime.datetime] = rest_field(
        visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Timestamp for component policy event record."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"])
    """Tenant ID for the policy event record."""
    principal_oid: Optional[str] = rest_field(
        name="principalOid", visibility=["read", "create", "update", "delete", "query"]
    )
    """Principal object ID for the user who initiated the resource component operation that triggered
     the policy event."""
    policy_definition_action: Optional[str] = rest_field(
        name="policyDefinitionAction", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition action, i.e. effect."""

    @overload
    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        type: Optional[str] = None,
        name: Optional[str] = None,
        timestamp: Optional[datetime.datetime] = None,
        tenant_id: Optional[str] = None,
        principal_oid: Optional[str] = None,
        policy_definition_action: 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 ComponentExpressionEvaluationDetails(_Model):
    """Evaluation details of policy language expressions.

    :ivar result: Evaluation result.
    :vartype result: str
    :ivar expression: Expression evaluated.
    :vartype expression: str
    :ivar expression_kind: The kind of expression that was evaluated.
    :vartype expression_kind: str
    :ivar path: Property path if the expression is a field or an alias.
    :vartype path: str
    :ivar expression_value: Value of the expression.
    :vartype expression_value: any
    :ivar target_value: Target value to be compared with the expression value.
    :vartype target_value: any
    :ivar operator: Operator to compare the expression value and the target value.
    :vartype operator: str
    """

    result: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Evaluation result."""
    expression: Optional[str] = rest_field(visibility=["read"])
    """Expression evaluated."""
    expression_kind: Optional[str] = rest_field(name="expressionKind", visibility=["read"])
    """The kind of expression that was evaluated."""
    path: Optional[str] = rest_field(visibility=["read"])
    """Property path if the expression is a field or an alias."""
    expression_value: Optional[Any] = rest_field(name="expressionValue", visibility=["read"])
    """Value of the expression."""
    target_value: Optional[Any] = rest_field(name="targetValue", visibility=["read"])
    """Target value to be compared with the expression value."""
    operator: Optional[str] = rest_field(visibility=["read"])
    """Operator to compare the expression value and the target value."""

    @overload
    def __init__(
        self,
        *,
        result: 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 ComponentPolicyEvaluationDetails(_Model):
    """Policy evaluation details.

    :ivar evaluated_expressions: Details of the evaluated expressions.
    :vartype evaluated_expressions:
     list[~azure.mgmt.policyinsights.models.ComponentExpressionEvaluationDetails]
    :ivar reason: Additional textual reason for the evaluation outcome.
    :vartype reason: str
    """

    evaluated_expressions: Optional[list["_models.ComponentExpressionEvaluationDetails"]] = rest_field(
        name="evaluatedExpressions", visibility=["read"]
    )
    """Details of the evaluated expressions."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Additional textual reason for the evaluation outcome."""

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

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

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


class ComponentPolicyState(_Model):
    """Component Policy State record.

    :ivar odata_id: OData entity ID; always set to null since component policy state records do not
     have an entity ID.
    :vartype odata_id: str
    :ivar odata_context: OData context string; used by OData clients to resolve type information
     based on metadata.
    :vartype odata_context: str
    :ivar timestamp: Timestamp for the component policy state record.
    :vartype timestamp: ~datetime.datetime
    :ivar component_id: Component Id.
    :vartype component_id: str
    :ivar component_type: Component type.
    :vartype component_type: str
    :ivar component_name: Component name.
    :vartype component_name: str
    :ivar resource_id: Resource ID.
    :vartype resource_id: str
    :ivar policy_assignment_id: Policy assignment ID.
    :vartype policy_assignment_id: str
    :ivar policy_definition_id: Policy definition ID.
    :vartype policy_definition_id: str
    :ivar subscription_id: Subscription ID.
    :vartype subscription_id: str
    :ivar resource_type: Resource type.
    :vartype resource_type: str
    :ivar resource_location: Resource location.
    :vartype resource_location: str
    :ivar resource_group: Resource group name.
    :vartype resource_group: str
    :ivar policy_assignment_name: Policy assignment name.
    :vartype policy_assignment_name: str
    :ivar policy_assignment_owner: Policy assignment owner.
    :vartype policy_assignment_owner: str
    :ivar policy_assignment_parameters: Policy assignment parameters.
    :vartype policy_assignment_parameters: str
    :ivar policy_assignment_scope: Policy assignment scope.
    :vartype policy_assignment_scope: str
    :ivar policy_definition_name: Policy definition name.
    :vartype policy_definition_name: str
    :ivar policy_definition_action: Policy definition action, i.e. effect.
    :vartype policy_definition_action: str
    :ivar policy_definition_category: Policy definition category.
    :vartype policy_definition_category: str
    :ivar policy_set_definition_id: Policy set definition ID, if the policy assignment is for a
     policy set.
    :vartype policy_set_definition_id: str
    :ivar policy_set_definition_name: Policy set definition name, if the policy assignment is for a
     policy set.
    :vartype policy_set_definition_name: str
    :ivar policy_set_definition_owner: Policy set definition owner, if the policy assignment is for
     a policy set.
    :vartype policy_set_definition_owner: str
    :ivar policy_set_definition_category: Policy set definition category, if the policy assignment
     is for a policy set.
    :vartype policy_set_definition_category: str
    :ivar policy_set_definition_parameters: Policy set definition parameters, if the policy
     assignment is for a policy set.
    :vartype policy_set_definition_parameters: str
    :ivar policy_definition_reference_id: Reference ID for the policy definition inside the policy
     set, if the policy assignment is for a policy set.
    :vartype policy_definition_reference_id: str
    :ivar compliance_state: Compliance state of the resource.
    :vartype compliance_state: str
    :ivar policy_evaluation_details: Policy evaluation details. This is only included in the
     response if the request contains $expand=PolicyEvaluationDetails.
    :vartype policy_evaluation_details:
     ~azure.mgmt.policyinsights.models.ComponentPolicyEvaluationDetails
    :ivar policy_definition_group_names: Policy definition group names.
    :vartype policy_definition_group_names: list[str]
    :ivar policy_definition_version: Evaluated policy definition version.
    :vartype policy_definition_version: str
    :ivar policy_set_definition_version: Evaluated policy set definition version.
    :vartype policy_set_definition_version: str
    :ivar policy_assignment_version: Evaluated policy assignment version.
    :vartype policy_assignment_version: str
    """

    odata_id: Optional[str] = rest_field(name="@odata.id", visibility=["read"])
    """OData entity ID; always set to null since component policy state records do not have an entity
     ID."""
    odata_context: Optional[str] = rest_field(name="@odata.context", visibility=["read"])
    """OData context string; used by OData clients to resolve type information based on metadata."""
    timestamp: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339")
    """Timestamp for the component policy state record."""
    component_id: Optional[str] = rest_field(name="componentId", visibility=["read"])
    """Component Id."""
    component_type: Optional[str] = rest_field(name="componentType", visibility=["read"])
    """Component type."""
    component_name: Optional[str] = rest_field(name="componentName", visibility=["read"])
    """Component name."""
    resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"])
    """Resource ID."""
    policy_assignment_id: Optional[str] = rest_field(name="policyAssignmentId", visibility=["read"])
    """Policy assignment ID."""
    policy_definition_id: Optional[str] = rest_field(name="policyDefinitionId", visibility=["read"])
    """Policy definition ID."""
    subscription_id: Optional[str] = rest_field(name="subscriptionId", visibility=["read"])
    """Subscription ID."""
    resource_type: Optional[str] = rest_field(name="resourceType", visibility=["read"])
    """Resource type."""
    resource_location: Optional[str] = rest_field(name="resourceLocation", visibility=["read"])
    """Resource location."""
    resource_group: Optional[str] = rest_field(name="resourceGroup", visibility=["read"])
    """Resource group name."""
    policy_assignment_name: Optional[str] = rest_field(name="policyAssignmentName", visibility=["read"])
    """Policy assignment name."""
    policy_assignment_owner: Optional[str] = rest_field(name="policyAssignmentOwner", visibility=["read"])
    """Policy assignment owner."""
    policy_assignment_parameters: Optional[str] = rest_field(name="policyAssignmentParameters", visibility=["read"])
    """Policy assignment parameters."""
    policy_assignment_scope: Optional[str] = rest_field(name="policyAssignmentScope", visibility=["read"])
    """Policy assignment scope."""
    policy_definition_name: Optional[str] = rest_field(name="policyDefinitionName", visibility=["read"])
    """Policy definition name."""
    policy_definition_action: Optional[str] = rest_field(name="policyDefinitionAction", visibility=["read"])
    """Policy definition action, i.e. effect."""
    policy_definition_category: Optional[str] = rest_field(name="policyDefinitionCategory", visibility=["read"])
    """Policy definition category."""
    policy_set_definition_id: Optional[str] = rest_field(name="policySetDefinitionId", visibility=["read"])
    """Policy set definition ID, if the policy assignment is for a policy set."""
    policy_set_definition_name: Optional[str] = rest_field(name="policySetDefinitionName", visibility=["read"])
    """Policy set definition name, if the policy assignment is for a policy set."""
    policy_set_definition_owner: Optional[str] = rest_field(name="policySetDefinitionOwner", visibility=["read"])
    """Policy set definition owner, if the policy assignment is for a policy set."""
    policy_set_definition_category: Optional[str] = rest_field(name="policySetDefinitionCategory", visibility=["read"])
    """Policy set definition category, if the policy assignment is for a policy set."""
    policy_set_definition_parameters: Optional[str] = rest_field(
        name="policySetDefinitionParameters", visibility=["read"]
    )
    """Policy set definition parameters, if the policy assignment is for a policy set."""
    policy_definition_reference_id: Optional[str] = rest_field(name="policyDefinitionReferenceId", visibility=["read"])
    """Reference ID for the policy definition inside the policy set, if the policy assignment is for a
     policy set."""
    compliance_state: Optional[str] = rest_field(name="complianceState", visibility=["read"])
    """Compliance state of the resource."""
    policy_evaluation_details: Optional["_models.ComponentPolicyEvaluationDetails"] = rest_field(
        name="policyEvaluationDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy evaluation details. This is only included in the response if the request contains
     $expand=PolicyEvaluationDetails."""
    policy_definition_group_names: Optional[list[str]] = rest_field(
        name="policyDefinitionGroupNames", visibility=["read"]
    )
    """Policy definition group names."""
    policy_definition_version: Optional[str] = rest_field(name="policyDefinitionVersion", visibility=["read"])
    """Evaluated policy definition version."""
    policy_set_definition_version: Optional[str] = rest_field(name="policySetDefinitionVersion", visibility=["read"])
    """Evaluated policy set definition version."""
    policy_assignment_version: Optional[str] = rest_field(name="policyAssignmentVersion", visibility=["read"])
    """Evaluated policy assignment version."""

    @overload
    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        policy_evaluation_details: Optional["_models.ComponentPolicyEvaluationDetails"] = None,
    ) -> None: ...

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

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


class ComponentPolicyStatesQueryResults(_Model):
    """Query results.

    :ivar odata_context: OData context string; used by OData clients to resolve type information
     based on metadata.
    :vartype odata_context: str
    :ivar odata_count: OData entity count; represents the number of policy state records returned.
    :vartype odata_count: int
    :ivar value: Query results.
    :vartype value: list[~azure.mgmt.policyinsights.models.ComponentPolicyState]
    """

    odata_context: Optional[str] = rest_field(
        name="@odata.context", visibility=["read", "create", "update", "delete", "query"]
    )
    """OData context string; used by OData clients to resolve type information based on metadata."""
    odata_count: Optional[int] = rest_field(
        name="@odata.count", visibility=["read", "create", "update", "delete", "query"]
    )
    """OData entity count; represents the number of policy state records returned."""
    value: Optional[list["_models.ComponentPolicyState"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Query results."""

    @overload
    def __init__(
        self,
        *,
        odata_context: Optional[str] = None,
        odata_count: Optional[int] = None,
        value: Optional[list["_models.ComponentPolicyState"]] = None,
    ) -> None: ...

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

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


class ComponentStateDetails(_Model):
    """Component state details.

    :ivar id: Component Id.
    :vartype id: str
    :ivar type: Component type.
    :vartype type: str
    :ivar name: Component name.
    :vartype name: str
    :ivar timestamp: Component compliance evaluation timestamp.
    :vartype timestamp: ~datetime.datetime
    :ivar compliance_state: Component compliance state.
    :vartype compliance_state: str
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Component Id."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Component type."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Component name."""
    timestamp: Optional[datetime.datetime] = rest_field(
        visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Component compliance evaluation timestamp."""
    compliance_state: Optional[str] = rest_field(
        name="complianceState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Component compliance state."""

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

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

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


class ErrorDefinition(_Model):
    """Error definition.

    :ivar code: Service specific error code which serves as the substatus for the HTTP error code.
    :vartype code: str
    :ivar message: Description of the error.
    :vartype message: str
    :ivar target: The target of the error.
    :vartype target: str
    :ivar details: Internal error details.
    :vartype details: list[~azure.mgmt.policyinsights.models.ErrorDefinition]
    :ivar additional_info: Additional scenario specific error details.
    :vartype additional_info: list[~azure.mgmt.policyinsights.models.TypedErrorInfo]
    """

    code: Optional[str] = rest_field(visibility=["read"])
    """Service specific error code which serves as the substatus for the HTTP error code."""
    message: Optional[str] = rest_field(visibility=["read"])
    """Description of the error."""
    target: Optional[str] = rest_field(visibility=["read"])
    """The target of the error."""
    details: Optional[list["_models.ErrorDefinition"]] = rest_field(visibility=["read"])
    """Internal error details."""
    additional_info: Optional[list["_models.TypedErrorInfo"]] = rest_field(name="additionalInfo", visibility=["read"])
    """Additional scenario specific error details."""


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

    :ivar error: The error details.
    :vartype error: ~azure.mgmt.policyinsights.models.ErrorDefinition
    """

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

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

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

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


class ExpressionEvaluationDetails(_Model):
    """Evaluation details of policy language expressions.

    :ivar result: Evaluation result.
    :vartype result: str
    :ivar expression: Expression evaluated.
    :vartype expression: str
    :ivar expression_kind: The kind of expression that was evaluated.
    :vartype expression_kind: str
    :ivar path: Property path if the expression is a field or an alias.
    :vartype path: str
    :ivar expression_value: Value of the expression.
    :vartype expression_value: any
    :ivar target_value: Target value to be compared with the expression value.
    :vartype target_value: any
    :ivar operator: Operator to compare the expression value and the target value.
    :vartype operator: str
    """

    result: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Evaluation result."""
    expression: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Expression evaluated."""
    expression_kind: Optional[str] = rest_field(name="expressionKind", visibility=["read"])
    """The kind of expression that was evaluated."""
    path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Property path if the expression is a field or an alias."""
    expression_value: Optional[Any] = rest_field(
        name="expressionValue", visibility=["read", "create", "update", "delete", "query"]
    )
    """Value of the expression."""
    target_value: Optional[Any] = rest_field(
        name="targetValue", visibility=["read", "create", "update", "delete", "query"]
    )
    """Target value to be compared with the expression value."""
    operator: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Operator to compare the expression value and the target value."""

    @overload
    def __init__(
        self,
        *,
        result: Optional[str] = None,
        expression: Optional[str] = None,
        path: Optional[str] = None,
        expression_value: Optional[Any] = None,
        target_value: Optional[Any] = None,
        operator: 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 FieldRestriction(_Model):
    """The restrictions on a field imposed by a specific policy.

    :ivar result: The type of restriction that is imposed on the field. Known values are:
     "Required", "Removed", "Deny", and "Audit".
    :vartype result: str or ~azure.mgmt.policyinsights.models.FieldRestrictionResult
    :ivar default_value: The value that policy will set for the field if the user does not provide
     a value.
    :vartype default_value: str
    :ivar values_property: The values that policy either requires or denies for the field.
    :vartype values_property: list[str]
    :ivar policy: The details of the policy that is causing the field restriction.
    :vartype policy: ~azure.mgmt.policyinsights.models.PolicyReference
    :ivar policy_effect: The effect of the policy that is causing the field restriction.
     `http://aka.ms/policyeffects <http://aka.ms/policyeffects>`_.
    :vartype policy_effect: str
    :ivar reason: The reason for the restriction.
    :vartype reason: str
    """

    result: Optional[Union[str, "_models.FieldRestrictionResult"]] = rest_field(visibility=["read"])
    """The type of restriction that is imposed on the field. Known values are: \"Required\",
     \"Removed\", \"Deny\", and \"Audit\"."""
    default_value: Optional[str] = rest_field(name="defaultValue", visibility=["read"])
    """The value that policy will set for the field if the user does not provide a value."""
    values_property: Optional[list[str]] = rest_field(name="values", visibility=["read"], original_tsp_name="values")
    """The values that policy either requires or denies for the field."""
    policy: Optional["_models.PolicyReference"] = rest_field(visibility=["read"])
    """The details of the policy that is causing the field restriction."""
    policy_effect: Optional[str] = rest_field(name="policyEffect", visibility=["read"])
    """The effect of the policy that is causing the field restriction. `http://aka.ms/policyeffects
     <http://aka.ms/policyeffects>`_."""
    reason: Optional[str] = rest_field(visibility=["read"])
    """The reason for the restriction."""


class FieldRestrictions(_Model):
    """The restrictions that will be placed on a field in the resource by policy.

    :ivar field: The name of the field. This can be a top-level property like 'name' or 'type' or
     an Azure Policy field alias.
    :vartype field: str
    :ivar restrictions: The restrictions placed on that field by policy.
    :vartype restrictions: list[~azure.mgmt.policyinsights.models.FieldRestriction]
    """

    field: Optional[str] = rest_field(visibility=["read"])
    """The name of the field. This can be a top-level property like 'name' or 'type' or an Azure
     Policy field alias."""
    restrictions: Optional[list["_models.FieldRestriction"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The restrictions placed on that field by policy."""

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

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

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


class IfNotExistsEvaluationDetails(_Model):
    """Evaluation details of IfNotExists effect.

    :ivar resource_id: ID of the last evaluated resource for IfNotExists effect.
    :vartype resource_id: str
    :ivar total_resources: Total number of resources to which the existence condition is
     applicable.
    :vartype total_resources: int
    """

    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """ID of the last evaluated resource for IfNotExists effect."""
    total_resources: Optional[int] = rest_field(
        name="totalResources", visibility=["read", "create", "update", "delete", "query"]
    )
    """Total number of resources to which the existence condition is applicable."""

    @overload
    def __init__(
        self,
        *,
        resource_id: Optional[str] = None,
        total_resources: 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 Operation(_Model):
    """Operation definition.

    :ivar name: Operation name.
    :vartype name: str
    :ivar is_data_action: Indicates whether the operation is a data action.
    :vartype is_data_action: bool
    :ivar display: Display metadata associated with the operation.
    :vartype display: ~azure.mgmt.policyinsights.models.OperationDisplay
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Operation name."""
    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 metadata associated with the operation."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        is_data_action: Optional[bool] = None,
        display: Optional["_models.OperationDisplay"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: 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):
    """Display metadata associated with the operation.

    :ivar provider: Resource provider name.
    :vartype provider: str
    :ivar resource: Resource name on which the operation is performed.
    :vartype resource: str
    :ivar operation: Operation name.
    :vartype operation: str
    :ivar description: Operation description.
    :vartype description: str
    """

    provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource provider name."""
    resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource name on which the operation is performed."""
    operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Operation name."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Operation description."""

    @overload
    def __init__(
        self,
        *,
        provider: Optional[str] = None,
        resource: Optional[str] = None,
        operation: Optional[str] = None,
        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 OperationsListResults(_Model):
    """List of available operations.

    :ivar odata_count: OData entity count; represents the number of operations returned.
    :vartype odata_count: int
    :ivar value: List of available operations.
    :vartype value: list[~azure.mgmt.policyinsights.models.Operation]
    """

    odata_count: Optional[int] = rest_field(
        name="@odata.count", visibility=["read", "create", "update", "delete", "query"]
    )
    """OData entity count; represents the number of operations returned."""
    value: Optional[list["_models.Operation"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """List of available operations."""

    @overload
    def __init__(
        self,
        *,
        odata_count: Optional[int] = None,
        value: Optional[list["_models.Operation"]] = None,
    ) -> None: ...

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

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


class PendingField(_Model):
    """A field that should be evaluated against Azure Policy to determine restrictions.

    :ivar field: The name of the field. This can be a top-level property like 'name' or 'type' or
     an Azure Policy field alias. Required.
    :vartype field: str
    :ivar values_property: The list of potential values for the field that should be evaluated
     against Azure Policy.
    :vartype values_property: list[str]
    """

    field: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name of the field. This can be a top-level property like 'name' or 'type' or an Azure
     Policy field alias. Required."""
    values_property: Optional[list[str]] = rest_field(
        name="values", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="values"
    )
    """The list of potential values for the field that should be evaluated against Azure Policy."""

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

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

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


class PolicyAssignmentSummary(_Model):
    """Policy assignment summary.

    :ivar policy_assignment_id: Policy assignment ID.
    :vartype policy_assignment_id: str
    :ivar policy_set_definition_id: Policy set definition ID, if the policy assignment is for a
     policy set.
    :vartype policy_set_definition_id: str
    :ivar results: Compliance summary for the policy assignment.
    :vartype results: ~azure.mgmt.policyinsights.models.SummaryResults
    :ivar policy_definitions: Policy definitions summary.
    :vartype policy_definitions: list[~azure.mgmt.policyinsights.models.PolicyDefinitionSummary]
    :ivar policy_groups: Policy definition group summary.
    :vartype policy_groups: list[~azure.mgmt.policyinsights.models.PolicyGroupSummary]
    """

    policy_assignment_id: Optional[str] = rest_field(
        name="policyAssignmentId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment ID."""
    policy_set_definition_id: Optional[str] = rest_field(
        name="policySetDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition ID, if the policy assignment is for a policy set."""
    results: Optional["_models.SummaryResults"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Compliance summary for the policy assignment."""
    policy_definitions: Optional[list["_models.PolicyDefinitionSummary"]] = rest_field(
        name="policyDefinitions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definitions summary."""
    policy_groups: Optional[list["_models.PolicyGroupSummary"]] = rest_field(
        name="policyGroups", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition group summary."""

    @overload
    def __init__(
        self,
        *,
        policy_assignment_id: Optional[str] = None,
        policy_set_definition_id: Optional[str] = None,
        results: Optional["_models.SummaryResults"] = None,
        policy_definitions: Optional[list["_models.PolicyDefinitionSummary"]] = None,
        policy_groups: Optional[list["_models.PolicyGroupSummary"]] = None,
    ) -> None: ...

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

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


class PolicyDefinitionSummary(_Model):
    """Policy definition summary.

    :ivar policy_definition_id: Policy definition ID.
    :vartype policy_definition_id: str
    :ivar policy_definition_reference_id: Policy definition reference ID.
    :vartype policy_definition_reference_id: str
    :ivar policy_definition_group_names: Policy definition group names.
    :vartype policy_definition_group_names: list[str]
    :ivar effect: Policy effect, i.e. policy definition action.
    :vartype effect: str
    :ivar results: Compliance summary for the policy definition.
    :vartype results: ~azure.mgmt.policyinsights.models.SummaryResults
    """

    policy_definition_id: Optional[str] = rest_field(
        name="policyDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition ID."""
    policy_definition_reference_id: Optional[str] = rest_field(
        name="policyDefinitionReferenceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition reference ID."""
    policy_definition_group_names: Optional[list[str]] = rest_field(
        name="policyDefinitionGroupNames", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition group names."""
    effect: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Policy effect, i.e. policy definition action."""
    results: Optional["_models.SummaryResults"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Compliance summary for the policy definition."""

    @overload
    def __init__(
        self,
        *,
        policy_definition_id: Optional[str] = None,
        policy_definition_reference_id: Optional[str] = None,
        policy_definition_group_names: Optional[list[str]] = None,
        effect: Optional[str] = None,
        results: Optional["_models.SummaryResults"] = None,
    ) -> None: ...

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

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


class PolicyDetails(_Model):
    """The policy details.

    :ivar policy_definition_id: The ID of the policy definition.
    :vartype policy_definition_id: str
    :ivar policy_assignment_id: The ID of the policy assignment.
    :vartype policy_assignment_id: str
    :ivar policy_assignment_display_name: The display name of the policy assignment.
    :vartype policy_assignment_display_name: str
    :ivar policy_assignment_scope: The scope of the policy assignment.
    :vartype policy_assignment_scope: str
    :ivar policy_set_definition_id: The ID of the policy set definition.
    :vartype policy_set_definition_id: str
    :ivar policy_definition_reference_id: The policy definition reference ID within the policy set
     definition.
    :vartype policy_definition_reference_id: str
    """

    policy_definition_id: Optional[str] = rest_field(name="policyDefinitionId", visibility=["read"])
    """The ID of the policy definition."""
    policy_assignment_id: Optional[str] = rest_field(name="policyAssignmentId", visibility=["read"])
    """The ID of the policy assignment."""
    policy_assignment_display_name: Optional[str] = rest_field(name="policyAssignmentDisplayName", visibility=["read"])
    """The display name of the policy assignment."""
    policy_assignment_scope: Optional[str] = rest_field(name="policyAssignmentScope", visibility=["read"])
    """The scope of the policy assignment."""
    policy_set_definition_id: Optional[str] = rest_field(name="policySetDefinitionId", visibility=["read"])
    """The ID of the policy set definition."""
    policy_definition_reference_id: Optional[str] = rest_field(name="policyDefinitionReferenceId", visibility=["read"])
    """The policy definition reference ID within the policy set definition."""


class PolicyEffectDetails(_Model):
    """The details of the effect that was applied to the resource.

    :ivar policy_effect: The effect that was applied to the resource. `http://aka.ms/policyeffects
     <http://aka.ms/policyeffects>`_.
    :vartype policy_effect: str
    """

    policy_effect: Optional[str] = rest_field(name="policyEffect", visibility=["read"])
    """The effect that was applied to the resource. `http://aka.ms/policyeffects
     <http://aka.ms/policyeffects>`_."""


class PolicyEvaluationDetails(_Model):
    """Policy evaluation details.

    :ivar evaluated_expressions: Details of the evaluated expressions.
    :vartype evaluated_expressions:
     list[~azure.mgmt.policyinsights.models.ExpressionEvaluationDetails]
    :ivar if_not_exists_details: Evaluation details of IfNotExists effect.
    :vartype if_not_exists_details: ~azure.mgmt.policyinsights.models.IfNotExistsEvaluationDetails
    """

    evaluated_expressions: Optional[list["_models.ExpressionEvaluationDetails"]] = rest_field(
        name="evaluatedExpressions", visibility=["read", "create", "update", "delete", "query"]
    )
    """Details of the evaluated expressions."""
    if_not_exists_details: Optional["_models.IfNotExistsEvaluationDetails"] = rest_field(
        name="ifNotExistsDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """Evaluation details of IfNotExists effect."""

    @overload
    def __init__(
        self,
        *,
        evaluated_expressions: Optional[list["_models.ExpressionEvaluationDetails"]] = None,
        if_not_exists_details: Optional["_models.IfNotExistsEvaluationDetails"] = None,
    ) -> None: ...

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

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


class PolicyEvaluationResult(_Model):
    """The result of a non-compliant policy evaluation against the given resource content.

    :ivar policy_info: The details of the policy that was evaluated.
    :vartype policy_info: ~azure.mgmt.policyinsights.models.PolicyReference
    :ivar evaluation_result: The result of the policy evaluation against the resource. This will
     typically be 'NonCompliant' but may contain other values if errors were encountered.
    :vartype evaluation_result: str
    :ivar evaluation_details: The detailed results of the policy expressions and values that were
     evaluated.
    :vartype evaluation_details:
     ~azure.mgmt.policyinsights.models.CheckRestrictionEvaluationDetails
    :ivar effect_details: The details of the effect that was applied to the resource.
    :vartype effect_details: ~azure.mgmt.policyinsights.models.PolicyEffectDetails
    """

    policy_info: Optional["_models.PolicyReference"] = rest_field(name="policyInfo", visibility=["read"])
    """The details of the policy that was evaluated."""
    evaluation_result: Optional[str] = rest_field(name="evaluationResult", visibility=["read"])
    """The result of the policy evaluation against the resource. This will typically be 'NonCompliant'
     but may contain other values if errors were encountered."""
    evaluation_details: Optional["_models.CheckRestrictionEvaluationDetails"] = rest_field(
        name="evaluationDetails", visibility=["read"]
    )
    """The detailed results of the policy expressions and values that were evaluated."""
    effect_details: Optional["_models.PolicyEffectDetails"] = rest_field(name="effectDetails", visibility=["read"])
    """The details of the effect that was applied to the resource."""


class PolicyEvent(_Model):
    """Policy event record.

    :ivar odata_id: OData entity ID; always set to null since policy event records do not have an
     entity ID.
    :vartype odata_id: str
    :ivar odata_context: OData context string; used by OData clients to resolve type information
     based on metadata.
    :vartype odata_context: str
    :ivar timestamp: Timestamp for the policy event record.
    :vartype timestamp: ~datetime.datetime
    :ivar resource_id: Resource ID.
    :vartype resource_id: str
    :ivar policy_assignment_id: Policy assignment ID.
    :vartype policy_assignment_id: str
    :ivar policy_definition_id: Policy definition ID.
    :vartype policy_definition_id: str
    :ivar effective_parameters: Effective parameters for the policy assignment.
    :vartype effective_parameters: str
    :ivar is_compliant: Flag which states whether the resource is compliant against the policy
     assignment it was evaluated against.
    :vartype is_compliant: bool
    :ivar subscription_id: Subscription ID.
    :vartype subscription_id: str
    :ivar resource_type: Resource type.
    :vartype resource_type: str
    :ivar resource_location: Resource location.
    :vartype resource_location: str
    :ivar resource_group: Resource group name.
    :vartype resource_group: str
    :ivar resource_tags: List of resource tags.
    :vartype resource_tags: str
    :ivar policy_assignment_name: Policy assignment name.
    :vartype policy_assignment_name: str
    :ivar policy_assignment_owner: Policy assignment owner.
    :vartype policy_assignment_owner: str
    :ivar policy_assignment_parameters: Policy assignment parameters.
    :vartype policy_assignment_parameters: str
    :ivar policy_assignment_scope: Policy assignment scope.
    :vartype policy_assignment_scope: str
    :ivar policy_definition_name: Policy definition name.
    :vartype policy_definition_name: str
    :ivar policy_definition_action: Policy definition action, i.e. effect.
    :vartype policy_definition_action: str
    :ivar policy_definition_category: Policy definition category.
    :vartype policy_definition_category: str
    :ivar policy_set_definition_id: Policy set definition ID, if the policy assignment is for a
     policy set.
    :vartype policy_set_definition_id: str
    :ivar policy_set_definition_name: Policy set definition name, if the policy assignment is for a
     policy set.
    :vartype policy_set_definition_name: str
    :ivar policy_set_definition_owner: Policy set definition owner, if the policy assignment is for
     a policy set.
    :vartype policy_set_definition_owner: str
    :ivar policy_set_definition_category: Policy set definition category, if the policy assignment
     is for a policy set.
    :vartype policy_set_definition_category: str
    :ivar policy_set_definition_parameters: Policy set definition parameters, if the policy
     assignment is for a policy set.
    :vartype policy_set_definition_parameters: str
    :ivar management_group_ids: Comma separated list of management group IDs, which represent the
     hierarchy of the management groups the resource is under.
    :vartype management_group_ids: str
    :ivar policy_definition_reference_id: Reference ID for the policy definition inside the policy
     set, if the policy assignment is for a policy set.
    :vartype policy_definition_reference_id: str
    :ivar compliance_state: Compliance state of the resource.
    :vartype compliance_state: str
    :ivar tenant_id: Tenant ID for the policy event record.
    :vartype tenant_id: str
    :ivar principal_oid: Principal object ID for the user who initiated the resource operation that
     triggered the policy event.
    :vartype principal_oid: str
    :ivar components: Components events records populated only when URL contains $expand=components
     clause.
    :vartype components: list[~azure.mgmt.policyinsights.models.ComponentEventDetails]
    """

    odata_id: Optional[str] = rest_field(name="@odata.id", visibility=["read", "create", "update", "delete", "query"])
    """OData entity ID; always set to null since policy event records do not have an entity ID."""
    odata_context: Optional[str] = rest_field(
        name="@odata.context", visibility=["read", "create", "update", "delete", "query"]
    )
    """OData context string; used by OData clients to resolve type information based on metadata."""
    timestamp: Optional[datetime.datetime] = rest_field(
        visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Timestamp for the policy event record."""
    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource ID."""
    policy_assignment_id: Optional[str] = rest_field(
        name="policyAssignmentId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment ID."""
    policy_definition_id: Optional[str] = rest_field(
        name="policyDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition ID."""
    effective_parameters: Optional[str] = rest_field(
        name="effectiveParameters", visibility=["read", "create", "update", "delete", "query"]
    )
    """Effective parameters for the policy assignment."""
    is_compliant: Optional[bool] = rest_field(
        name="isCompliant", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag which states whether the resource is compliant against the policy assignment it was
     evaluated against."""
    subscription_id: Optional[str] = rest_field(
        name="subscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Subscription ID."""
    resource_type: Optional[str] = rest_field(
        name="resourceType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource type."""
    resource_location: Optional[str] = rest_field(
        name="resourceLocation", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource location."""
    resource_group: Optional[str] = rest_field(
        name="resourceGroup", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource group name."""
    resource_tags: Optional[str] = rest_field(
        name="resourceTags", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of resource tags."""
    policy_assignment_name: Optional[str] = rest_field(
        name="policyAssignmentName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment name."""
    policy_assignment_owner: Optional[str] = rest_field(
        name="policyAssignmentOwner", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment owner."""
    policy_assignment_parameters: Optional[str] = rest_field(
        name="policyAssignmentParameters", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment parameters."""
    policy_assignment_scope: Optional[str] = rest_field(
        name="policyAssignmentScope", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment scope."""
    policy_definition_name: Optional[str] = rest_field(
        name="policyDefinitionName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition name."""
    policy_definition_action: Optional[str] = rest_field(
        name="policyDefinitionAction", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition action, i.e. effect."""
    policy_definition_category: Optional[str] = rest_field(
        name="policyDefinitionCategory", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition category."""
    policy_set_definition_id: Optional[str] = rest_field(
        name="policySetDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition ID, if the policy assignment is for a policy set."""
    policy_set_definition_name: Optional[str] = rest_field(
        name="policySetDefinitionName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition name, if the policy assignment is for a policy set."""
    policy_set_definition_owner: Optional[str] = rest_field(
        name="policySetDefinitionOwner", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition owner, if the policy assignment is for a policy set."""
    policy_set_definition_category: Optional[str] = rest_field(
        name="policySetDefinitionCategory", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition category, if the policy assignment is for a policy set."""
    policy_set_definition_parameters: Optional[str] = rest_field(
        name="policySetDefinitionParameters", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition parameters, if the policy assignment is for a policy set."""
    management_group_ids: Optional[str] = rest_field(
        name="managementGroupIds", visibility=["read", "create", "update", "delete", "query"]
    )
    """Comma separated list of management group IDs, which represent the hierarchy of the management
     groups the resource is under."""
    policy_definition_reference_id: Optional[str] = rest_field(
        name="policyDefinitionReferenceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Reference ID for the policy definition inside the policy set, if the policy assignment is for a
     policy set."""
    compliance_state: Optional[str] = rest_field(
        name="complianceState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Compliance state of the resource."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"])
    """Tenant ID for the policy event record."""
    principal_oid: Optional[str] = rest_field(
        name="principalOid", visibility=["read", "create", "update", "delete", "query"]
    )
    """Principal object ID for the user who initiated the resource operation that triggered the policy
     event."""
    components: Optional[list["_models.ComponentEventDetails"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Components events records populated only when URL contains $expand=components clause."""

    @overload
    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        odata_id: Optional[str] = None,
        odata_context: Optional[str] = None,
        timestamp: Optional[datetime.datetime] = None,
        resource_id: Optional[str] = None,
        policy_assignment_id: Optional[str] = None,
        policy_definition_id: Optional[str] = None,
        effective_parameters: Optional[str] = None,
        is_compliant: Optional[bool] = None,
        subscription_id: Optional[str] = None,
        resource_type: Optional[str] = None,
        resource_location: Optional[str] = None,
        resource_group: Optional[str] = None,
        resource_tags: Optional[str] = None,
        policy_assignment_name: Optional[str] = None,
        policy_assignment_owner: Optional[str] = None,
        policy_assignment_parameters: Optional[str] = None,
        policy_assignment_scope: Optional[str] = None,
        policy_definition_name: Optional[str] = None,
        policy_definition_action: Optional[str] = None,
        policy_definition_category: Optional[str] = None,
        policy_set_definition_id: Optional[str] = None,
        policy_set_definition_name: Optional[str] = None,
        policy_set_definition_owner: Optional[str] = None,
        policy_set_definition_category: Optional[str] = None,
        policy_set_definition_parameters: Optional[str] = None,
        management_group_ids: Optional[str] = None,
        policy_definition_reference_id: Optional[str] = None,
        compliance_state: Optional[str] = None,
        tenant_id: Optional[str] = None,
        principal_oid: Optional[str] = None,
        components: Optional[list["_models.ComponentEventDetails"]] = None,
    ) -> None: ...

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

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


class PolicyGroupSummary(_Model):
    """Policy definition group summary.

    :ivar policy_group_name: Policy group name.
    :vartype policy_group_name: str
    :ivar results: Compliance summary for the policy definition group.
    :vartype results: ~azure.mgmt.policyinsights.models.SummaryResults
    """

    policy_group_name: Optional[str] = rest_field(
        name="policyGroupName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy group name."""
    results: Optional["_models.SummaryResults"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Compliance summary for the policy definition group."""

    @overload
    def __init__(
        self,
        *,
        policy_group_name: Optional[str] = None,
        results: Optional["_models.SummaryResults"] = None,
    ) -> None: ...

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

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


class PolicyMetadata(ProxyResource):
    """Policy metadata resource 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.policyinsights.models.SystemData
    :ivar properties: Properties of the policy metadata.
    :vartype properties: ~azure.mgmt.policyinsights.models.PolicyMetadataProperties
    """

    properties: Optional["_models.PolicyMetadataProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties of the policy metadata."""

    __flattened_items = [
        "metadata_id",
        "category",
        "title",
        "owner",
        "additional_content_url",
        "metadata",
        "description",
        "requirements",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 PolicyMetadataSlimProperties(_Model):
    """The properties of the policy metadata, excluding properties containing large strings.

    :ivar metadata_id: The policy metadata identifier.
    :vartype metadata_id: str
    :ivar category: The category of the policy metadata.
    :vartype category: str
    :ivar title: The title of the policy metadata.
    :vartype title: str
    :ivar owner: The owner of the policy metadata.
    :vartype owner: str
    :ivar additional_content_url: Url for getting additional content about the resource metadata.
    :vartype additional_content_url: str
    :ivar metadata: Additional metadata.
    :vartype metadata: any
    """

    metadata_id: Optional[str] = rest_field(name="metadataId", visibility=["read"])
    """The policy metadata identifier."""
    category: Optional[str] = rest_field(visibility=["read"])
    """The category of the policy metadata."""
    title: Optional[str] = rest_field(visibility=["read"])
    """The title of the policy metadata."""
    owner: Optional[str] = rest_field(visibility=["read"])
    """The owner of the policy metadata."""
    additional_content_url: Optional[str] = rest_field(name="additionalContentUrl", visibility=["read"])
    """Url for getting additional content about the resource metadata."""
    metadata: Optional[Any] = rest_field(visibility=["read"])
    """Additional metadata."""


class PolicyMetadataProperties(PolicyMetadataSlimProperties):
    """The properties of the policy metadata.

    :ivar metadata_id: The policy metadata identifier.
    :vartype metadata_id: str
    :ivar category: The category of the policy metadata.
    :vartype category: str
    :ivar title: The title of the policy metadata.
    :vartype title: str
    :ivar owner: The owner of the policy metadata.
    :vartype owner: str
    :ivar additional_content_url: Url for getting additional content about the resource metadata.
    :vartype additional_content_url: str
    :ivar metadata: Additional metadata.
    :vartype metadata: any
    :ivar description: The description of the policy metadata.
    :vartype description: str
    :ivar requirements: The requirements of the policy metadata.
    :vartype requirements: str
    """

    description: Optional[str] = rest_field(visibility=["read"])
    """The description of the policy metadata."""
    requirements: Optional[str] = rest_field(visibility=["read"])
    """The requirements of the policy metadata."""


class PolicyReference(_Model):
    """Resource identifiers for a policy.

    :ivar policy_definition_id: The resource identifier of the policy definition.
    :vartype policy_definition_id: str
    :ivar policy_set_definition_id: The resource identifier of the policy set definition.
    :vartype policy_set_definition_id: str
    :ivar policy_definition_reference_id: The reference identifier of a specific policy definition
     within a policy set definition.
    :vartype policy_definition_reference_id: str
    :ivar policy_assignment_id: The resource identifier of the policy assignment.
    :vartype policy_assignment_id: str
    """

    policy_definition_id: Optional[str] = rest_field(name="policyDefinitionId", visibility=["read"])
    """The resource identifier of the policy definition."""
    policy_set_definition_id: Optional[str] = rest_field(name="policySetDefinitionId", visibility=["read"])
    """The resource identifier of the policy set definition."""
    policy_definition_reference_id: Optional[str] = rest_field(name="policyDefinitionReferenceId", visibility=["read"])
    """The reference identifier of a specific policy definition within a policy set definition."""
    policy_assignment_id: Optional[str] = rest_field(name="policyAssignmentId", visibility=["read"])
    """The resource identifier of the policy assignment."""


class PolicyState(_Model):
    """Policy state record.

    :ivar odata_id: OData entity ID; always set to null since policy state records do not have an
     entity ID.
    :vartype odata_id: str
    :ivar odata_context: OData context string; used by OData clients to resolve type information
     based on metadata.
    :vartype odata_context: str
    :ivar timestamp: Timestamp for the policy state record.
    :vartype timestamp: ~datetime.datetime
    :ivar resource_id: Resource ID.
    :vartype resource_id: str
    :ivar policy_assignment_id: Policy assignment ID.
    :vartype policy_assignment_id: str
    :ivar policy_definition_id: Policy definition ID.
    :vartype policy_definition_id: str
    :ivar effective_parameters: Effective parameters for the policy assignment.
    :vartype effective_parameters: str
    :ivar is_compliant: Flag which states whether the resource is compliant against the policy
     assignment it was evaluated against. This property is deprecated; please use ComplianceState
     instead.
    :vartype is_compliant: bool
    :ivar subscription_id: Subscription ID.
    :vartype subscription_id: str
    :ivar resource_type: Resource type.
    :vartype resource_type: str
    :ivar resource_location: Resource location.
    :vartype resource_location: str
    :ivar resource_group: Resource group name.
    :vartype resource_group: str
    :ivar resource_tags: List of resource tags.
    :vartype resource_tags: str
    :ivar policy_assignment_name: Policy assignment name.
    :vartype policy_assignment_name: str
    :ivar policy_assignment_owner: Policy assignment owner.
    :vartype policy_assignment_owner: str
    :ivar policy_assignment_parameters: Policy assignment parameters.
    :vartype policy_assignment_parameters: str
    :ivar policy_assignment_scope: Policy assignment scope.
    :vartype policy_assignment_scope: str
    :ivar policy_definition_name: Policy definition name.
    :vartype policy_definition_name: str
    :ivar policy_definition_action: Policy definition action, i.e. effect.
    :vartype policy_definition_action: str
    :ivar policy_definition_category: Policy definition category.
    :vartype policy_definition_category: str
    :ivar policy_set_definition_id: Policy set definition ID, if the policy assignment is for a
     policy set.
    :vartype policy_set_definition_id: str
    :ivar policy_set_definition_name: Policy set definition name, if the policy assignment is for a
     policy set.
    :vartype policy_set_definition_name: str
    :ivar policy_set_definition_owner: Policy set definition owner, if the policy assignment is for
     a policy set.
    :vartype policy_set_definition_owner: str
    :ivar policy_set_definition_category: Policy set definition category, if the policy assignment
     is for a policy set.
    :vartype policy_set_definition_category: str
    :ivar policy_set_definition_parameters: Policy set definition parameters, if the policy
     assignment is for a policy set.
    :vartype policy_set_definition_parameters: str
    :ivar management_group_ids: Comma separated list of management group IDs, which represent the
     hierarchy of the management groups the resource is under.
    :vartype management_group_ids: str
    :ivar policy_definition_reference_id: Reference ID for the policy definition inside the policy
     set, if the policy assignment is for a policy set.
    :vartype policy_definition_reference_id: str
    :ivar compliance_state: Compliance state of the resource.
    :vartype compliance_state: str
    :ivar policy_evaluation_details: Policy evaluation details.
    :vartype policy_evaluation_details: ~azure.mgmt.policyinsights.models.PolicyEvaluationDetails
    :ivar policy_definition_group_names: Policy definition group names.
    :vartype policy_definition_group_names: list[str]
    :ivar components: Components state compliance records populated only when URL contains
     $expand=components clause.
    :vartype components: list[~azure.mgmt.policyinsights.models.ComponentStateDetails]
    :ivar policy_definition_version: Evaluated policy definition version.
    :vartype policy_definition_version: str
    :ivar policy_set_definition_version: Evaluated policy set definition version.
    :vartype policy_set_definition_version: str
    :ivar policy_assignment_version: Evaluated policy assignment version.
    :vartype policy_assignment_version: str
    """

    odata_id: Optional[str] = rest_field(name="@odata.id", visibility=["read", "create", "update", "delete", "query"])
    """OData entity ID; always set to null since policy state records do not have an entity ID."""
    odata_context: Optional[str] = rest_field(
        name="@odata.context", visibility=["read", "create", "update", "delete", "query"]
    )
    """OData context string; used by OData clients to resolve type information based on metadata."""
    timestamp: Optional[datetime.datetime] = rest_field(
        visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Timestamp for the policy state record."""
    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource ID."""
    policy_assignment_id: Optional[str] = rest_field(
        name="policyAssignmentId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment ID."""
    policy_definition_id: Optional[str] = rest_field(
        name="policyDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition ID."""
    effective_parameters: Optional[str] = rest_field(
        name="effectiveParameters", visibility=["read", "create", "update", "delete", "query"]
    )
    """Effective parameters for the policy assignment."""
    is_compliant: Optional[bool] = rest_field(
        name="isCompliant", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag which states whether the resource is compliant against the policy assignment it was
     evaluated against. This property is deprecated; please use ComplianceState instead."""
    subscription_id: Optional[str] = rest_field(
        name="subscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Subscription ID."""
    resource_type: Optional[str] = rest_field(
        name="resourceType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource type."""
    resource_location: Optional[str] = rest_field(
        name="resourceLocation", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource location."""
    resource_group: Optional[str] = rest_field(
        name="resourceGroup", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource group name."""
    resource_tags: Optional[str] = rest_field(
        name="resourceTags", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of resource tags."""
    policy_assignment_name: Optional[str] = rest_field(
        name="policyAssignmentName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment name."""
    policy_assignment_owner: Optional[str] = rest_field(
        name="policyAssignmentOwner", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment owner."""
    policy_assignment_parameters: Optional[str] = rest_field(
        name="policyAssignmentParameters", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment parameters."""
    policy_assignment_scope: Optional[str] = rest_field(
        name="policyAssignmentScope", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignment scope."""
    policy_definition_name: Optional[str] = rest_field(
        name="policyDefinitionName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition name."""
    policy_definition_action: Optional[str] = rest_field(
        name="policyDefinitionAction", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition action, i.e. effect."""
    policy_definition_category: Optional[str] = rest_field(
        name="policyDefinitionCategory", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition category."""
    policy_set_definition_id: Optional[str] = rest_field(
        name="policySetDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition ID, if the policy assignment is for a policy set."""
    policy_set_definition_name: Optional[str] = rest_field(
        name="policySetDefinitionName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition name, if the policy assignment is for a policy set."""
    policy_set_definition_owner: Optional[str] = rest_field(
        name="policySetDefinitionOwner", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition owner, if the policy assignment is for a policy set."""
    policy_set_definition_category: Optional[str] = rest_field(
        name="policySetDefinitionCategory", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition category, if the policy assignment is for a policy set."""
    policy_set_definition_parameters: Optional[str] = rest_field(
        name="policySetDefinitionParameters", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy set definition parameters, if the policy assignment is for a policy set."""
    management_group_ids: Optional[str] = rest_field(
        name="managementGroupIds", visibility=["read", "create", "update", "delete", "query"]
    )
    """Comma separated list of management group IDs, which represent the hierarchy of the management
     groups the resource is under."""
    policy_definition_reference_id: Optional[str] = rest_field(
        name="policyDefinitionReferenceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Reference ID for the policy definition inside the policy set, if the policy assignment is for a
     policy set."""
    compliance_state: Optional[str] = rest_field(
        name="complianceState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Compliance state of the resource."""
    policy_evaluation_details: Optional["_models.PolicyEvaluationDetails"] = rest_field(
        name="policyEvaluationDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy evaluation details."""
    policy_definition_group_names: Optional[list[str]] = rest_field(
        name="policyDefinitionGroupNames", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy definition group names."""
    components: Optional[list["_models.ComponentStateDetails"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Components state compliance records populated only when URL contains $expand=components clause."""
    policy_definition_version: Optional[str] = rest_field(name="policyDefinitionVersion", visibility=["read"])
    """Evaluated policy definition version."""
    policy_set_definition_version: Optional[str] = rest_field(name="policySetDefinitionVersion", visibility=["read"])
    """Evaluated policy set definition version."""
    policy_assignment_version: Optional[str] = rest_field(name="policyAssignmentVersion", visibility=["read"])
    """Evaluated policy assignment version."""

    @overload
    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        odata_id: Optional[str] = None,
        odata_context: Optional[str] = None,
        timestamp: Optional[datetime.datetime] = None,
        resource_id: Optional[str] = None,
        policy_assignment_id: Optional[str] = None,
        policy_definition_id: Optional[str] = None,
        effective_parameters: Optional[str] = None,
        is_compliant: Optional[bool] = None,
        subscription_id: Optional[str] = None,
        resource_type: Optional[str] = None,
        resource_location: Optional[str] = None,
        resource_group: Optional[str] = None,
        resource_tags: Optional[str] = None,
        policy_assignment_name: Optional[str] = None,
        policy_assignment_owner: Optional[str] = None,
        policy_assignment_parameters: Optional[str] = None,
        policy_assignment_scope: Optional[str] = None,
        policy_definition_name: Optional[str] = None,
        policy_definition_action: Optional[str] = None,
        policy_definition_category: Optional[str] = None,
        policy_set_definition_id: Optional[str] = None,
        policy_set_definition_name: Optional[str] = None,
        policy_set_definition_owner: Optional[str] = None,
        policy_set_definition_category: Optional[str] = None,
        policy_set_definition_parameters: Optional[str] = None,
        management_group_ids: Optional[str] = None,
        policy_definition_reference_id: Optional[str] = None,
        compliance_state: Optional[str] = None,
        policy_evaluation_details: Optional["_models.PolicyEvaluationDetails"] = None,
        policy_definition_group_names: Optional[list[str]] = None,
        components: Optional[list["_models.ComponentStateDetails"]] = None,
    ) -> None: ...

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

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


class PolicyTrackedResource(_Model):
    """Policy tracked resource record.

    :ivar tracked_resource_id: The ID of the policy tracked resource.
    :vartype tracked_resource_id: str
    :ivar policy_details: The details of the policy that require the tracked resource.
    :vartype policy_details: ~azure.mgmt.policyinsights.models.PolicyDetails
    :ivar created_by: The details of the policy triggered deployment that created the tracked
     resource.
    :vartype created_by: ~azure.mgmt.policyinsights.models.TrackedResourceModificationDetails
    :ivar last_modified_by: The details of the policy triggered deployment that modified the
     tracked resource.
    :vartype last_modified_by: ~azure.mgmt.policyinsights.models.TrackedResourceModificationDetails
    :ivar last_update_utc: Timestamp of the last update to the tracked resource.
    :vartype last_update_utc: ~datetime.datetime
    """

    tracked_resource_id: Optional[str] = rest_field(name="trackedResourceId", visibility=["read"])
    """The ID of the policy tracked resource."""
    policy_details: Optional["_models.PolicyDetails"] = rest_field(name="policyDetails", visibility=["read"])
    """The details of the policy that require the tracked resource."""
    created_by: Optional["_models.TrackedResourceModificationDetails"] = rest_field(
        name="createdBy", visibility=["read"]
    )
    """The details of the policy triggered deployment that created the tracked resource."""
    last_modified_by: Optional["_models.TrackedResourceModificationDetails"] = rest_field(
        name="lastModifiedBy", visibility=["read"]
    )
    """The details of the policy triggered deployment that modified the tracked resource."""
    last_update_utc: Optional[datetime.datetime] = rest_field(
        name="lastUpdateUtc", visibility=["read"], format="rfc3339"
    )
    """Timestamp of the last update to the tracked resource."""


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

    :ivar error: Error definition.
    :vartype error: ~azure.mgmt.policyinsights.models.QueryFailureError
    """

    error: Optional["_models.QueryFailureError"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Error definition."""

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

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

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


class QueryFailureError(_Model):
    """Error definition.

    :ivar code: Service specific error code which serves as the substatus for the HTTP error code.
    :vartype code: str
    :ivar message: Description of the error.
    :vartype message: str
    """

    code: Optional[str] = rest_field(visibility=["read"])
    """Service specific error code which serves as the substatus for the HTTP error code."""
    message: Optional[str] = rest_field(visibility=["read"])
    """Description of the error."""


class Remediation(ProxyResource):
    """The remediation 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.policyinsights.models.SystemData
    :ivar properties: Properties for the remediation.
    :vartype properties: ~azure.mgmt.policyinsights.models.RemediationProperties
    """

    properties: Optional["_models.RemediationProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties for the remediation."""

    __flattened_items = [
        "policy_assignment_id",
        "policy_definition_reference_id",
        "resource_discovery_mode",
        "provisioning_state",
        "created_on",
        "last_updated_on",
        "filters",
        "deployment_status",
        "status_message",
        "correlation_id",
        "resource_count",
        "parallel_deployments",
        "failure_threshold",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 RemediationDeployment(_Model):
    """Details of a single deployment created by the remediation.

    :ivar remediated_resource_id: Resource ID of the resource that is being remediated by the
     deployment.
    :vartype remediated_resource_id: str
    :ivar deployment_id: Resource ID of the template deployment that will remediate the resource.
    :vartype deployment_id: str
    :ivar status: Status of the remediation deployment.
    :vartype status: str
    :ivar resource_location: Location of the resource that is being remediated.
    :vartype resource_location: str
    :ivar error: Error encountered while remediated the resource.
    :vartype error: ~azure.mgmt.policyinsights.models.ErrorDefinition
    :ivar created_on: The time at which the remediation was created.
    :vartype created_on: ~datetime.datetime
    :ivar last_updated_on: The time at which the remediation deployment was last updated.
    :vartype last_updated_on: ~datetime.datetime
    """

    remediated_resource_id: Optional[str] = rest_field(name="remediatedResourceId", visibility=["read"])
    """Resource ID of the resource that is being remediated by the deployment."""
    deployment_id: Optional[str] = rest_field(name="deploymentId", visibility=["read"])
    """Resource ID of the template deployment that will remediate the resource."""
    status: Optional[str] = rest_field(visibility=["read"])
    """Status of the remediation deployment."""
    resource_location: Optional[str] = rest_field(name="resourceLocation", visibility=["read"])
    """Location of the resource that is being remediated."""
    error: Optional["_models.ErrorDefinition"] = rest_field(visibility=["read"])
    """Error encountered while remediated the resource."""
    created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339")
    """The time at which the remediation was created."""
    last_updated_on: Optional[datetime.datetime] = rest_field(
        name="lastUpdatedOn", visibility=["read"], format="rfc3339"
    )
    """The time at which the remediation deployment was last updated."""


class RemediationDeploymentSummary(_Model):
    """The deployment status summary for all deployments created by the remediation.

    :ivar total_deployments: The number of deployments required by the remediation.
    :vartype total_deployments: int
    :ivar successful_deployments: The number of deployments required by the remediation that have
     succeeded.
    :vartype successful_deployments: int
    :ivar failed_deployments: The number of deployments required by the remediation that have
     failed.
    :vartype failed_deployments: int
    """

    total_deployments: Optional[int] = rest_field(name="totalDeployments", visibility=["read"])
    """The number of deployments required by the remediation."""
    successful_deployments: Optional[int] = rest_field(name="successfulDeployments", visibility=["read"])
    """The number of deployments required by the remediation that have succeeded."""
    failed_deployments: Optional[int] = rest_field(name="failedDeployments", visibility=["read"])
    """The number of deployments required by the remediation that have failed."""


class RemediationFilters(_Model):
    """The filters that will be applied to determine which resources to remediate.

    :ivar locations: The resource locations that will be remediated.
    :vartype locations: list[str]
    :ivar resource_ids: The IDs of the resources that will be remediated. Can specify at most 100
     IDs. This filter cannot be used when ReEvaluateCompliance is set to ReEvaluateCompliance, and
     cannot be empty if provided.
    :vartype resource_ids: list[str]
    """

    locations: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource locations that will be remediated."""
    resource_ids: Optional[list[str]] = rest_field(
        name="resourceIds", visibility=["read", "create", "update", "delete", "query"]
    )
    """The IDs of the resources that will be remediated. Can specify at most 100 IDs. This filter
     cannot be used when ReEvaluateCompliance is set to ReEvaluateCompliance, and cannot be empty if
     provided."""

    @overload
    def __init__(
        self,
        *,
        locations: Optional[list[str]] = None,
        resource_ids: 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 RemediationProperties(_Model):
    """The remediation properties.

    :ivar policy_assignment_id: The resource ID of the policy assignment that should be remediated.
    :vartype policy_assignment_id: str
    :ivar policy_definition_reference_id: The policy definition reference ID of the individual
     definition that should be remediated. Required when the policy assignment being remediated
     assigns a policy set definition.
    :vartype policy_definition_reference_id: str
    :ivar resource_discovery_mode: The way resources to remediate are discovered. Defaults to
     ExistingNonCompliant if not specified. Known values are: "ExistingNonCompliant" and
     "ReEvaluateCompliance".
    :vartype resource_discovery_mode: str or
     ~azure.mgmt.policyinsights.models.ResourceDiscoveryMode
    :ivar provisioning_state: The status of the remediation. This refers to the entire remediation
     task, not individual deployments. Allowed values are Evaluating, Canceled, Cancelling, Failed,
     Complete, or Succeeded.
    :vartype provisioning_state: str
    :ivar created_on: The time at which the remediation was created.
    :vartype created_on: ~datetime.datetime
    :ivar last_updated_on: The time at which the remediation was last updated.
    :vartype last_updated_on: ~datetime.datetime
    :ivar filters: The filters that will be applied to determine which resources to remediate.
    :vartype filters: ~azure.mgmt.policyinsights.models.RemediationFilters
    :ivar deployment_status: The deployment status summary for all deployments created by the
     remediation.
    :vartype deployment_status: ~azure.mgmt.policyinsights.models.RemediationDeploymentSummary
    :ivar status_message: The remediation status message. Provides additional details regarding the
     state of the remediation.
    :vartype status_message: str
    :ivar correlation_id: The remediation correlation Id. Can be used to find events related to the
     remediation in the activity log.
    :vartype correlation_id: str
    :ivar resource_count: Determines the max number of resources that can be remediated by the
     remediation job. If not provided, the default resource count is used.
    :vartype resource_count: int
    :ivar parallel_deployments: Determines how many resources to remediate at any given time. Can
     be used to increase or reduce the pace of the remediation. If not provided, the default
     parallel deployments value is used.
    :vartype parallel_deployments: int
    :ivar failure_threshold: The remediation failure threshold settings.
    :vartype failure_threshold:
     ~azure.mgmt.policyinsights.models.RemediationPropertiesFailureThreshold
    """

    policy_assignment_id: Optional[str] = rest_field(
        name="policyAssignmentId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource ID of the policy assignment that should be remediated."""
    policy_definition_reference_id: Optional[str] = rest_field(
        name="policyDefinitionReferenceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The policy definition reference ID of the individual definition that should be remediated.
     Required when the policy assignment being remediated assigns a policy set definition."""
    resource_discovery_mode: Optional[Union[str, "_models.ResourceDiscoveryMode"]] = rest_field(
        name="resourceDiscoveryMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not
     specified. Known values are: \"ExistingNonCompliant\" and \"ReEvaluateCompliance\"."""
    provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"])
    """The status of the remediation. This refers to the entire remediation task, not individual
     deployments. Allowed values are Evaluating, Canceled, Cancelling, Failed, Complete, or
     Succeeded."""
    created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339")
    """The time at which the remediation was created."""
    last_updated_on: Optional[datetime.datetime] = rest_field(
        name="lastUpdatedOn", visibility=["read"], format="rfc3339"
    )
    """The time at which the remediation was last updated."""
    filters: Optional["_models.RemediationFilters"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The filters that will be applied to determine which resources to remediate."""
    deployment_status: Optional["_models.RemediationDeploymentSummary"] = rest_field(
        name="deploymentStatus", visibility=["read"]
    )
    """The deployment status summary for all deployments created by the remediation."""
    status_message: Optional[str] = rest_field(name="statusMessage", visibility=["read"])
    """The remediation status message. Provides additional details regarding the state of the
     remediation."""
    correlation_id: Optional[str] = rest_field(name="correlationId", visibility=["read"])
    """The remediation correlation Id. Can be used to find events related to the remediation in the
     activity log."""
    resource_count: Optional[int] = rest_field(
        name="resourceCount", visibility=["read", "create", "update", "delete", "query"]
    )
    """Determines the max number of resources that can be remediated by the remediation job. If not
     provided, the default resource count is used."""
    parallel_deployments: Optional[int] = rest_field(
        name="parallelDeployments", visibility=["read", "create", "update", "delete", "query"]
    )
    """Determines how many resources to remediate at any given time. Can be used to increase or reduce
     the pace of the remediation. If not provided, the default parallel deployments value is used."""
    failure_threshold: Optional["_models.RemediationPropertiesFailureThreshold"] = rest_field(
        name="failureThreshold", visibility=["read", "create", "update", "delete", "query"]
    )
    """The remediation failure threshold settings."""

    @overload
    def __init__(
        self,
        *,
        policy_assignment_id: Optional[str] = None,
        policy_definition_reference_id: Optional[str] = None,
        resource_discovery_mode: Optional[Union[str, "_models.ResourceDiscoveryMode"]] = None,
        filters: Optional["_models.RemediationFilters"] = None,
        resource_count: Optional[int] = None,
        parallel_deployments: Optional[int] = None,
        failure_threshold: Optional["_models.RemediationPropertiesFailureThreshold"] = None,
    ) -> None: ...

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

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


class RemediationPropertiesFailureThreshold(_Model):
    """The remediation failure threshold settings.

    :ivar percentage: A number between 0.0 to 1.0 representing the percentage failure threshold.
     The remediation will fail if the percentage of failed remediation operations (i.e. failed
     deployments) exceeds this threshold.
    :vartype percentage: float
    """

    percentage: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """A number between 0.0 to 1.0 representing the percentage failure threshold. The remediation will
     fail if the percentage of failed remediation operations (i.e. failed deployments) exceeds this
     threshold."""

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

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

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


class SlimPolicyMetadata(_Model):
    """Slim version of policy metadata resource definition, excluding properties with large strings.

    :ivar properties: Properties of the policy metadata.
    :vartype properties: ~azure.mgmt.policyinsights.models.PolicyMetadataSlimProperties
    :ivar id: The ID of the policy metadata.
    :vartype id: str
    :ivar type: The type of the policy metadata.
    :vartype type: str
    :ivar name: The name of the policy metadata.
    :vartype name: str
    """

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

    __flattened_items = ["metadata_id", "category", "title", "owner", "additional_content_url", "metadata"]

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

    @overload
    def __init__(self, mapping: Mapping[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 SummarizeResults(_Model):
    """Summarize action results.

    :ivar odata_context: OData context string; used by OData clients to resolve type information
     based on metadata.
    :vartype odata_context: str
    :ivar odata_count: OData entity count; represents the number of summaries returned; always set
     to 1.
    :vartype odata_count: int
    :ivar value: Summarize action results.
    :vartype value: list[~azure.mgmt.policyinsights.models.Summary]
    """

    odata_context: Optional[str] = rest_field(
        name="@odata.context", visibility=["read", "create", "update", "delete", "query"]
    )
    """OData context string; used by OData clients to resolve type information based on metadata."""
    odata_count: Optional[int] = rest_field(
        name="@odata.count", visibility=["read", "create", "update", "delete", "query"]
    )
    """OData entity count; represents the number of summaries returned; always set to 1."""
    value: Optional[list["_models.Summary"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Summarize action results."""

    @overload
    def __init__(
        self,
        *,
        odata_context: Optional[str] = None,
        odata_count: Optional[int] = None,
        value: Optional[list["_models.Summary"]] = None,
    ) -> None: ...

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

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


class Summary(_Model):
    """Summary results.

    :ivar odata_id: OData entity ID; always set to null since summaries do not have an entity ID.
    :vartype odata_id: str
    :ivar odata_context: OData context string; used by OData clients to resolve type information
     based on metadata.
    :vartype odata_context: str
    :ivar results: Compliance summary for all policy assignments.
    :vartype results: ~azure.mgmt.policyinsights.models.SummaryResults
    :ivar policy_assignments: Policy assignments summary.
    :vartype policy_assignments: list[~azure.mgmt.policyinsights.models.PolicyAssignmentSummary]
    """

    odata_id: Optional[str] = rest_field(name="@odata.id", visibility=["read", "create", "update", "delete", "query"])
    """OData entity ID; always set to null since summaries do not have an entity ID."""
    odata_context: Optional[str] = rest_field(
        name="@odata.context", visibility=["read", "create", "update", "delete", "query"]
    )
    """OData context string; used by OData clients to resolve type information based on metadata."""
    results: Optional["_models.SummaryResults"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Compliance summary for all policy assignments."""
    policy_assignments: Optional[list["_models.PolicyAssignmentSummary"]] = rest_field(
        name="policyAssignments", visibility=["read", "create", "update", "delete", "query"]
    )
    """Policy assignments summary."""

    @overload
    def __init__(
        self,
        *,
        odata_id: Optional[str] = None,
        odata_context: Optional[str] = None,
        results: Optional["_models.SummaryResults"] = None,
        policy_assignments: Optional[list["_models.PolicyAssignmentSummary"]] = None,
    ) -> None: ...

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

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


class SummaryResults(_Model):
    """Compliance summary on a particular summary level.

    :ivar query_results_uri: HTTP POST URI for queryResults action on Microsoft.PolicyInsights to
     retrieve raw results for the compliance summary. This property will not be available by default
     in future API versions, but could be queried explicitly.
    :vartype query_results_uri: str
    :ivar non_compliant_resources: Number of non-compliant resources.
    :vartype non_compliant_resources: int
    :ivar non_compliant_policies: Number of non-compliant policies.
    :vartype non_compliant_policies: int
    :ivar resource_details: The resources summary at this level.
    :vartype resource_details: list[~azure.mgmt.policyinsights.models.ComplianceDetail]
    :ivar policy_details: The policy artifact summary at this level. For query scope level, it
     represents policy assignment summary. For policy assignment level, it represents policy
     definitions summary.
    :vartype policy_details: list[~azure.mgmt.policyinsights.models.ComplianceDetail]
    :ivar policy_group_details: The policy definition group summary at this level.
    :vartype policy_group_details: list[~azure.mgmt.policyinsights.models.ComplianceDetail]
    """

    query_results_uri: Optional[str] = rest_field(
        name="queryResultsUri", visibility=["read", "create", "update", "delete", "query"]
    )
    """HTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for
     the compliance summary. This property will not be available by default in future API versions,
     but could be queried explicitly."""
    non_compliant_resources: Optional[int] = rest_field(
        name="nonCompliantResources", visibility=["read", "create", "update", "delete", "query"]
    )
    """Number of non-compliant resources."""
    non_compliant_policies: Optional[int] = rest_field(
        name="nonCompliantPolicies", visibility=["read", "create", "update", "delete", "query"]
    )
    """Number of non-compliant policies."""
    resource_details: Optional[list["_models.ComplianceDetail"]] = rest_field(
        name="resourceDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resources summary at this level."""
    policy_details: Optional[list["_models.ComplianceDetail"]] = rest_field(
        name="policyDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """The policy artifact summary at this level. For query scope level, it represents policy
     assignment summary. For policy assignment level, it represents policy definitions summary."""
    policy_group_details: Optional[list["_models.ComplianceDetail"]] = rest_field(
        name="policyGroupDetails", visibility=["read", "create", "update", "delete", "query"]
    )
    """The policy definition group summary at this level."""

    @overload
    def __init__(
        self,
        *,
        query_results_uri: Optional[str] = None,
        non_compliant_resources: Optional[int] = None,
        non_compliant_policies: Optional[int] = None,
        resource_details: Optional[list["_models.ComplianceDetail"]] = None,
        policy_details: Optional[list["_models.ComplianceDetail"]] = None,
        policy_group_details: Optional[list["_models.ComplianceDetail"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: 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.policyinsights.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.policyinsights.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 TrackedResourceModificationDetails(_Model):
    """The details of the policy triggered deployment that created or modified the tracked resource.

    :ivar policy_details: The details of the policy that created or modified the tracked resource.
    :vartype policy_details: ~azure.mgmt.policyinsights.models.PolicyDetails
    :ivar deployment_id: The ID of the deployment that created or modified the tracked resource.
    :vartype deployment_id: str
    :ivar deployment_time: Timestamp of the deployment that created or modified the tracked
     resource.
    :vartype deployment_time: ~datetime.datetime
    """

    policy_details: Optional["_models.PolicyDetails"] = rest_field(name="policyDetails", visibility=["read"])
    """The details of the policy that created or modified the tracked resource."""
    deployment_id: Optional[str] = rest_field(name="deploymentId", visibility=["read"])
    """The ID of the deployment that created or modified the tracked resource."""
    deployment_time: Optional[datetime.datetime] = rest_field(
        name="deploymentTime", visibility=["read"], format="rfc3339"
    )
    """Timestamp of the deployment that created or modified the tracked resource."""


class TypedErrorInfo(_Model):
    """Scenario specific error details.

    :ivar type: The type of included error details.
    :vartype type: str
    :ivar info: The scenario specific error details.
    :vartype info: any
    """

    type: Optional[str] = rest_field(visibility=["read"])
    """The type of included error details."""
    info: Optional[Any] = rest_field(visibility=["read"])
    """The scenario specific error details."""
