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

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

from .._utils.model_base import Model as _Model, rest_discriminator, rest_field
from ._enums import BenefitType, ConditionalCreditEntityType, DiscountEntityType, DiscountType

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


class ApplicableMacc(ProxyResource):
    """Applicable MACC.

    :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.billingbenefits.models.SystemData
    :ivar properties: Applicable MACC properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.MaccModelProperties
    """

    properties: Optional["_models.MaccModelProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Applicable MACC properties."""

    __flattened_items = [
        "provisioning_state",
        "status",
        "entity_type",
        "display_name",
        "product_code",
        "billing_account_resource_id",
        "commitment",
        "start_at",
        "end_at",
        "system_id",
        "automatic_shortfall",
        "automatic_shortfall_suppress_reason",
        "shortfall",
        "milestones",
        "resource_id",
        "allow_contributors",
        "primary_resource_id",
        "primary_billing_account_resource_id",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 AppliedScopeProperties(_Model):
    """Properties specific to applied scope type. Not required if not applicable.

    :ivar tenant_id: Tenant ID where the benefit is applied.
    :vartype tenant_id: str
    :ivar management_group_id: Fully-qualified identifier of the management group where the benefit
     must be applied.
    :vartype management_group_id: str
    :ivar subscription_id: Fully-qualified identifier of the subscription.
    :vartype subscription_id: str
    :ivar resource_group_id: Fully-qualified identifier of the resource group.
    :vartype resource_group_id: str
    :ivar display_name: Display name.
    :vartype display_name: str
    """

    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"])
    """Tenant ID where the benefit is applied."""
    management_group_id: Optional[str] = rest_field(
        name="managementGroupId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified identifier of the management group where the benefit must be applied."""
    subscription_id: Optional[str] = rest_field(
        name="subscriptionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified identifier of the subscription."""
    resource_group_id: Optional[str] = rest_field(
        name="resourceGroupId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified identifier of the resource group."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""

    @overload
    def __init__(
        self,
        *,
        tenant_id: Optional[str] = None,
        management_group_id: Optional[str] = None,
        subscription_id: Optional[str] = None,
        resource_group_id: Optional[str] = None,
        display_name: Optional[str] = None,
    ) -> None: ...

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

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


class AutomaticShortfallSuppressReason(_Model):
    """Optional field to record suppression reason for automatic shortfall.

    :ivar code: Code for the suppression reason.
    :vartype code: str
    :ivar message: Message for suppression reason.
    :vartype message: str
    """

    code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Code for the suppression reason."""
    message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Message for suppression reason."""

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

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

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


class Award(_Model):
    """Award details for milestone completion.

    :ivar credit: Credit amount to be awarded.
    :vartype credit: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar start_at: Start date when the credit becomes effective.
    :vartype start_at: ~datetime.datetime
    :ivar end_at: End date when the credit expires.
    :vartype end_at: ~datetime.datetime
    :ivar resource_id: Resource ID for the awarded credit.
    :vartype resource_id: str
    :ivar system_id: This is the globally unique identifier of the credit which will not change for
     its lifetime.
    :vartype system_id: str
    :ivar balance_version: Points to BalanceVersion document that indicates the remaining
     commitment balance when the credit was created.
    :vartype balance_version: float
    :ivar duration: Duration for which the benefit is active. Will be in format P{int}M or P{int}Y.
     Any values representing up to 12 years are valid. Upper limit examples: P144M, P12Y. Known
     values are: "P1M", "P1Y", "P3Y", and "P5Y".
    :vartype duration: str or ~azure.mgmt.billingbenefits.models.Term
    """

    credit: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Credit amount to be awarded."""
    start_at: Optional[datetime.datetime] = rest_field(
        name="startAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start date when the credit becomes effective."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End date when the credit expires."""
    resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"])
    """Resource ID for the awarded credit."""
    system_id: Optional[str] = rest_field(name="systemId", visibility=["read"])
    """This is the globally unique identifier of the credit which will not change for its lifetime."""
    balance_version: Optional[float] = rest_field(name="balanceVersion", visibility=["read"])
    """Points to BalanceVersion document that indicates the remaining commitment balance when the
     credit was created."""
    duration: Optional[Union[str, "_models.Term"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Duration for which the benefit is active. Will be in format P{int}M or P{int}Y. Any values
     representing up to 12 years are valid. Upper limit examples: P144M, P12Y. Known values are:
     \"P1M\", \"P1Y\", \"P3Y\", and \"P5Y\"."""

    @overload
    def __init__(
        self,
        *,
        credit: Optional["_models.Commitment"] = None,
        start_at: Optional[datetime.datetime] = None,
        end_at: Optional[datetime.datetime] = None,
        duration: Optional[Union[str, "_models.Term"]] = None,
    ) -> None: ...

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

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


class BenefitValidateModel(_Model):
    """Abstract benefit model to validate.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    ConditionalCreditsValidateModel, CreditsValidateModel, MaccValidateModel,
    SavingsPlanValidateModel

    :ivar benefit_type: Type of benefit to validate. This is used to determine the model type for
     validation. Required. Known values are: "SavingsPlan", "MACC", "ConditionalCredits", and
     "Credits".
    :vartype benefit_type: str or ~azure.mgmt.billingbenefits.models.BenefitType
    """

    __mapping__: dict[str, _Model] = {}
    benefit_type: str = rest_discriminator(
        name="benefitType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of benefit to validate. This is used to determine the model type for validation. Required.
     Known values are: \"SavingsPlan\", \"MACC\", \"ConditionalCredits\", and \"Credits\"."""

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

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

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


class BenefitValidateRequest(_Model):
    """Request to validate any benefit.

    :ivar benefits: Defines benefits for validation.
    :vartype benefits: list[~azure.mgmt.billingbenefits.models.BenefitValidateModel]
    """

    benefits: Optional[list["_models.BenefitValidateModel"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Defines benefits for validation."""

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

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

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


class BenefitValidateResponse(_Model):
    """Benefit validate response.

    :ivar benefits: Defines benefit validation response for benefits.
    :vartype benefits: list[~azure.mgmt.billingbenefits.models.BenefitValidateResponseProperty]
    :ivar next_link: Url to get the next page.
    :vartype next_link: str
    """

    benefits: Optional[list["_models.BenefitValidateResponseProperty"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Defines benefit validation response for benefits."""
    next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"])
    """Url to get the next page."""

    @overload
    def __init__(
        self,
        *,
        benefits: Optional[list["_models.BenefitValidateResponseProperty"]] = None,
        next_link: 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 BenefitValidateResponseProperty(_Model):
    """Benefit validate response property.

    :ivar valid: Indicates if the provided input was valid.
    :vartype valid: bool
    :ivar reason_code: Failure reason code if the provided input was invalid.
    :vartype reason_code: str
    :ivar reason: Failure reason if the provided input was invalid.
    :vartype reason: str
    :ivar resource_id: Resource identifier of the benefit that was validated.
    :vartype resource_id: str
    """

    valid: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Indicates if the provided input was valid."""
    reason_code: Optional[str] = rest_field(
        name="reasonCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Failure reason code if the provided input was invalid."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Failure reason if the provided input was invalid."""
    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource identifier of the benefit that was validated."""

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

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

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


class BillingPlanInformation(_Model):
    """Information describing the type of billing plan for this savings plan.

    :ivar pricing_currency_total: Amount of money to be paid for the Order. Tax is not included.
    :vartype pricing_currency_total: ~azure.mgmt.billingbenefits.models.Price
    :ivar start_date: Date when the billing plan has started.
    :vartype start_date: ~datetime.date
    :ivar next_payment_due_date: For recurring billing plans, indicates the date when next payment
     will be processed. Null when total is paid off.
    :vartype next_payment_due_date: ~datetime.date
    :ivar transactions:
    :vartype transactions: list[~azure.mgmt.billingbenefits.models.PaymentDetail]
    """

    pricing_currency_total: Optional["_models.Price"] = rest_field(
        name="pricingCurrencyTotal", visibility=["read", "create", "update", "delete", "query"]
    )
    """Amount of money to be paid for the Order. Tax is not included."""
    start_date: Optional[datetime.date] = rest_field(
        name="startDate", visibility=["read", "create", "update", "delete", "query"]
    )
    """Date when the billing plan has started."""
    next_payment_due_date: Optional[datetime.date] = rest_field(
        name="nextPaymentDueDate", visibility=["read", "create", "update", "delete", "query"]
    )
    """For recurring billing plans, indicates the date when next payment will be processed. Null when
     total is paid off."""
    transactions: Optional[list["_models.PaymentDetail"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        pricing_currency_total: Optional["_models.Price"] = None,
        start_date: Optional[datetime.date] = None,
        next_payment_due_date: Optional[datetime.date] = None,
        transactions: Optional[list["_models.PaymentDetail"]] = None,
    ) -> None: ...

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

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


class CatalogClaimsItem(_Model):
    """Catalog claim for a discount.

    :ivar catalog_claims_item_type:
    :vartype catalog_claims_item_type: str
    :ivar value:
    :vartype value: str
    """

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

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

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

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


class ChargeShortfallRequest(_Model):
    """Charge shortfall request.

    :ivar properties: Charge shortfall request properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.Shortfall
    """

    properties: Optional["_models.Shortfall"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Charge shortfall request properties."""

    __flattened_items = ["product_code", "charge", "start_at", "end_at", "resource_id", "balance_version", "system_id"]

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

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

    :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase
     record.
    :vartype currency_code: str
    :ivar amount:
    :vartype amount: float
    """

    currency_code: Optional[str] = rest_field(
        name="currencyCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """The ISO 4217 3-letter currency code for the currency used by this purchase record."""
    amount: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"])

    @overload
    def __init__(
        self,
        *,
        currency_code: Optional[str] = None,
        amount: 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 Commitment(Price):
    """Commitment towards the benefit.

    :ivar currency_code: The ISO 4217 3-letter currency code for the currency used by this purchase
     record.
    :vartype currency_code: str
    :ivar amount:
    :vartype amount: float
    :ivar grain: The grain of the commitment. Known values are: "Hourly", "FullTerm", and
     "Unknown".
    :vartype grain: str or ~azure.mgmt.billingbenefits.models.CommitmentGrain
    """

    grain: Optional[Union[str, "_models.CommitmentGrain"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The grain of the commitment. Known values are: \"Hourly\", \"FullTerm\", and \"Unknown\"."""

    @overload
    def __init__(
        self,
        *,
        currency_code: Optional[str] = None,
        amount: Optional[float] = None,
        grain: Optional[Union[str, "_models.CommitmentGrain"]] = None,
    ) -> None: ...

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

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


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

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

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

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

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

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


class ConditionalCredit(TrackedResource):
    """Resource definition for Conditional Credits.

    :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.billingbenefits.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: Conditional credit properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.ConditionalCreditProperties
    :ivar managed_by: The fully qualified resource ID of the resource that manages this resource.
     Indicates if this resource is managed by another Azure resource. If this is present, complete
     mode deployment will not delete the resource if it is removed from the template since it is
     managed by another resource.
    :vartype managed_by: str
    :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for
     resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported,
     the resource provider must validate and persist this value.
    :vartype kind: str
    :ivar etag: The etag field is *not* required. If it is provided in the response body, it must
     also be provided as a header per the normal etag convention.  Entity tags are used for
     comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in
     the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range
     (section 14.27) header fields.
    :vartype etag: str
    :ivar identity: Managed service identity (system assigned and/or user assigned identities).
    :vartype identity: ~azure.mgmt.billingbenefits.models.ManagedServiceIdentity
    :ivar sku: The resource model definition representing SKU.
    :vartype sku: ~azure.mgmt.billingbenefits.models.Sku
    :ivar plan: Plan for the resource.
    :vartype plan: ~azure.mgmt.billingbenefits.models.Plan
    """

    properties: Optional["_models.ConditionalCreditProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Conditional credit properties."""
    managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read", "create", "update"])
    """The fully qualified resource ID of the resource that manages this resource. Indicates if this
     resource is managed by another Azure resource. If this is present, complete mode deployment
     will not delete the resource if it is removed from the template since it is managed by another
     resource."""
    kind: Optional[str] = rest_field(visibility=["read", "create"])
    """Metadata used by portal/tooling/etc to render different UX experiences for resources of the
     same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource
     provider must validate and persist this value."""
    etag: Optional[str] = rest_field(visibility=["read"])
    """The etag field is *not* required. If it is provided in the response body, it must also be
     provided as a header per the normal etag convention.  Entity tags are used for comparing two or
     more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section
     14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27)
     header fields."""
    identity: Optional["_models.ManagedServiceIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed service identity (system assigned and/or user assigned identities)."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource model definition representing SKU."""
    plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Plan for the resource."""

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.ConditionalCreditProperties"] = None,
        managed_by: Optional[str] = None,
        kind: Optional[str] = None,
        identity: Optional["_models.ManagedServiceIdentity"] = None,
        sku: Optional["_models.Sku"] = None,
        plan: Optional["_models.Plan"] = None,
    ) -> None: ...

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

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


class ConditionalCreditContributor(ProxyResource):
    """Conditional credit contributor.

    :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.billingbenefits.models.SystemData
    :ivar properties: Conditional credit contributor properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.ContributorConditionalCreditProperties
    """

    properties: Optional["_models.ContributorConditionalCreditProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Conditional credit contributor properties."""

    __flattened_items = [
        "display_name",
        "billing_account_resource_id",
        "provisioning_state",
        "status",
        "end_at",
        "benefit_resource_id",
        "resource_id",
        "primary_resource_id",
        "system_id",
        "product_code",
        "start_at",
        "milestones",
        "primary_billing_account_resource_id",
        "entity_type",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 ConditionalCreditMilestoneBase(_Model):
    """Base milestone definition for conditional credits.

    :ivar milestone_id: Unique identifier for the milestone.
    :vartype milestone_id: str
    :ivar name: Display name for the milestone.
    :vartype name: str
    :ivar status: Current status of the milestone. Known values are: "Unknown", "Scheduled",
     "Active", "Pending", "Failed", "Completed", "Canceled", "Removed", "PendingSettlement", and
     "Missed".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.MilestoneStatus
    :ivar end_at: End date for this milestone.
    :vartype end_at: ~datetime.datetime
    :ivar spend_target: Spend target for this milestone.
    :vartype spend_target: ~azure.mgmt.billingbenefits.models.Price
    :ivar award: Award details for this milestone (only present for primary conditional credits).
    :vartype award: ~azure.mgmt.billingbenefits.models.Award
    """

    milestone_id: Optional[str] = rest_field(
        name="milestoneId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Unique identifier for the milestone."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Display name for the milestone."""
    status: Optional[Union[str, "_models.MilestoneStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Current status of the milestone. Known values are: \"Unknown\", \"Scheduled\", \"Active\",
     \"Pending\", \"Failed\", \"Completed\", \"Canceled\", \"Removed\", \"PendingSettlement\", and
     \"Missed\"."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End date for this milestone."""
    spend_target: Optional["_models.Price"] = rest_field(
        name="spendTarget", visibility=["read", "create", "update", "delete", "query"]
    )
    """Spend target for this milestone."""
    award: Optional["_models.Award"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Award details for this milestone (only present for primary conditional credits)."""

    @overload
    def __init__(
        self,
        *,
        milestone_id: Optional[str] = None,
        name: Optional[str] = None,
        status: Optional[Union[str, "_models.MilestoneStatus"]] = None,
        end_at: Optional[datetime.datetime] = None,
        spend_target: Optional["_models.Price"] = None,
        award: Optional["_models.Award"] = None,
    ) -> None: ...

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

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


class ConditionalCreditMilestone(ConditionalCreditMilestoneBase):
    """Milestone definition within a conditional credit.

    :ivar milestone_id: Unique identifier for the milestone.
    :vartype milestone_id: str
    :ivar name: Display name for the milestone.
    :vartype name: str
    :ivar status: Current status of the milestone. Known values are: "Unknown", "Scheduled",
     "Active", "Pending", "Failed", "Completed", "Canceled", "Removed", "PendingSettlement", and
     "Missed".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.MilestoneStatus
    :ivar end_at: End date for this milestone.
    :vartype end_at: ~datetime.datetime
    :ivar spend_target: Spend target for this milestone.
    :vartype spend_target: ~azure.mgmt.billingbenefits.models.Price
    :ivar award: Award details for this milestone.
    :vartype award: ~azure.mgmt.billingbenefits.models.Award
    """

    @overload
    def __init__(
        self,
        *,
        milestone_id: Optional[str] = None,
        name: Optional[str] = None,
        status: Optional[Union[str, "_models.MilestoneStatus"]] = None,
        end_at: Optional[datetime.datetime] = None,
        spend_target: Optional["_models.Price"] = None,
        award: Optional["_models.Award"] = None,
    ) -> None: ...

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

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


class ConditionalCreditPatchRequest(_Model):
    """Conditional credit patch request.

    :ivar properties: Conditional credit patch request properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.ConditionalCreditPatchRequestProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    properties: Optional["_models.ConditionalCreditPatchRequestProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Conditional credit patch request properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = ["display_name", "end_at", "allow_contributors", "milestones"]

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

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

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

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

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


class ConditionalCreditPatchRequestProperties(_Model):
    """Conditional credit patch request properties.

    :ivar display_name: Display name for the conditional credit.
    :vartype display_name: str
    :ivar end_at: End DateTime in UTC.
    :vartype end_at: ~datetime.datetime
    :ivar allow_contributors: Whether this conditional credit allows contributor billing accounts.
     Known values are: "Unknown", "Enabled", and "Disabled".
    :vartype allow_contributors: str or ~azure.mgmt.billingbenefits.models.EnablementMode
    :ivar milestones: Updated milestones list (only applicable for primary conditional credits).
    :vartype milestones: list[~azure.mgmt.billingbenefits.models.ConditionalCreditMilestone]
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name for the conditional credit."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime in UTC."""
    allow_contributors: Optional[Union[str, "_models.EnablementMode"]] = rest_field(
        name="allowContributors", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether this conditional credit allows contributor billing accounts. Known values are:
     \"Unknown\", \"Enabled\", and \"Disabled\"."""
    milestones: Optional[list["_models.ConditionalCreditMilestone"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Updated milestones list (only applicable for primary conditional credits)."""

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        end_at: Optional[datetime.datetime] = None,
        allow_contributors: Optional[Union[str, "_models.EnablementMode"]] = None,
        milestones: Optional[list["_models.ConditionalCreditMilestone"]] = None,
    ) -> None: ...

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

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


class ConditionalCreditProperties(_Model):
    """Properties belonging to conditional credits.

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

    :ivar entity_type: Type of conditional credit entity. Required. Known values are: "Primary" and
     "Contributor".
    :vartype entity_type: str or ~azure.mgmt.billingbenefits.models.ConditionalCreditEntityType
    :ivar display_name: Display name for the conditional credit.
    :vartype display_name: str
    :ivar billing_account_resource_id: The billing account resource ID.
    :vartype billing_account_resource_id: str
    :ivar provisioning_state: The provisioning state of the resource. Known values are: "Unknown",
     "Succeeded", "Failed", "Canceled", and "Pending".
    :vartype provisioning_state: str or
     ~azure.mgmt.billingbenefits.models.ConditionalCreditsProvisioningState
    :ivar status: The status of the conditional credit. Known values are: "Unknown", "Scheduled",
     "Active", "Pending", "Failed", "Canceled", "Completed", "Stopped", and "PendingSettlement".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.ConditionalCreditStatus
    :ivar start_at: Start date of the conditional credit.
    :vartype start_at: ~datetime.datetime
    :ivar end_at: End date of the conditional credit (derived from last milestone).
    :vartype end_at: ~datetime.datetime
    :ivar product_code: Product code for the conditional credit.
    :vartype product_code: str
    :ivar benefit_resource_id: Fully-qualified identifier of the benefit under applicable benefit
     list.
    :vartype benefit_resource_id: str
    :ivar resource_id: Fully-qualified resource identifier of the resource. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}.
    :vartype resource_id: str
    """

    __mapping__: dict[str, _Model] = {}
    entity_type: str = rest_discriminator(name="entityType", visibility=["read", "create", "update", "delete", "query"])
    """Type of conditional credit entity. Required. Known values are: \"Primary\" and \"Contributor\"."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name for the conditional credit."""
    billing_account_resource_id: Optional[str] = rest_field(
        name="billingAccountResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The billing account resource ID."""
    provisioning_state: Optional[Union[str, "_models.ConditionalCreditsProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """The provisioning state of the resource. Known values are: \"Unknown\", \"Succeeded\",
     \"Failed\", \"Canceled\", and \"Pending\"."""
    status: Optional[Union[str, "_models.ConditionalCreditStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The status of the conditional credit. Known values are: \"Unknown\", \"Scheduled\", \"Active\",
     \"Pending\", \"Failed\", \"Canceled\", \"Completed\", \"Stopped\", and \"PendingSettlement\"."""
    start_at: Optional[datetime.datetime] = rest_field(
        name="startAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start date of the conditional credit."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End date of the conditional credit (derived from last milestone)."""
    product_code: Optional[str] = rest_field(
        name="productCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Product code for the conditional credit."""
    benefit_resource_id: Optional[str] = rest_field(name="benefitResourceId", visibility=["read"])
    """Fully-qualified identifier of the benefit under applicable benefit list."""
    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified resource identifier of the resource. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}."""

    @overload
    def __init__(
        self,
        *,
        entity_type: str,
        display_name: Optional[str] = None,
        billing_account_resource_id: Optional[str] = None,
        status: Optional[Union[str, "_models.ConditionalCreditStatus"]] = None,
        start_at: Optional[datetime.datetime] = None,
        end_at: Optional[datetime.datetime] = None,
        product_code: Optional[str] = None,
        resource_id: Optional[str] = None,
    ) -> None: ...

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

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


class ConditionalCreditsValidateModel(BenefitValidateModel, discriminator="ConditionalCredits"):
    """Conditional Credits validate model.

    :ivar properties: Conditional Credits validate properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.ConditionalCreditProperties
    :ivar benefit_type: Type of benefit to validate. This is used to determine the model type for
     validation. Required. CONDITIONAL_CREDITS.
    :vartype benefit_type: str or ~azure.mgmt.billingbenefits.models.CONDITIONAL_CREDITS
    """

    properties: Optional["_models.ConditionalCreditProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Conditional Credits validate properties."""
    benefit_type: Literal[BenefitType.CONDITIONAL_CREDITS] = rest_discriminator(name="benefitType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of benefit to validate. This is used to determine the model type for validation. Required.
     CONDITIONAL_CREDITS."""

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

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.benefit_type = BenefitType.CONDITIONAL_CREDITS  # type: ignore


class ConditionsItem(_Model):
    """Condition for a discount.

    :ivar condition_name:
    :vartype condition_name: str
    :ivar value: These items are open-ended strings.
    :vartype value: list[str]
    :ivar type:
    :vartype type: str
    """

    condition_name: Optional[str] = rest_field(
        name="conditionName", visibility=["read", "create", "update", "delete", "query"]
    )
    value: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """These items are open-ended strings."""
    type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])

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

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

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


class Contributor(ProxyResource):
    """MACC contributor.

    :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.billingbenefits.models.SystemData
    :ivar properties: MACC contributor properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.MaccModelProperties
    """

    properties: Optional["_models.MaccModelProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """MACC contributor properties."""

    __flattened_items = [
        "provisioning_state",
        "status",
        "entity_type",
        "display_name",
        "product_code",
        "billing_account_resource_id",
        "commitment",
        "start_at",
        "end_at",
        "system_id",
        "automatic_shortfall",
        "automatic_shortfall_suppress_reason",
        "shortfall",
        "milestones",
        "resource_id",
        "allow_contributors",
        "primary_resource_id",
        "primary_billing_account_resource_id",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 ContributorConditionalCreditMilestone(ConditionalCreditMilestoneBase):
    """Milestone definition for contributor conditional credit (excludes award details).

    :ivar milestone_id: Unique identifier for the milestone.
    :vartype milestone_id: str
    :ivar name: Display name for the milestone.
    :vartype name: str
    :ivar status: Current status of the milestone. Known values are: "Unknown", "Scheduled",
     "Active", "Pending", "Failed", "Completed", "Canceled", "Removed", "PendingSettlement", and
     "Missed".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.MilestoneStatus
    :ivar end_at: End date for this milestone.
    :vartype end_at: ~datetime.datetime
    :ivar spend_target: Spend target for this milestone.
    :vartype spend_target: ~azure.mgmt.billingbenefits.models.Price
    :ivar award: Award details for this milestone (only present for primary conditional credits).
    :vartype award: ~azure.mgmt.billingbenefits.models.Award
    """

    @overload
    def __init__(
        self,
        *,
        milestone_id: Optional[str] = None,
        name: Optional[str] = None,
        status: Optional[Union[str, "_models.MilestoneStatus"]] = None,
        end_at: Optional[datetime.datetime] = None,
        spend_target: Optional["_models.Price"] = None,
        award: Optional["_models.Award"] = None,
    ) -> None: ...

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

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


class ContributorConditionalCreditProperties(ConditionalCreditProperties, discriminator="Contributor"):
    """Properties for contributor conditional credit.

    :ivar display_name: Display name for the conditional credit.
    :vartype display_name: str
    :ivar billing_account_resource_id: The billing account resource ID.
    :vartype billing_account_resource_id: str
    :ivar provisioning_state: The provisioning state of the resource. Known values are: "Unknown",
     "Succeeded", "Failed", "Canceled", and "Pending".
    :vartype provisioning_state: str or
     ~azure.mgmt.billingbenefits.models.ConditionalCreditsProvisioningState
    :ivar status: The status of the conditional credit. Known values are: "Unknown", "Scheduled",
     "Active", "Pending", "Failed", "Canceled", "Completed", "Stopped", and "PendingSettlement".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.ConditionalCreditStatus
    :ivar end_at: End date of the conditional credit (derived from last milestone).
    :vartype end_at: ~datetime.datetime
    :ivar benefit_resource_id: Fully-qualified identifier of the benefit under applicable benefit
     list.
    :vartype benefit_resource_id: str
    :ivar resource_id: Fully-qualified resource identifier of the resource. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}.
    :vartype resource_id: str
    :ivar primary_resource_id: Resource ID of the primary conditional credit (required for
     contributors).
    :vartype primary_resource_id: str
    :ivar system_id: System identifier shared between primary and contributor conditional credits
     representing the same conditional credit program.
    :vartype system_id: str
    :ivar product_code: Product code for the contributor conditional credit.
    :vartype product_code: str
    :ivar start_at: Start date for the contributor conditional credit.
    :vartype start_at: ~datetime.datetime
    :ivar milestones: List of milestones copied from primary conditional credit (excludes award
     details).
    :vartype milestones:
     list[~azure.mgmt.billingbenefits.models.ContributorConditionalCreditMilestone]
    :ivar primary_billing_account_resource_id: Fully-qualified billing account resource identifier
     of the primary CACO. Format must be Azure Resource ID:
     /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}.
    :vartype primary_billing_account_resource_id: str
    :ivar entity_type: Type of conditional credit entity. Required. CONTRIBUTOR.
    :vartype entity_type: str or ~azure.mgmt.billingbenefits.models.CONTRIBUTOR
    """

    primary_resource_id: Optional[str] = rest_field(
        name="primaryResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource ID of the primary conditional credit (required for contributors)."""
    system_id: Optional[str] = rest_field(name="systemId", visibility=["read", "create", "update", "delete", "query"])
    """System identifier shared between primary and contributor conditional credits representing the
     same conditional credit program."""
    milestones: Optional[list["_models.ContributorConditionalCreditMilestone"]] = rest_field(visibility=["read"])
    """List of milestones copied from primary conditional credit (excludes award details)."""
    primary_billing_account_resource_id: Optional[str] = rest_field(
        name="primaryBillingAccountResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified billing account resource identifier of the primary CACO. Format must be Azure
     Resource ID: /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}."""
    entity_type: Literal[ConditionalCreditEntityType.CONTRIBUTOR] = rest_discriminator(name="entityType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of conditional credit entity. Required. CONTRIBUTOR."""

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        billing_account_resource_id: Optional[str] = None,
        status: Optional[Union[str, "_models.ConditionalCreditStatus"]] = None,
        end_at: Optional[datetime.datetime] = None,
        resource_id: Optional[str] = None,
        primary_resource_id: Optional[str] = None,
        system_id: Optional[str] = None,
        product_code: Optional[str] = None,
        start_at: Optional[datetime.datetime] = None,
        primary_billing_account_resource_id: Optional[str] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.entity_type = ConditionalCreditEntityType.CONTRIBUTOR  # type: ignore


class Credit(TrackedResource):
    """Credit 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.billingbenefits.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: Credit properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.CreditProperties
    :ivar managed_by: The fully qualified resource ID of the resource that manages this resource.
     Indicates if this resource is managed by another Azure resource. If this is present, complete
     mode deployment will not delete the resource if it is removed from the template since it is
     managed by another resource.
    :vartype managed_by: str
    :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for
     resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported,
     the resource provider must validate and persist this value.
    :vartype kind: str
    :ivar etag: The etag field is *not* required. If it is provided in the response body, it must
     also be provided as a header per the normal etag convention.  Entity tags are used for
     comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in
     the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range
     (section 14.27) header fields.
    :vartype etag: str
    :ivar identity: Managed service identity (system assigned and/or user assigned identities).
    :vartype identity: ~azure.mgmt.billingbenefits.models.ManagedServiceIdentity
    :ivar sku: The resource model definition representing SKU.
    :vartype sku: ~azure.mgmt.billingbenefits.models.Sku
    :ivar plan: Plan for the resource.
    :vartype plan: ~azure.mgmt.billingbenefits.models.Plan
    """

    properties: Optional["_models.CreditProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Credit properties."""
    managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read", "create", "update"])
    """The fully qualified resource ID of the resource that manages this resource. Indicates if this
     resource is managed by another Azure resource. If this is present, complete mode deployment
     will not delete the resource if it is removed from the template since it is managed by another
     resource."""
    kind: Optional[str] = rest_field(visibility=["read", "create"])
    """Metadata used by portal/tooling/etc to render different UX experiences for resources of the
     same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource
     provider must validate and persist this value."""
    etag: Optional[str] = rest_field(visibility=["read"])
    """The etag field is *not* required. If it is provided in the response body, it must also be
     provided as a header per the normal etag convention.  Entity tags are used for comparing two or
     more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section
     14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27)
     header fields."""
    identity: Optional["_models.ManagedServiceIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed service identity (system assigned and/or user assigned identities)."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource model definition representing SKU."""
    plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Plan for the resource."""

    __flattened_items = [
        "status",
        "product_code",
        "reason",
        "credit",
        "start_at",
        "end_at",
        "policies",
        "billing_account_resource_id",
        "billing_profile_resource_id",
        "breakdown",
        "provisioning_state",
        "system_id",
        "customer_id",
        "resource_id",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.CreditProperties"] = None,
        managed_by: Optional[str] = None,
        kind: Optional[str] = None,
        identity: Optional["_models.ManagedServiceIdentity"] = None,
        sku: Optional["_models.Sku"] = None,
        plan: Optional["_models.Plan"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 CreditBreakdownItem(_Model):
    """Credit breakdown item representing a milestone, line-item, or no-charge service.

    :ivar allocation: Allocation details including currency and amount for this breakdown item.
    :vartype allocation: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar start_at: Start DateTime.
    :vartype start_at: ~datetime.datetime
    :ivar end_at: End DateTime in UTC.
    :vartype end_at: ~datetime.datetime
    :ivar dimensions: Key-value pairs for additional parameters and metadata.
    :vartype dimensions: list[~azure.mgmt.billingbenefits.models.CreditDimension]
    """

    allocation: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Allocation details including currency and amount for this breakdown item."""
    start_at: Optional[datetime.datetime] = rest_field(
        name="startAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start DateTime."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime in UTC."""
    dimensions: Optional[list["_models.CreditDimension"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Key-value pairs for additional parameters and metadata."""

    @overload
    def __init__(
        self,
        *,
        allocation: Optional["_models.Commitment"] = None,
        start_at: Optional[datetime.datetime] = None,
        end_at: Optional[datetime.datetime] = None,
        dimensions: Optional[list["_models.CreditDimension"]] = None,
    ) -> None: ...

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

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


class CreditDimension(_Model):
    """Key-value pair for additional credit parameters and metadata.

    :ivar key: The dimension key (e.g., productFamily, description, creditType). Required.
    :vartype key: str
    :ivar value: The dimension value. Required.
    :vartype value: str
    """

    key: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The dimension key (e.g., productFamily, description, creditType). Required."""
    value: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The dimension value. Required."""

    @overload
    def __init__(
        self,
        *,
        key: str,
        value: str,
    ) -> None: ...

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

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


class CreditPatchProperties(_Model):
    """Credit patch properties.

    :ivar credit: The entire investment amount for the credit contract, including currency and
     amount. Only amount can be modified.
    :vartype credit: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar end_at: End DateTime in UTC.
    :vartype end_at: ~datetime.datetime
    :ivar breakdown: Credit line-items/milestones/no-charge services breakdown. Entire breakdown
     will be replaced in a PATCH operation.
    :vartype breakdown: list[~azure.mgmt.billingbenefits.models.CreditBreakdownItem]
    """

    credit: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The entire investment amount for the credit contract, including currency and amount. Only
     amount can be modified."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime in UTC."""
    breakdown: Optional[list["_models.CreditBreakdownItem"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Credit line-items/milestones/no-charge services breakdown. Entire breakdown will be replaced in
     a PATCH operation."""

    @overload
    def __init__(
        self,
        *,
        credit: Optional["_models.Commitment"] = None,
        end_at: Optional[datetime.datetime] = None,
        breakdown: Optional[list["_models.CreditBreakdownItem"]] = None,
    ) -> None: ...

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

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


class CreditPatchRequest(_Model):
    """Credit patch request.

    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar properties: Credit patch properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.CreditPatchProperties
    """

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

    __flattened_items = ["credit", "end_at", "breakdown"]

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

    @overload
    def __init__(self, mapping: Mapping[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 CreditPolicies(_Model):
    """Credit breakdown item representing a milestone, line-item, or no-charge service.

    :ivar redemption: Redemption policy of the Credit. Known values are: "NotApplicable",
     "AutoRedeem", and "ManualRedeem".
    :vartype redemption: str or ~azure.mgmt.billingbenefits.models.CreditRedemptionPolicy
    :ivar expiration: Expiration policy of the Credit. Known values are: "None" and
     "SuspendBillingProfile".
    :vartype expiration: str or ~azure.mgmt.billingbenefits.models.CreditExpirationPolicy
    """

    redemption: Optional[Union[str, "_models.CreditRedemptionPolicy"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Redemption policy of the Credit. Known values are: \"NotApplicable\", \"AutoRedeem\", and
     \"ManualRedeem\"."""
    expiration: Optional[Union[str, "_models.CreditExpirationPolicy"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Expiration policy of the Credit. Known values are: \"None\" and \"SuspendBillingProfile\"."""

    @overload
    def __init__(
        self,
        *,
        redemption: Optional[Union[str, "_models.CreditRedemptionPolicy"]] = None,
        expiration: Optional[Union[str, "_models.CreditExpirationPolicy"]] = None,
    ) -> None: ...

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

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


class CreditProperties(_Model):
    """Properties of a credit.

    :ivar status: Status of the credit. Known values are: "Unknown", "Pending", "Active",
     "Succeeded", "Canceled", "Failed", "Expired", "Exhausted", and "NotStarted".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.CreditStatus
    :ivar product_code: Product UPN for the credit type.
    :vartype product_code: str
    :ivar reason: The reason for the credit. Not required if not applicable.
    :vartype reason: ~azure.mgmt.billingbenefits.models.CreditReason
    :ivar credit: The entire investment amount for the credit contract, including currency and
     amount.
    :vartype credit: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar start_at: Start DateTime.
    :vartype start_at: ~datetime.datetime
    :ivar end_at: End DateTime in UTC.
    :vartype end_at: ~datetime.datetime
    :ivar policies: Credit breakdown item representing a milestone, line-item, or no-charge
     service.
    :vartype policies: ~azure.mgmt.billingbenefits.models.CreditPolicies
    :ivar billing_account_resource_id: Fully-qualified identifier of the billing account where the
     benefit is applied. Present only for Enterprise Agreement customers.
    :vartype billing_account_resource_id: str
    :ivar billing_profile_resource_id: Fully-qualified identifier of the billing profile where the
     benefit is applied. Present only for Field-led or Customer-led customers.
    :vartype billing_profile_resource_id: str
    :ivar breakdown: Credit line-items/milestones/no-charge services breakdown.
    :vartype breakdown: list[~azure.mgmt.billingbenefits.models.CreditBreakdownItem]
    :ivar provisioning_state: Provisioning state. Known values are: "Creating", "PendingBilling",
     "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed".
    :vartype provisioning_state: str or ~azure.mgmt.billingbenefits.models.ProvisioningState
    :ivar system_id: System identifier.
    :vartype system_id: str
    :ivar customer_id: Fully-qualified identifier of the customer where the savings plan is
     applied. Present only for Partner-led customers. Format is
     /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}.
    :vartype customer_id: str
    :ivar resource_id: Fully-qualified resource identifier of the resource. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}.
    :vartype resource_id: str
    """

    status: Optional[Union[str, "_models.CreditStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Status of the credit. Known values are: \"Unknown\", \"Pending\", \"Active\", \"Succeeded\",
     \"Canceled\", \"Failed\", \"Expired\", \"Exhausted\", and \"NotStarted\"."""
    product_code: Optional[str] = rest_field(
        name="productCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Product UPN for the credit type."""
    reason: Optional["_models.CreditReason"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason for the credit. Not required if not applicable."""
    credit: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The entire investment amount for the credit contract, including currency and amount."""
    start_at: Optional[datetime.datetime] = rest_field(
        name="startAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start DateTime."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime in UTC."""
    policies: Optional["_models.CreditPolicies"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Credit breakdown item representing a milestone, line-item, or no-charge service."""
    billing_account_resource_id: Optional[str] = rest_field(
        name="billingAccountResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified identifier of the billing account where the benefit is applied. Present only
     for Enterprise Agreement customers."""
    billing_profile_resource_id: Optional[str] = rest_field(name="billingProfileResourceId", visibility=["read"])
    """Fully-qualified identifier of the billing profile where the benefit is applied. Present only
     for Field-led or Customer-led customers."""
    breakdown: Optional[list["_models.CreditBreakdownItem"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Credit line-items/milestones/no-charge services breakdown."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state. Known values are: \"Creating\", \"PendingBilling\", \"ConfirmedBilling\",
     \"Created\", \"Succeeded\", \"Cancelled\", \"Expired\", and \"Failed\"."""
    system_id: Optional[str] = rest_field(name="systemId", visibility=["read", "create", "update", "delete", "query"])
    """System identifier."""
    customer_id: Optional[str] = rest_field(name="customerId", visibility=["read"])
    """Fully-qualified identifier of the customer where the savings plan is applied. Present only for
     Partner-led customers. Format is /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}."""
    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified resource identifier of the resource. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}."""

    @overload
    def __init__(
        self,
        *,
        status: Optional[Union[str, "_models.CreditStatus"]] = None,
        product_code: Optional[str] = None,
        reason: Optional["_models.CreditReason"] = None,
        credit: Optional["_models.Commitment"] = None,
        start_at: Optional[datetime.datetime] = None,
        end_at: Optional[datetime.datetime] = None,
        policies: Optional["_models.CreditPolicies"] = None,
        billing_account_resource_id: Optional[str] = None,
        breakdown: Optional[list["_models.CreditBreakdownItem"]] = None,
        system_id: Optional[str] = None,
        resource_id: Optional[str] = None,
    ) -> None: ...

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

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


class CreditReason(_Model):
    """The reason for the credit. Not required if not applicable.

    :ivar code: The reason code for credit.
    :vartype code: str
    :ivar description: The free string description of the credit.
    :vartype description: str
    """

    code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The reason code for credit."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The free string description of the credit."""

    @overload
    def __init__(
        self,
        *,
        code: 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 CreditSource(TrackedResource):
    """Credit source 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.billingbenefits.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: Credit source properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.CreditSourceProperties
    :ivar managed_by: The fully qualified resource ID of the resource that manages this resource.
     Indicates if this resource is managed by another Azure resource. If this is present, complete
     mode deployment will not delete the resource if it is removed from the template since it is
     managed by another resource.
    :vartype managed_by: str
    :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for
     resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported,
     the resource provider must validate and persist this value.
    :vartype kind: str
    :ivar etag: The etag field is *not* required. If it is provided in the response body, it must
     also be provided as a header per the normal etag convention.  Entity tags are used for
     comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in
     the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range
     (section 14.27) header fields.
    :vartype etag: str
    :ivar identity: Managed service identity (system assigned and/or user assigned identities).
    :vartype identity: ~azure.mgmt.billingbenefits.models.ManagedServiceIdentity
    :ivar sku: The resource model definition representing SKU.
    :vartype sku: ~azure.mgmt.billingbenefits.models.Sku
    :ivar plan: Plan for the resource.
    :vartype plan: ~azure.mgmt.billingbenefits.models.Plan
    """

    properties: Optional["_models.CreditSourceProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Credit source properties."""
    managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read", "create", "update"])
    """The fully qualified resource ID of the resource that manages this resource. Indicates if this
     resource is managed by another Azure resource. If this is present, complete mode deployment
     will not delete the resource if it is removed from the template since it is managed by another
     resource."""
    kind: Optional[str] = rest_field(visibility=["read", "create"])
    """Metadata used by portal/tooling/etc to render different UX experiences for resources of the
     same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource
     provider must validate and persist this value."""
    etag: Optional[str] = rest_field(visibility=["read"])
    """The etag field is *not* required. If it is provided in the response body, it must also be
     provided as a header per the normal etag convention.  Entity tags are used for comparing two or
     more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section
     14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27)
     header fields."""
    identity: Optional["_models.ManagedServiceIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed service identity (system assigned and/or user assigned identities)."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource model definition representing SKU."""
    plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Plan for the resource."""

    __flattened_items = ["status", "source_resource_id", "impacted_billing_period", "credit"]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.CreditSourceProperties"] = None,
        managed_by: Optional[str] = None,
        kind: Optional[str] = None,
        identity: Optional["_models.ManagedServiceIdentity"] = None,
        sku: Optional["_models.Sku"] = None,
        plan: Optional["_models.Plan"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 CreditSourcePatchRequest(_Model):
    """Credit patch request.

    :ivar tags: Resource Tags.
    :vartype tags: dict[str, str]
    """

    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update"])
    """Resource Tags."""

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

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

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


class CreditSourceProperties(_Model):
    """Properties of a credit source.

    :ivar status: Status of the credit. Known values are: "Unknown", "Pending", "Active",
     "Succeeded", "Canceled", "Failed", "Expired", "Exhausted", and "NotStarted".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.CreditStatus
    :ivar source_resource_id: The uri of the resource impacted which lead to the grant of the
     credit.
    :vartype source_resource_id: str
    :ivar impacted_billing_period: The billing period of the impact for the resource. Format
     YYYYMM.
    :vartype impacted_billing_period: str
    :ivar credit: Commitment towards the benefit.
    :vartype credit: ~azure.mgmt.billingbenefits.models.Commitment
    """

    status: Optional[Union[str, "_models.CreditStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Status of the credit. Known values are: \"Unknown\", \"Pending\", \"Active\", \"Succeeded\",
     \"Canceled\", \"Failed\", \"Expired\", \"Exhausted\", and \"NotStarted\"."""
    source_resource_id: Optional[str] = rest_field(
        name="sourceResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The uri of the resource impacted which lead to the grant of the credit."""
    impacted_billing_period: Optional[str] = rest_field(
        name="impactedBillingPeriod", visibility=["read", "create", "update", "delete", "query"]
    )
    """The billing period of the impact for the resource. Format YYYYMM."""
    credit: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Commitment towards the benefit."""

    @overload
    def __init__(
        self,
        *,
        status: Optional[Union[str, "_models.CreditStatus"]] = None,
        source_resource_id: Optional[str] = None,
        impacted_billing_period: Optional[str] = None,
        credit: Optional["_models.Commitment"] = None,
    ) -> None: ...

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

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


class CreditsValidateModel(BenefitValidateModel, discriminator="Credits"):
    """Credits validate model.

    :ivar properties: Credits validate properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.Credit
    :ivar benefit_type: Type of benefit to validate. This is used to determine the model type for
     validation. Required. CREDITS.
    :vartype benefit_type: str or ~azure.mgmt.billingbenefits.models.CREDITS
    """

    properties: Optional["_models.Credit"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Credits validate properties."""
    benefit_type: Literal[BenefitType.CREDITS] = rest_discriminator(name="benefitType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of benefit to validate. This is used to determine the model type for validation. Required.
     CREDITS."""

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

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.benefit_type = BenefitType.CREDITS  # type: ignore


class CustomPriceProperties(_Model):
    """Custom price properties for a given discount.

    :ivar rule_type: The type of the priceable node pricing rule. Validation: Required. Supported
     values are fixedPriceLock, fixedListPrice, and priceCeiling. Required. Known values are:
     "FixedPriceLock", "FixedListPrice", and "PriceCeiling".
    :vartype rule_type: str or ~azure.mgmt.billingbenefits.models.DiscountRuleType
    :ivar catalog_id: The catalog instance where the priceable node lives. Validation: Required. No
     defined format, will vary per team. Required.
    :vartype catalog_id: str
    :ivar catalog_claims: The set of BigCat claims. Validation: Required. Must contain
     AgreementType, NationalCloud, and PricingAudience claims. Additionally requires AccessPass
     claim when creating custom price with action == consume on the pricing instructions. Required.
    :vartype catalog_claims: list[~azure.mgmt.billingbenefits.models.CatalogClaimsItem]
    :ivar term_units: The term units for the priceable node. Validation: Optional, Maximum length
     128 characters. Must be present if and only if the availability derived by market, product,
     sku, and claims has terms.
    :vartype term_units: str
    :ivar billing_period: The billing period of the priceable node. Validation: Optional, Maximum
     length 128 characters. Only allowed if the availability derived by market, product, sku, and
     claims has terms and at least one of those terms has a billing period. When specified,
     termUnits must be specified.
    :vartype billing_period: str
    :ivar meter_type: Must be present if the market, product, sku, and claims, and optional term
     information resolves to multiple availabilities that only differ by meter type. Validation:
     Maximum length 128 characters.
    :vartype meter_type: str
    :ivar market_set_prices: The set of market set prices of the priceable node. Validation:
     Required. Must contain at least one element. Required.
    :vartype market_set_prices: list[~azure.mgmt.billingbenefits.models.MarketSetPricesItems]
    """

    rule_type: Union[str, "_models.DiscountRuleType"] = rest_field(
        name="ruleType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of the priceable node pricing rule. Validation: Required. Supported values are
     fixedPriceLock, fixedListPrice, and priceCeiling. Required. Known values are:
     \"FixedPriceLock\", \"FixedListPrice\", and \"PriceCeiling\"."""
    catalog_id: str = rest_field(name="catalogId", visibility=["read", "create", "update", "delete", "query"])
    """The catalog instance where the priceable node lives. Validation: Required. No defined format,
     will vary per team. Required."""
    catalog_claims: list["_models.CatalogClaimsItem"] = rest_field(
        name="catalogClaims", visibility=["read", "create", "update", "delete", "query"]
    )
    """The set of BigCat claims. Validation: Required. Must contain AgreementType, NationalCloud, and
     PricingAudience claims. Additionally requires AccessPass claim when creating custom price with
     action == consume on the pricing instructions. Required."""
    term_units: Optional[str] = rest_field(name="termUnits", visibility=["read", "create", "update", "delete", "query"])
    """The term units for the priceable node. Validation: Optional, Maximum length 128 characters.
     Must be present if and only if the availability derived by market, product, sku, and claims has
     terms."""
    billing_period: Optional[str] = rest_field(
        name="billingPeriod", visibility=["read", "create", "update", "delete", "query"]
    )
    """The billing period of the priceable node. Validation: Optional, Maximum length 128 characters.
     Only allowed if the availability derived by market, product, sku, and claims has terms and at
     least one of those terms has a billing period. When specified, termUnits must be specified."""
    meter_type: Optional[str] = rest_field(name="meterType", visibility=["read", "create", "update", "delete", "query"])
    """Must be present if the market, product, sku, and claims, and optional term information resolves
     to multiple availabilities that only differ by meter type. Validation: Maximum length 128
     characters."""
    market_set_prices: list["_models.MarketSetPricesItems"] = rest_field(
        name="marketSetPrices", visibility=["read", "create", "update", "delete", "query"]
    )
    """The set of market set prices of the priceable node. Validation: Required. Must contain at least
     one element. Required."""

    @overload
    def __init__(
        self,
        *,
        rule_type: Union[str, "_models.DiscountRuleType"],
        catalog_id: str,
        catalog_claims: list["_models.CatalogClaimsItem"],
        market_set_prices: list["_models.MarketSetPricesItems"],
        term_units: Optional[str] = None,
        billing_period: Optional[str] = None,
        meter_type: Optional[str] = None,
    ) -> None: ...

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

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


class Discount(TrackedResource):
    """Resource definition for Discounts.

    :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.billingbenefits.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: Discount properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.DiscountProperties
    :ivar managed_by: The fully qualified resource ID of the resource that manages this resource.
     Indicates if this resource is managed by another Azure resource. If this is present, complete
     mode deployment will not delete the resource if it is removed from the template since it is
     managed by another resource.
    :vartype managed_by: str
    :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for
     resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported,
     the resource provider must validate and persist this value.
    :vartype kind: str
    :ivar etag: The etag field is *not* required. If it is provided in the response body, it must
     also be provided as a header per the normal etag convention.  Entity tags are used for
     comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in
     the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range
     (section 14.27) header fields.
    :vartype etag: str
    :ivar identity: Managed service identity (system assigned and/or user assigned identities).
    :vartype identity: ~azure.mgmt.billingbenefits.models.ServiceManagedIdentity
    :ivar sku: The resource model definition representing SKU.
    :vartype sku: ~azure.mgmt.billingbenefits.models.Sku
    :ivar plan: Plan for the resource.
    :vartype plan: ~azure.mgmt.billingbenefits.models.Plan
    """

    properties: Optional["_models.DiscountProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Discount properties."""
    managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read", "create", "update"])
    """The fully qualified resource ID of the resource that manages this resource. Indicates if this
     resource is managed by another Azure resource. If this is present, complete mode deployment
     will not delete the resource if it is removed from the template since it is managed by another
     resource."""
    kind: Optional[str] = rest_field(visibility=["read", "create"])
    """Metadata used by portal/tooling/etc to render different UX experiences for resources of the
     same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource
     provider must validate and persist this value."""
    etag: Optional[str] = rest_field(visibility=["read"])
    """The etag field is *not* required. If it is provided in the response body, it must also be
     provided as a header per the normal etag convention.  Entity tags are used for comparing two or
     more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section
     14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27)
     header fields."""
    identity: Optional["_models.ServiceManagedIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed service identity (system assigned and/or user assigned identities)."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource model definition representing SKU."""
    plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Plan for the resource."""

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.DiscountProperties"] = None,
        managed_by: Optional[str] = None,
        kind: Optional[str] = None,
        identity: Optional["_models.ServiceManagedIdentity"] = None,
        sku: Optional["_models.Sku"] = None,
        plan: Optional["_models.Plan"] = None,
    ) -> None: ...

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

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


class DiscountPatchRequest(_Model):
    """Discounts patch request.

    :ivar properties: Discounts patch request properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.DiscountPatchRequestProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

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

    __flattened_items = ["display_name"]

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

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

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

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

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


class DiscountPatchRequestProperties(_Model):
    """Discounts patch request properties.

    :ivar display_name: Display name.
    :vartype display_name: str
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""

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

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

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


class DiscountProperties(_Model):
    """Properties belonging to discounts.

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

    :ivar entity_type: This defines whether the entity being created is primary or affiliate.
     Supported values: primary, affiliate. Validation: Required, must match one of the 2 values.
     Required. Known values are: "Primary" and "Affiliate".
    :vartype entity_type: str or ~azure.mgmt.billingbenefits.models.DiscountEntityType
    :ivar product_code: This is the catalog UPN for the product. Required.
    :vartype product_code: str
    :ivar start_at: Start date of the discount. Value is the date the discount started or will
     start in the future. Required.
    :vartype start_at: ~datetime.datetime
    :ivar system_id: This is the globally unique identifier of the Discount which will not change
     for the lifetime of the Discount.
    :vartype system_id: str
    :ivar provisioning_state: The state of the resource. Supported values are Pending, Failed,
     Succeeded, Canceled. Known values are: "Unknown", "Pending", "Succeeded", "Canceled", and
     "Failed".
    :vartype provisioning_state: str or
     ~azure.mgmt.billingbenefits.models.DiscountProvisioningState
    :ivar billing_account_resource_id: Billing account resource id where the discount metadata is
     present.
    :vartype billing_account_resource_id: str
    :ivar billing_profile_resource_id: Billing profile resource id where the discount is scoped to.
    :vartype billing_profile_resource_id: str
    :ivar customer_resource_id: Customer resource id where the discount is scoped to.
    :vartype customer_resource_id: str
    :ivar display_name: This defines a user friendly display name for the discount.
    :vartype display_name: str
    :ivar status: Represents the current status of the discount. Known values are: "Active",
     "Pending", "Failed", "Canceled", and "Expired".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.DiscountStatus
    :ivar benefit_resource_id: Fully-qualified identifier of the benefit under applicable benefit
     list.
    :vartype benefit_resource_id: str
    :ivar applied_scope_type: List of applied scopes supported for discounts. Known values are:
     "BillingAccount", "BillingProfile", and "Customer".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.DiscountAppliedScopeType
    """

    __mapping__: dict[str, _Model] = {}
    entity_type: str = rest_discriminator(name="entityType", visibility=["read", "create", "update", "delete", "query"])
    """This defines whether the entity being created is primary or affiliate. Supported values:
     primary, affiliate. Validation: Required, must match one of the 2 values. Required. Known
     values are: \"Primary\" and \"Affiliate\"."""
    product_code: str = rest_field(name="productCode", visibility=["read", "create", "update", "delete", "query"])
    """This is the catalog UPN for the product. Required."""
    start_at: datetime.datetime = rest_field(
        name="startAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start date of the discount. Value is the date the discount started or will start in the future.
     Required."""
    system_id: Optional[str] = rest_field(name="systemId", visibility=["read", "create", "update", "delete", "query"])
    """This is the globally unique identifier of the Discount which will not change for the lifetime
     of the Discount."""
    provisioning_state: Optional[Union[str, "_models.DiscountProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """The state of the resource. Supported values are Pending, Failed, Succeeded, Canceled. Known
     values are: \"Unknown\", \"Pending\", \"Succeeded\", \"Canceled\", and \"Failed\"."""
    billing_account_resource_id: Optional[str] = rest_field(name="billingAccountResourceId", visibility=["read"])
    """Billing account resource id where the discount metadata is present."""
    billing_profile_resource_id: Optional[str] = rest_field(name="billingProfileResourceId", visibility=["read"])
    """Billing profile resource id where the discount is scoped to."""
    customer_resource_id: Optional[str] = rest_field(name="customerResourceId", visibility=["read"])
    """Customer resource id where the discount is scoped to."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """This defines a user friendly display name for the discount."""
    status: Optional[Union[str, "_models.DiscountStatus"]] = rest_field(visibility=["read"])
    """Represents the current status of the discount. Known values are: \"Active\", \"Pending\",
     \"Failed\", \"Canceled\", and \"Expired\"."""
    benefit_resource_id: Optional[str] = rest_field(name="benefitResourceId", visibility=["read"])
    """Fully-qualified identifier of the benefit under applicable benefit list."""
    applied_scope_type: Optional[Union[str, "_models.DiscountAppliedScopeType"]] = rest_field(
        name="appliedScopeType", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of applied scopes supported for discounts. Known values are: \"BillingAccount\",
     \"BillingProfile\", and \"Customer\"."""

    @overload
    def __init__(
        self,
        *,
        entity_type: str,
        product_code: str,
        start_at: datetime.datetime,
        system_id: Optional[str] = None,
        display_name: Optional[str] = None,
        applied_scope_type: Optional[Union[str, "_models.DiscountAppliedScopeType"]] = None,
    ) -> None: ...

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

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


class DiscountTypeProperties(_Model):
    """This defines the conditions for a given discount type.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    DiscountTypeCustomPrice, DiscountTypeCustomPriceMultiCurrency, DiscountTypeProduct,
    DiscountTypeProductFamily, DiscountTypeProductSku

    :ivar discount_type: Defines the type of discount. Supported values are ProductFamily, Product,
     Sku, CustomPrice, and CustomPriceMultiCurrency. Required. Known values are: "ProductFamily",
     "Product", "Sku", "CustomPrice", and "CustomPriceMultiCurrency".
    :vartype discount_type: str or ~azure.mgmt.billingbenefits.models.DiscountType
    :ivar apply_discount_on: The customer action on which the discount is applied. Supported values
     are Purchase, Consume, and Renew. Validation: Required, one of supported values. Required.
     Known values are: "Purchase", "Consume", and "Renew".
    :vartype apply_discount_on: str or ~azure.mgmt.billingbenefits.models.ApplyDiscountOn
    :ivar discount_percentage: Discount percentage provided for the customer. Validation: Required
     unless this is a price rule.
    :vartype discount_percentage: float
    :ivar discount_combination_rule: The discount combination rule when there are multiple
     applicable custom prices. Validation: Required. Supported values are Stackable and BestOf.
     Known values are: "BestOf" and "Stackable".
    :vartype discount_combination_rule: str or
     ~azure.mgmt.billingbenefits.models.DiscountCombinationRule
    :ivar price_guarantee_properties: Set only in price guarantee scenario.
    :vartype price_guarantee_properties:
     ~azure.mgmt.billingbenefits.models.PriceGuaranteeProperties
    :ivar conditions: Array of conditions for the discount. Validation: Optional. Maximum length is
     1000.
    :vartype conditions: list[~azure.mgmt.billingbenefits.models.ConditionsItem]
    """

    __mapping__: dict[str, _Model] = {}
    discount_type: str = rest_discriminator(
        name="discountType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Defines the type of discount. Supported values are ProductFamily, Product, Sku, CustomPrice,
     and CustomPriceMultiCurrency. Required. Known values are: \"ProductFamily\", \"Product\",
     \"Sku\", \"CustomPrice\", and \"CustomPriceMultiCurrency\"."""
    apply_discount_on: Union[str, "_models.ApplyDiscountOn"] = rest_field(
        name="applyDiscountOn", visibility=["read", "create", "update", "delete", "query"]
    )
    """The customer action on which the discount is applied. Supported values are Purchase, Consume,
     and Renew. Validation: Required, one of supported values. Required. Known values are:
     \"Purchase\", \"Consume\", and \"Renew\"."""
    discount_percentage: Optional[float] = rest_field(
        name="discountPercentage", visibility=["read", "create", "update", "delete", "query"]
    )
    """Discount percentage provided for the customer. Validation: Required unless this is a price
     rule."""
    discount_combination_rule: Optional[Union[str, "_models.DiscountCombinationRule"]] = rest_field(
        name="discountCombinationRule", visibility=["read", "create", "update", "delete", "query"]
    )
    """The discount combination rule when there are multiple applicable custom prices. Validation:
     Required. Supported values are Stackable and BestOf. Known values are: \"BestOf\" and
     \"Stackable\"."""
    price_guarantee_properties: Optional["_models.PriceGuaranteeProperties"] = rest_field(
        name="priceGuaranteeProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Set only in price guarantee scenario."""
    conditions: Optional[list["_models.ConditionsItem"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Array of conditions for the discount. Validation: Optional. Maximum length is 1000."""

    @overload
    def __init__(
        self,
        *,
        discount_type: str,
        apply_discount_on: Union[str, "_models.ApplyDiscountOn"],
        discount_percentage: Optional[float] = None,
        discount_combination_rule: Optional[Union[str, "_models.DiscountCombinationRule"]] = None,
        price_guarantee_properties: Optional["_models.PriceGuaranteeProperties"] = None,
        conditions: Optional[list["_models.ConditionsItem"]] = None,
    ) -> None: ...

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

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


class DiscountTypeCustomPrice(DiscountTypeProperties, discriminator="CustomPrice"):
    """Discount type properties including product family name, product id, sku, and custom price
    properties. Allows a single entry in marketSetPrices.

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

    :ivar apply_discount_on: The customer action on which the discount is applied. Supported values
     are Purchase, Consume, and Renew. Validation: Required, one of supported values. Required.
     Known values are: "Purchase", "Consume", and "Renew".
    :vartype apply_discount_on: str or ~azure.mgmt.billingbenefits.models.ApplyDiscountOn
    :ivar discount_percentage: Discount percentage provided for the customer. Validation: Required
     unless this is a price rule.
    :vartype discount_percentage: float
    :ivar discount_combination_rule: The discount combination rule when there are multiple
     applicable custom prices. Validation: Required. Supported values are Stackable and BestOf.
     Known values are: "BestOf" and "Stackable".
    :vartype discount_combination_rule: str or
     ~azure.mgmt.billingbenefits.models.DiscountCombinationRule
    :ivar price_guarantee_properties: Set only in price guarantee scenario.
    :vartype price_guarantee_properties:
     ~azure.mgmt.billingbenefits.models.PriceGuaranteeProperties
    :ivar conditions: Array of conditions for the discount. Validation: Optional. Maximum length is
     1000.
    :vartype conditions: list[~azure.mgmt.billingbenefits.models.ConditionsItem]
    :ivar product_family_name: Product family for which the discount is given. Validation:
     Optional.
    :vartype product_family_name: str
    :ivar product_id: Product ID for which the discount is given. Validation: Optional. No specific
     format, example: DZH318Z09V6F.
    :vartype product_id: str
    :ivar sku_id: ResourceSku for the given discount. Validation: Optional.
    :vartype sku_id: str
    :ivar custom_price_properties: Custom price properties for a given discount.
    :vartype custom_price_properties: ~azure.mgmt.billingbenefits.models.CustomPriceProperties
    :ivar discount_type: Defines the type of discount. Supported values are ProductFamily, Product,
     Sku, CustomPrice, and CustomPriceMultiCurrency. Required. CUSTOM_PRICE.
    :vartype discount_type: str or ~azure.mgmt.billingbenefits.models.CUSTOM_PRICE
    """

    __mapping__: dict[str, _Model] = {}
    product_family_name: Optional[str] = rest_field(
        name="productFamilyName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Product family for which the discount is given. Validation: Optional."""
    product_id: Optional[str] = rest_field(name="productId", visibility=["read", "create", "update", "delete", "query"])
    """Product ID for which the discount is given. Validation: Optional. No specific format, example:
     DZH318Z09V6F."""
    sku_id: Optional[str] = rest_field(name="skuId", visibility=["read", "create", "update", "delete", "query"])
    """ResourceSku for the given discount. Validation: Optional."""
    custom_price_properties: Optional["_models.CustomPriceProperties"] = rest_field(
        name="customPriceProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Custom price properties for a given discount."""
    discount_type: Literal[DiscountType.CUSTOM_PRICE] = rest_discriminator(name="discountType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Defines the type of discount. Supported values are ProductFamily, Product, Sku, CustomPrice,
     and CustomPriceMultiCurrency. Required. CUSTOM_PRICE."""

    @overload
    def __init__(
        self,
        *,
        apply_discount_on: Union[str, "_models.ApplyDiscountOn"],
        discount_percentage: Optional[float] = None,
        discount_combination_rule: Optional[Union[str, "_models.DiscountCombinationRule"]] = None,
        price_guarantee_properties: Optional["_models.PriceGuaranteeProperties"] = None,
        conditions: Optional[list["_models.ConditionsItem"]] = None,
        product_family_name: Optional[str] = None,
        product_id: Optional[str] = None,
        sku_id: Optional[str] = None,
        custom_price_properties: Optional["_models.CustomPriceProperties"] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.discount_type = DiscountType.CUSTOM_PRICE  # type: ignore


class DiscountTypeCustomPriceMultiCurrency(DiscountTypeCustomPrice, discriminator="CustomPriceMultiCurrency"):
    """Discount type properties including product family name, product id, sku, and custom price
    properties. Allows multiple entries in marketSetPrices.

    :ivar apply_discount_on: The customer action on which the discount is applied. Supported values
     are Purchase, Consume, and Renew. Validation: Required, one of supported values. Required.
     Known values are: "Purchase", "Consume", and "Renew".
    :vartype apply_discount_on: str or ~azure.mgmt.billingbenefits.models.ApplyDiscountOn
    :ivar discount_percentage: Discount percentage provided for the customer. Validation: Required
     unless this is a price rule.
    :vartype discount_percentage: float
    :ivar discount_combination_rule: The discount combination rule when there are multiple
     applicable custom prices. Validation: Required. Supported values are Stackable and BestOf.
     Known values are: "BestOf" and "Stackable".
    :vartype discount_combination_rule: str or
     ~azure.mgmt.billingbenefits.models.DiscountCombinationRule
    :ivar price_guarantee_properties: Set only in price guarantee scenario.
    :vartype price_guarantee_properties:
     ~azure.mgmt.billingbenefits.models.PriceGuaranteeProperties
    :ivar conditions: Array of conditions for the discount. Validation: Optional. Maximum length is
     1000.
    :vartype conditions: list[~azure.mgmt.billingbenefits.models.ConditionsItem]
    :ivar product_family_name: Product family for which the discount is given. Validation:
     Optional.
    :vartype product_family_name: str
    :ivar product_id: Product ID for which the discount is given. Validation: Optional. No specific
     format, example: DZH318Z09V6F.
    :vartype product_id: str
    :ivar sku_id: ResourceSku for the given discount. Validation: Optional.
    :vartype sku_id: str
    :ivar custom_price_properties: Custom price properties for a given discount.
    :vartype custom_price_properties: ~azure.mgmt.billingbenefits.models.CustomPriceProperties
    :ivar discount_type: Defines the type of discount. Supported values are ProductFamily, Product,
     Sku, CustomPrice, and CustomPriceMultiCurrency. Required. CUSTOM_PRICE_MULTI_CURRENCY.
    :vartype discount_type: str or ~azure.mgmt.billingbenefits.models.CUSTOM_PRICE_MULTI_CURRENCY
    """

    discount_type: Literal[DiscountType.CUSTOM_PRICE_MULTI_CURRENCY] = rest_discriminator(name="discountType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Defines the type of discount. Supported values are ProductFamily, Product, Sku, CustomPrice,
     and CustomPriceMultiCurrency. Required. CUSTOM_PRICE_MULTI_CURRENCY."""

    @overload
    def __init__(
        self,
        *,
        apply_discount_on: Union[str, "_models.ApplyDiscountOn"],
        discount_percentage: Optional[float] = None,
        discount_combination_rule: Optional[Union[str, "_models.DiscountCombinationRule"]] = None,
        price_guarantee_properties: Optional["_models.PriceGuaranteeProperties"] = None,
        conditions: Optional[list["_models.ConditionsItem"]] = None,
        product_family_name: Optional[str] = None,
        product_id: Optional[str] = None,
        sku_id: Optional[str] = None,
        custom_price_properties: Optional["_models.CustomPriceProperties"] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.discount_type = DiscountType.CUSTOM_PRICE_MULTI_CURRENCY  # type: ignore


class DiscountTypeProduct(DiscountTypeProperties, discriminator="Product"):
    """Discount type properties including product family name and product id.

    :ivar apply_discount_on: The customer action on which the discount is applied. Supported values
     are Purchase, Consume, and Renew. Validation: Required, one of supported values. Required.
     Known values are: "Purchase", "Consume", and "Renew".
    :vartype apply_discount_on: str or ~azure.mgmt.billingbenefits.models.ApplyDiscountOn
    :ivar discount_percentage: Discount percentage provided for the customer. Validation: Required
     unless this is a price rule.
    :vartype discount_percentage: float
    :ivar discount_combination_rule: The discount combination rule when there are multiple
     applicable custom prices. Validation: Required. Supported values are Stackable and BestOf.
     Known values are: "BestOf" and "Stackable".
    :vartype discount_combination_rule: str or
     ~azure.mgmt.billingbenefits.models.DiscountCombinationRule
    :ivar price_guarantee_properties: Set only in price guarantee scenario.
    :vartype price_guarantee_properties:
     ~azure.mgmt.billingbenefits.models.PriceGuaranteeProperties
    :ivar conditions: Array of conditions for the discount. Validation: Optional. Maximum length is
     1000.
    :vartype conditions: list[~azure.mgmt.billingbenefits.models.ConditionsItem]
    :ivar product_family_name: Product family for which the discount is given. Validation:
     Optional.
    :vartype product_family_name: str
    :ivar product_id: Product ID for which the discount is given. Validation: Optional. No specific
     format, example: DZH318Z09V6F.
    :vartype product_id: str
    :ivar discount_type: Defines the type of discount. Supported values are ProductFamily, Product,
     Sku, CustomPrice, and CustomPriceMultiCurrency. Required. PRODUCT.
    :vartype discount_type: str or ~azure.mgmt.billingbenefits.models.PRODUCT
    """

    product_family_name: Optional[str] = rest_field(
        name="productFamilyName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Product family for which the discount is given. Validation: Optional."""
    product_id: Optional[str] = rest_field(name="productId", visibility=["read", "create", "update", "delete", "query"])
    """Product ID for which the discount is given. Validation: Optional. No specific format, example:
     DZH318Z09V6F."""
    discount_type: Literal[DiscountType.PRODUCT] = rest_discriminator(name="discountType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Defines the type of discount. Supported values are ProductFamily, Product, Sku, CustomPrice,
     and CustomPriceMultiCurrency. Required. PRODUCT."""

    @overload
    def __init__(
        self,
        *,
        apply_discount_on: Union[str, "_models.ApplyDiscountOn"],
        discount_percentage: Optional[float] = None,
        discount_combination_rule: Optional[Union[str, "_models.DiscountCombinationRule"]] = None,
        price_guarantee_properties: Optional["_models.PriceGuaranteeProperties"] = None,
        conditions: Optional[list["_models.ConditionsItem"]] = None,
        product_family_name: Optional[str] = None,
        product_id: Optional[str] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.discount_type = DiscountType.PRODUCT  # type: ignore


class DiscountTypeProductFamily(DiscountTypeProperties, discriminator="ProductFamily"):
    """Discount type properties including product family name.

    :ivar apply_discount_on: The customer action on which the discount is applied. Supported values
     are Purchase, Consume, and Renew. Validation: Required, one of supported values. Required.
     Known values are: "Purchase", "Consume", and "Renew".
    :vartype apply_discount_on: str or ~azure.mgmt.billingbenefits.models.ApplyDiscountOn
    :ivar discount_percentage: Discount percentage provided for the customer. Validation: Required
     unless this is a price rule.
    :vartype discount_percentage: float
    :ivar discount_combination_rule: The discount combination rule when there are multiple
     applicable custom prices. Validation: Required. Supported values are Stackable and BestOf.
     Known values are: "BestOf" and "Stackable".
    :vartype discount_combination_rule: str or
     ~azure.mgmt.billingbenefits.models.DiscountCombinationRule
    :ivar price_guarantee_properties: Set only in price guarantee scenario.
    :vartype price_guarantee_properties:
     ~azure.mgmt.billingbenefits.models.PriceGuaranteeProperties
    :ivar conditions: Array of conditions for the discount. Validation: Optional. Maximum length is
     1000.
    :vartype conditions: list[~azure.mgmt.billingbenefits.models.ConditionsItem]
    :ivar product_family_name: Product family for which the discount is given. Validation:
     Optional.
    :vartype product_family_name: str
    :ivar discount_type: Defines the type of discount. Supported values are ProductFamily, Product,
     Sku, CustomPrice, and CustomPriceMultiCurrency. Required. PRODUCT_FAMILY.
    :vartype discount_type: str or ~azure.mgmt.billingbenefits.models.PRODUCT_FAMILY
    """

    product_family_name: Optional[str] = rest_field(
        name="productFamilyName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Product family for which the discount is given. Validation: Optional."""
    discount_type: Literal[DiscountType.PRODUCT_FAMILY] = rest_discriminator(name="discountType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Defines the type of discount. Supported values are ProductFamily, Product, Sku, CustomPrice,
     and CustomPriceMultiCurrency. Required. PRODUCT_FAMILY."""

    @overload
    def __init__(
        self,
        *,
        apply_discount_on: Union[str, "_models.ApplyDiscountOn"],
        discount_percentage: Optional[float] = None,
        discount_combination_rule: Optional[Union[str, "_models.DiscountCombinationRule"]] = None,
        price_guarantee_properties: Optional["_models.PriceGuaranteeProperties"] = None,
        conditions: Optional[list["_models.ConditionsItem"]] = None,
        product_family_name: Optional[str] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.discount_type = DiscountType.PRODUCT_FAMILY  # type: ignore


class DiscountTypeProductSku(DiscountTypeProperties, discriminator="Sku"):
    """Discount type properties including product family name, product id, and sku id.

    :ivar apply_discount_on: The customer action on which the discount is applied. Supported values
     are Purchase, Consume, and Renew. Validation: Required, one of supported values. Required.
     Known values are: "Purchase", "Consume", and "Renew".
    :vartype apply_discount_on: str or ~azure.mgmt.billingbenefits.models.ApplyDiscountOn
    :ivar discount_percentage: Discount percentage provided for the customer. Validation: Required
     unless this is a price rule.
    :vartype discount_percentage: float
    :ivar discount_combination_rule: The discount combination rule when there are multiple
     applicable custom prices. Validation: Required. Supported values are Stackable and BestOf.
     Known values are: "BestOf" and "Stackable".
    :vartype discount_combination_rule: str or
     ~azure.mgmt.billingbenefits.models.DiscountCombinationRule
    :ivar price_guarantee_properties: Set only in price guarantee scenario.
    :vartype price_guarantee_properties:
     ~azure.mgmt.billingbenefits.models.PriceGuaranteeProperties
    :ivar conditions: Array of conditions for the discount. Validation: Optional. Maximum length is
     1000.
    :vartype conditions: list[~azure.mgmt.billingbenefits.models.ConditionsItem]
    :ivar product_family_name: Product family for which the discount is given. Validation:
     Optional.
    :vartype product_family_name: str
    :ivar product_id: Product ID for which the discount is given. Validation: Optional. No specific
     format, example: DZH318Z09V6F.
    :vartype product_id: str
    :ivar sku_id: ResourceSku for the given discount. Validation: Optional.
    :vartype sku_id: str
    :ivar discount_type: Defines the type of discount. Supported values are ProductFamily, Product,
     Sku, CustomPrice, and CustomPriceMultiCurrency. Required. SKU.
    :vartype discount_type: str or ~azure.mgmt.billingbenefits.models.SKU
    """

    product_family_name: Optional[str] = rest_field(
        name="productFamilyName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Product family for which the discount is given. Validation: Optional."""
    product_id: Optional[str] = rest_field(name="productId", visibility=["read", "create", "update", "delete", "query"])
    """Product ID for which the discount is given. Validation: Optional. No specific format, example:
     DZH318Z09V6F."""
    sku_id: Optional[str] = rest_field(name="skuId", visibility=["read", "create", "update", "delete", "query"])
    """ResourceSku for the given discount. Validation: Optional."""
    discount_type: Literal[DiscountType.SKU] = rest_discriminator(name="discountType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Defines the type of discount. Supported values are ProductFamily, Product, Sku, CustomPrice,
     and CustomPriceMultiCurrency. Required. SKU."""

    @overload
    def __init__(
        self,
        *,
        apply_discount_on: Union[str, "_models.ApplyDiscountOn"],
        discount_percentage: Optional[float] = None,
        discount_combination_rule: Optional[Union[str, "_models.DiscountCombinationRule"]] = None,
        price_guarantee_properties: Optional["_models.PriceGuaranteeProperties"] = None,
        conditions: Optional[list["_models.ConditionsItem"]] = None,
        product_family_name: Optional[str] = None,
        product_id: Optional[str] = None,
        sku_id: Optional[str] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.discount_type = DiscountType.SKU  # type: ignore


class EntityTypeAffiliateDiscount(DiscountProperties, discriminator="Affiliate"):
    """Entity type for affiliate discounts.

    :ivar product_code: This is the catalog UPN for the product. Required.
    :vartype product_code: str
    :ivar start_at: Start date of the discount. Value is the date the discount started or will
     start in the future. Required.
    :vartype start_at: ~datetime.datetime
    :ivar system_id: This is the globally unique identifier of the Discount which will not change
     for the lifetime of the Discount.
    :vartype system_id: str
    :ivar provisioning_state: The state of the resource. Supported values are Pending, Failed,
     Succeeded, Canceled. Known values are: "Unknown", "Pending", "Succeeded", "Canceled", and
     "Failed".
    :vartype provisioning_state: str or
     ~azure.mgmt.billingbenefits.models.DiscountProvisioningState
    :ivar billing_account_resource_id: Billing account resource id where the discount metadata is
     present.
    :vartype billing_account_resource_id: str
    :ivar billing_profile_resource_id: Billing profile resource id where the discount is scoped to.
    :vartype billing_profile_resource_id: str
    :ivar customer_resource_id: Customer resource id where the discount is scoped to.
    :vartype customer_resource_id: str
    :ivar display_name: This defines a user friendly display name for the discount.
    :vartype display_name: str
    :ivar status: Represents the current status of the discount. Known values are: "Active",
     "Pending", "Failed", "Canceled", and "Expired".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.DiscountStatus
    :ivar benefit_resource_id: Fully-qualified identifier of the benefit under applicable benefit
     list.
    :vartype benefit_resource_id: str
    :ivar applied_scope_type: List of applied scopes supported for discounts. Known values are:
     "BillingAccount", "BillingProfile", and "Customer".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.DiscountAppliedScopeType
    :ivar primary_resource_id: This will be present in the response if the primary has a resource
     ID.
    :vartype primary_resource_id: str
    :ivar end_at: End date of the discount. No duration will be supported. Allowed value is any
     date greater than or equal to startDate.
    :vartype end_at: ~datetime.datetime
    :ivar entity_type: This defines whether the entity being created is primary or affiliate.
     Supported values: primary, affiliate. Validation: Required, must match one of the 2 values.
     Required. AFFILIATE.
    :vartype entity_type: str or ~azure.mgmt.billingbenefits.models.AFFILIATE
    """

    primary_resource_id: Optional[str] = rest_field(name="primaryResourceId", visibility=["read"])
    """This will be present in the response if the primary has a resource ID."""
    end_at: Optional[datetime.datetime] = rest_field(name="endAt", visibility=["read"], format="rfc3339")
    """End date of the discount. No duration will be supported. Allowed value is any date greater than
     or equal to startDate."""
    entity_type: Literal[DiscountEntityType.AFFILIATE] = rest_discriminator(name="entityType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """This defines whether the entity being created is primary or affiliate. Supported values:
     primary, affiliate. Validation: Required, must match one of the 2 values. Required. AFFILIATE."""

    @overload
    def __init__(
        self,
        *,
        product_code: str,
        start_at: datetime.datetime,
        system_id: Optional[str] = None,
        display_name: Optional[str] = None,
        applied_scope_type: Optional[Union[str, "_models.DiscountAppliedScopeType"]] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.entity_type = DiscountEntityType.AFFILIATE  # type: ignore


class EntityTypePrimaryDiscount(DiscountProperties, discriminator="Primary"):
    """Entity type for primary discounts.

    :ivar product_code: This is the catalog UPN for the product. Required.
    :vartype product_code: str
    :ivar start_at: Start date of the discount. Value is the date the discount started or will
     start in the future. Required.
    :vartype start_at: ~datetime.datetime
    :ivar system_id: This is the globally unique identifier of the Discount which will not change
     for the lifetime of the Discount.
    :vartype system_id: str
    :ivar provisioning_state: The state of the resource. Supported values are Pending, Failed,
     Succeeded, Canceled. Known values are: "Unknown", "Pending", "Succeeded", "Canceled", and
     "Failed".
    :vartype provisioning_state: str or
     ~azure.mgmt.billingbenefits.models.DiscountProvisioningState
    :ivar billing_account_resource_id: Billing account resource id where the discount metadata is
     present.
    :vartype billing_account_resource_id: str
    :ivar billing_profile_resource_id: Billing profile resource id where the discount is scoped to.
    :vartype billing_profile_resource_id: str
    :ivar customer_resource_id: Customer resource id where the discount is scoped to.
    :vartype customer_resource_id: str
    :ivar display_name: This defines a user friendly display name for the discount.
    :vartype display_name: str
    :ivar status: Represents the current status of the discount. Known values are: "Active",
     "Pending", "Failed", "Canceled", and "Expired".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.DiscountStatus
    :ivar benefit_resource_id: Fully-qualified identifier of the benefit under applicable benefit
     list.
    :vartype benefit_resource_id: str
    :ivar applied_scope_type: List of applied scopes supported for discounts. Known values are:
     "BillingAccount", "BillingProfile", and "Customer".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.DiscountAppliedScopeType
    :ivar discount_type_properties: This defines the conditions for a given discount type.
    :vartype discount_type_properties: ~azure.mgmt.billingbenefits.models.DiscountTypeProperties
    :ivar end_at: End date of the discount. No duration will be supported. Allowed value is any
     date greater than or equal to startDate. Required.
    :vartype end_at: ~datetime.datetime
    :ivar entity_type: This defines whether the entity being created is primary or affiliate.
     Supported values: primary, affiliate. Validation: Required, must match one of the 2 values.
     Required. PRIMARY.
    :vartype entity_type: str or ~azure.mgmt.billingbenefits.models.PRIMARY
    """

    discount_type_properties: Optional["_models.DiscountTypeProperties"] = rest_field(
        name="discountTypeProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """This defines the conditions for a given discount type."""
    end_at: datetime.datetime = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End date of the discount. No duration will be supported. Allowed value is any date greater than
     or equal to startDate. Required."""
    entity_type: Literal[DiscountEntityType.PRIMARY] = rest_discriminator(name="entityType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """This defines whether the entity being created is primary or affiliate. Supported values:
     primary, affiliate. Validation: Required, must match one of the 2 values. Required. PRIMARY."""

    @overload
    def __init__(
        self,
        *,
        product_code: str,
        start_at: datetime.datetime,
        end_at: datetime.datetime,
        system_id: Optional[str] = None,
        display_name: Optional[str] = None,
        applied_scope_type: Optional[Union[str, "_models.DiscountAppliedScopeType"]] = None,
        discount_type_properties: Optional["_models.DiscountTypeProperties"] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.entity_type = DiscountEntityType.PRIMARY  # type: ignore


class ErrorAdditionalInfo(_Model):
    """The resource management error additional info.

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

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


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

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

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


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

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

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

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

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

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


class ExtendedStatusInfo(_Model):
    """ExtendedStatusInfo.

    :ivar status_code: Status code providing additional information.
    :vartype status_code: str
    :ivar message: The message giving detailed information about the status code.
    :vartype message: str
    """

    status_code: Optional[str] = rest_field(
        name="statusCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Status code providing additional information."""
    message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The message giving detailed information about the status code."""

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

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

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


class FreeServices(TrackedResource):
    """Free Services 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.billingbenefits.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: Free services properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.FreeServicesProperties
    :ivar managed_by: The fully qualified resource ID of the resource that manages this resource.
     Indicates if this resource is managed by another Azure resource. If this is present, complete
     mode deployment will not delete the resource if it is removed from the template since it is
     managed by another resource.
    :vartype managed_by: str
    :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for
     resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported,
     the resource provider must validate and persist this value.
    :vartype kind: str
    :ivar etag: The etag field is *not* required. If it is provided in the response body, it must
     also be provided as a header per the normal etag convention.  Entity tags are used for
     comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in
     the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range
     (section 14.27) header fields.
    :vartype etag: str
    :ivar identity: Managed service identity (system assigned and/or user assigned identities).
    :vartype identity: ~azure.mgmt.billingbenefits.models.ManagedServiceIdentity
    :ivar sku: The resource model definition representing SKU.
    :vartype sku: ~azure.mgmt.billingbenefits.models.Sku
    :ivar plan: Plan for the resource.
    :vartype plan: ~azure.mgmt.billingbenefits.models.Plan
    """

    properties: Optional["_models.FreeServicesProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Free services properties."""
    managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read", "create", "update"])
    """The fully qualified resource ID of the resource that manages this resource. Indicates if this
     resource is managed by another Azure resource. If this is present, complete mode deployment
     will not delete the resource if it is removed from the template since it is managed by another
     resource."""
    kind: Optional[str] = rest_field(visibility=["read", "create"])
    """Metadata used by portal/tooling/etc to render different UX experiences for resources of the
     same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource
     provider must validate and persist this value."""
    etag: Optional[str] = rest_field(visibility=["read"])
    """The etag field is *not* required. If it is provided in the response body, it must also be
     provided as a header per the normal etag convention.  Entity tags are used for comparing two or
     more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section
     14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27)
     header fields."""
    identity: Optional["_models.ManagedServiceIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed service identity (system assigned and/or user assigned identities)."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource model definition representing SKU."""
    plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Plan for the resource."""

    __flattened_items = [
        "product_code",
        "status",
        "start_at",
        "end_at",
        "provisioning_state",
        "billing_account_resource_id",
        "billing_profile_resource_id",
        "customer_resource_id",
        "system_id",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.FreeServicesProperties"] = None,
        managed_by: Optional[str] = None,
        kind: Optional[str] = None,
        identity: Optional["_models.ManagedServiceIdentity"] = None,
        sku: Optional["_models.Sku"] = None,
        plan: Optional["_models.Plan"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 FreeServicesPatchRequest(_Model):
    """Free services patch request.

    :ivar properties: Free services patch request properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.FreeServicesPatchRequestProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    properties: Optional["_models.FreeServicesPatchRequestProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Free services patch request properties."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""

    __flattened_items = ["end_at"]

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

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

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

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

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


class FreeServicesPatchRequestProperties(_Model):
    """Free services patch request properties.

    :ivar end_at: Updated expiration date and time of the free services.
    :vartype end_at: ~datetime.datetime
    """

    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Updated expiration date and time of the free services."""

    @overload
    def __init__(
        self,
        *,
        end_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 FreeServicesProperties(_Model):
    """Properties of free services.

    :ivar product_code: This is the catalog UPN for the product.
    :vartype product_code: str
    :ivar status: Current status of the free services. Known values are: "Unknown", "Pending",
     "Active", "Canceled", and "Completed".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.FreeServicesStatus
    :ivar start_at: Date and time when the free services become active.
    :vartype start_at: ~datetime.datetime
    :ivar end_at: Expiration date and time of the free services.
    :vartype end_at: ~datetime.datetime
    :ivar provisioning_state: Provisioning state of Free Services as assigned by RPaaS. This
     indicates the last operation's status. For all practical purposes, this can be ignored. For
     current status of Free Services resource, refer to FreeServicesStatus.
    :vartype provisioning_state: str
    :ivar billing_account_resource_id: Billing account resource id where the free services metadata
     is present.
    :vartype billing_account_resource_id: str
    :ivar billing_profile_resource_id: Billing profile resource id where the free services are
     scoped to.
    :vartype billing_profile_resource_id: str
    :ivar customer_resource_id: Customer resource id where the free services are scoped to.
    :vartype customer_resource_id: str
    :ivar system_id: This is the globally unique identifier of the free services which will not
     change for its lifetime.
    :vartype system_id: str
    """

    product_code: Optional[str] = rest_field(
        name="productCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """This is the catalog UPN for the product."""
    status: Optional[Union[str, "_models.FreeServicesStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Current status of the free services. Known values are: \"Unknown\", \"Pending\", \"Active\",
     \"Canceled\", and \"Completed\"."""
    start_at: Optional[datetime.datetime] = rest_field(
        name="startAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Date and time when the free services become active."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Expiration date and time of the free services."""
    provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"])
    """Provisioning state of Free Services as assigned by RPaaS. This indicates the last operation's
     status. For all practical purposes, this can be ignored. For current status of Free Services
     resource, refer to FreeServicesStatus."""
    billing_account_resource_id: Optional[str] = rest_field(name="billingAccountResourceId", visibility=["read"])
    """Billing account resource id where the free services metadata is present."""
    billing_profile_resource_id: Optional[str] = rest_field(name="billingProfileResourceId", visibility=["read"])
    """Billing profile resource id where the free services are scoped to."""
    customer_resource_id: Optional[str] = rest_field(name="customerResourceId", visibility=["read"])
    """Customer resource id where the free services are scoped to."""
    system_id: Optional[str] = rest_field(name="systemId", visibility=["read", "create", "update", "delete", "query"])
    """This is the globally unique identifier of the free services which will not change for its
     lifetime."""

    @overload
    def __init__(
        self,
        *,
        product_code: Optional[str] = None,
        status: Optional[Union[str, "_models.FreeServicesStatus"]] = None,
        start_at: Optional[datetime.datetime] = None,
        end_at: Optional[datetime.datetime] = None,
        system_id: Optional[str] = None,
    ) -> None: ...

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

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


class Macc(TrackedResource):
    """Microsoft Azure Consumption Commitment.

    :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.billingbenefits.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: MACC properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.MaccModelProperties
    :ivar managed_by: The fully qualified resource ID of the resource that manages this resource.
     Indicates if this resource is managed by another Azure resource. If this is present, complete
     mode deployment will not delete the resource if it is removed from the template since it is
     managed by another resource.
    :vartype managed_by: str
    :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for
     resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported,
     the resource provider must validate and persist this value.
    :vartype kind: str
    :ivar etag: The etag field is *not* required. If it is provided in the response body, it must
     also be provided as a header per the normal etag convention.  Entity tags are used for
     comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in
     the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range
     (section 14.27) header fields.
    :vartype etag: str
    :ivar identity: Managed service identity (system assigned and/or user assigned identities).
    :vartype identity: ~azure.mgmt.billingbenefits.models.ManagedServiceIdentity
    :ivar sku: The resource model definition representing SKU.
    :vartype sku: ~azure.mgmt.billingbenefits.models.Sku
    :ivar plan: Plan for the resource.
    :vartype plan: ~azure.mgmt.billingbenefits.models.Plan
    """

    properties: Optional["_models.MaccModelProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """MACC properties."""
    managed_by: Optional[str] = rest_field(name="managedBy", visibility=["read", "create", "update"])
    """The fully qualified resource ID of the resource that manages this resource. Indicates if this
     resource is managed by another Azure resource. If this is present, complete mode deployment
     will not delete the resource if it is removed from the template since it is managed by another
     resource."""
    kind: Optional[str] = rest_field(visibility=["read", "create"])
    """Metadata used by portal/tooling/etc to render different UX experiences for resources of the
     same type. E.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource
     provider must validate and persist this value."""
    etag: Optional[str] = rest_field(visibility=["read"])
    """The etag field is *not* required. If it is provided in the response body, it must also be
     provided as a header per the normal etag convention.  Entity tags are used for comparing two or
     more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section
     14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27)
     header fields."""
    identity: Optional["_models.ManagedServiceIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Managed service identity (system assigned and/or user assigned identities)."""
    sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource model definition representing SKU."""
    plan: Optional["_models.Plan"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Plan for the resource."""

    __flattened_items = [
        "provisioning_state",
        "status",
        "entity_type",
        "display_name",
        "product_code",
        "billing_account_resource_id",
        "commitment",
        "start_at",
        "end_at",
        "system_id",
        "automatic_shortfall",
        "automatic_shortfall_suppress_reason",
        "shortfall",
        "milestones",
        "resource_id",
        "allow_contributors",
        "primary_resource_id",
        "primary_billing_account_resource_id",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.MaccModelProperties"] = None,
        managed_by: Optional[str] = None,
        kind: Optional[str] = None,
        identity: Optional["_models.ManagedServiceIdentity"] = None,
        sku: Optional["_models.Sku"] = None,
        plan: Optional["_models.Plan"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[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 MaccMilestone(_Model):
    """MACC milestone represents interim targets within the period of MACC.

    :ivar milestone_id: Globally unique identifier for the milestone. Format: {guid}.
    :vartype milestone_id: str
    :ivar commitment: Commitment associated with this milestone.
    :vartype commitment: ~azure.mgmt.billingbenefits.models.Price
    :ivar end_at: End date time for the milestone. Timestamp must be in the ISO date format
     YYYY-MM-DDT23:59:59Z.
    :vartype end_at: ~datetime.datetime
    :ivar automatic_shortfall: Setting this to 'Enable' enables automatic shortfall invoicing when
     milestone commitment is not met. Known values are: "Unknown", "Enabled", and "Disabled".
    :vartype automatic_shortfall: str or ~azure.mgmt.billingbenefits.models.EnablementMode
    :ivar automatic_shortfall_suppress_reason: Optional field to record suppression reason for
     automatic shortfall.
    :vartype automatic_shortfall_suppress_reason:
     ~azure.mgmt.billingbenefits.models.AutomaticShortfallSuppressReason
    :ivar status: Represents the current status of the Milestone. Known values are: "Unknown",
     "Scheduled", "Active", "Pending", "Failed", "Completed", "Canceled", "Removed",
     "PendingSettlement", "ShortfallCharged", and "ShortfallWaived".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.MaccMilestoneStatus
    :ivar shortfall: Details of the shortfall associated with this milestone.
    :vartype shortfall: ~azure.mgmt.billingbenefits.models.Shortfall
    """

    milestone_id: Optional[str] = rest_field(name="milestoneId", visibility=["read", "create"])
    """Globally unique identifier for the milestone. Format: {guid}."""
    commitment: Optional["_models.Price"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Commitment associated with this milestone."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End date time for the milestone. Timestamp must be in the ISO date format YYYY-MM-DDT23:59:59Z."""
    automatic_shortfall: Optional[Union[str, "_models.EnablementMode"]] = rest_field(
        name="automaticShortfall", visibility=["read", "create", "update", "delete", "query"]
    )
    """Setting this to 'Enable' enables automatic shortfall invoicing when milestone commitment is not
     met. Known values are: \"Unknown\", \"Enabled\", and \"Disabled\"."""
    automatic_shortfall_suppress_reason: Optional["_models.AutomaticShortfallSuppressReason"] = rest_field(
        name="automaticShortfallSuppressReason", visibility=["read", "create", "update", "delete", "query"]
    )
    """Optional field to record suppression reason for automatic shortfall."""
    status: Optional[Union[str, "_models.MaccMilestoneStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the current status of the Milestone. Known values are: \"Unknown\", \"Scheduled\",
     \"Active\", \"Pending\", \"Failed\", \"Completed\", \"Canceled\", \"Removed\",
     \"PendingSettlement\", \"ShortfallCharged\", and \"ShortfallWaived\"."""
    shortfall: Optional["_models.Shortfall"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Details of the shortfall associated with this milestone."""

    @overload
    def __init__(
        self,
        *,
        milestone_id: Optional[str] = None,
        commitment: Optional["_models.Price"] = None,
        end_at: Optional[datetime.datetime] = None,
        automatic_shortfall: Optional[Union[str, "_models.EnablementMode"]] = None,
        automatic_shortfall_suppress_reason: Optional["_models.AutomaticShortfallSuppressReason"] = None,
        status: Optional[Union[str, "_models.MaccMilestoneStatus"]] = None,
        shortfall: Optional["_models.Shortfall"] = None,
    ) -> None: ...

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

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


class MaccModelProperties(_Model):
    """MACC properties.

    :ivar provisioning_state: Provisioning state of MACC as assigned by RPaaS. This indicates the
     last operation's status. For all practical purposes, this can be ignored. For current status of
     MACC resource, refer to MaccStatus.
    :vartype provisioning_state: str
    :ivar status: Represents the current status of the MACC. Known values are: "Unknown",
     "Scheduled", "Active", "Pending", "Failed", "Canceled", "Completed", "Stopped",
     "PendingSettlement", "ShortfallCharged", and "ShortfallWaived".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.MaccStatus
    :ivar entity_type: Represents type of the object being operated on. Possible values are primary
     or contributor. Required. Known values are: "Primary" and "Contributor".
    :vartype entity_type: str or ~azure.mgmt.billingbenefits.models.MaccEntityType
    :ivar display_name: Display name.
    :vartype display_name: str
    :ivar product_code: Represents catalog UPN.
    :vartype product_code: str
    :ivar billing_account_resource_id: Fully-qualified identifier of the billing account where the
     MACC is applied. Present only for Enterprise Agreement customers. Format must be Azure Resource
     ID: /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}.
    :vartype billing_account_resource_id: str
    :ivar commitment: Commitment towards the benefit.
    :vartype commitment: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar start_at: Must be start of month. Timestamp must be in the ISO date format
     YYYY-MM-DDT00:00:00Z.
    :vartype start_at: ~datetime.datetime
    :ivar end_at: Must be end of month. Timestamp must be in the ISO date format
     YYYY-MM-DDT23:59:59Z.
    :vartype end_at: ~datetime.datetime
    :ivar system_id: This is the globally unique identifier of the MACC which will not change for
     the lifetime of the MACC.
    :vartype system_id: str
    :ivar automatic_shortfall: Setting this to 'Enable' enables automatic shortfall charging when
     commitment is not met. Known values are: "Unknown", "Enabled", and "Disabled".
    :vartype automatic_shortfall: str or ~azure.mgmt.billingbenefits.models.EnablementMode
    :ivar automatic_shortfall_suppress_reason: Optional field to record suppression reason for
     automatic shortfall.
    :vartype automatic_shortfall_suppress_reason:
     ~azure.mgmt.billingbenefits.models.AutomaticShortfallSuppressReason
    :ivar shortfall: MACC shortfall.
    :vartype shortfall: ~azure.mgmt.billingbenefits.models.Shortfall
    :ivar milestones: List of milestones associated with this MACC.
    :vartype milestones: list[~azure.mgmt.billingbenefits.models.MaccMilestone]
    :ivar resource_id: This is the resource identifier of either the primary MACC or the
     contributor. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/maccs/{maccName}.
    :vartype resource_id: str
    :ivar allow_contributors: Setting this to true means multi-entity.
    :vartype allow_contributors: bool
    :ivar primary_resource_id: Fully-qualified resource identifier of the primary MACC. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/maccs/{maccName}.
    :vartype primary_resource_id: str
    :ivar primary_billing_account_resource_id: Fully-qualified billing account resource identifier
     of the primary MACC. Format must be Azure Resource ID:
     /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}.
    :vartype primary_billing_account_resource_id: str
    """

    provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"])
    """Provisioning state of MACC as assigned by RPaaS. This indicates the last operation's status.
     For all practical purposes, this can be ignored. For current status of MACC resource, refer to
     MaccStatus."""
    status: Optional[Union[str, "_models.MaccStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the current status of the MACC. Known values are: \"Unknown\", \"Scheduled\",
     \"Active\", \"Pending\", \"Failed\", \"Canceled\", \"Completed\", \"Stopped\",
     \"PendingSettlement\", \"ShortfallCharged\", and \"ShortfallWaived\"."""
    entity_type: Union[str, "_models.MaccEntityType"] = rest_field(name="entityType", visibility=["read", "create"])
    """Represents type of the object being operated on. Possible values are primary or contributor.
     Required. Known values are: \"Primary\" and \"Contributor\"."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""
    product_code: Optional[str] = rest_field(name="productCode", visibility=["read", "create"])
    """Represents catalog UPN."""
    billing_account_resource_id: Optional[str] = rest_field(
        name="billingAccountResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified identifier of the billing account where the MACC is applied. Present only for
     Enterprise Agreement customers. Format must be Azure Resource ID:
     /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}."""
    commitment: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Commitment towards the benefit."""
    start_at: Optional[datetime.datetime] = rest_field(
        name="startAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Must be start of month. Timestamp must be in the ISO date format YYYY-MM-DDT00:00:00Z."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Must be end of month. Timestamp must be in the ISO date format YYYY-MM-DDT23:59:59Z."""
    system_id: Optional[str] = rest_field(name="systemId", visibility=["read", "create"])
    """This is the globally unique identifier of the MACC which will not change for the lifetime of
     the MACC."""
    automatic_shortfall: Optional[Union[str, "_models.EnablementMode"]] = rest_field(
        name="automaticShortfall", visibility=["read", "create", "update", "delete", "query"]
    )
    """Setting this to 'Enable' enables automatic shortfall charging when commitment is not met. Known
     values are: \"Unknown\", \"Enabled\", and \"Disabled\"."""
    automatic_shortfall_suppress_reason: Optional["_models.AutomaticShortfallSuppressReason"] = rest_field(
        name="automaticShortfallSuppressReason", visibility=["read", "create", "update", "delete", "query"]
    )
    """Optional field to record suppression reason for automatic shortfall."""
    shortfall: Optional["_models.Shortfall"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """MACC shortfall."""
    milestones: Optional[list["_models.MaccMilestone"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of milestones associated with this MACC."""
    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """This is the resource identifier of either the primary MACC or the contributor. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/maccs/{maccName}."""
    allow_contributors: Optional[bool] = rest_field(
        name="allowContributors", visibility=["read", "create", "update", "delete", "query"]
    )
    """Setting this to true means multi-entity."""
    primary_resource_id: Optional[str] = rest_field(
        name="primaryResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified resource identifier of the primary MACC. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/maccs/{maccName}."""
    primary_billing_account_resource_id: Optional[str] = rest_field(
        name="primaryBillingAccountResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified billing account resource identifier of the primary MACC. Format must be Azure
     Resource ID: /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}."""

    @overload
    def __init__(
        self,
        *,
        entity_type: Union[str, "_models.MaccEntityType"],
        status: Optional[Union[str, "_models.MaccStatus"]] = None,
        display_name: Optional[str] = None,
        product_code: Optional[str] = None,
        billing_account_resource_id: Optional[str] = None,
        commitment: Optional["_models.Commitment"] = None,
        start_at: Optional[datetime.datetime] = None,
        end_at: Optional[datetime.datetime] = None,
        system_id: Optional[str] = None,
        automatic_shortfall: Optional[Union[str, "_models.EnablementMode"]] = None,
        automatic_shortfall_suppress_reason: Optional["_models.AutomaticShortfallSuppressReason"] = None,
        shortfall: Optional["_models.Shortfall"] = None,
        milestones: Optional[list["_models.MaccMilestone"]] = None,
        resource_id: Optional[str] = None,
        allow_contributors: Optional[bool] = None,
        primary_resource_id: Optional[str] = None,
        primary_billing_account_resource_id: Optional[str] = None,
    ) -> None: ...

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

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


class MaccPatchRequest(_Model):
    """Macc patch request.

    :ivar properties: Macc patch request properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.MaccPatchRequestProperties
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

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

    __flattened_items = [
        "commitment",
        "end_at",
        "allow_contributors",
        "automatic_shortfall",
        "automatic_shortfall_suppress_reason",
        "display_name",
        "status",
        "milestones",
        "primary_resource_id",
        "primary_billing_account_resource_id",
    ]

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

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

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

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

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


class MaccPatchRequestProperties(_Model):
    """Macc patch request properties.

    :ivar commitment: Commitment towards the benefit.
    :vartype commitment: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar end_at: End DateTime in UTC.
    :vartype end_at: ~datetime.datetime
    :ivar allow_contributors: Setting this to true means multi-entity.
    :vartype allow_contributors: bool
    :ivar automatic_shortfall: Represents the enablement status of a feature or settings. Known
     values are: "Unknown", "Enabled", and "Disabled".
    :vartype automatic_shortfall: str or ~azure.mgmt.billingbenefits.models.EnablementMode
    :ivar automatic_shortfall_suppress_reason: Optional field to record suppression reason for
     automatic shortfall.
    :vartype automatic_shortfall_suppress_reason:
     ~azure.mgmt.billingbenefits.models.AutomaticShortfallSuppressReason
    :ivar display_name: Display name.
    :vartype display_name: str
    :ivar status: Represents the current status of the Milestone. Known values are: "Unknown",
     "Scheduled", "Active", "Pending", "Failed", "Completed", "Canceled", "Removed",
     "PendingSettlement", "ShortfallCharged", and "ShortfallWaived".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.MaccMilestoneStatus
    :ivar milestones: List of milestones to update or add.
    :vartype milestones: list[~azure.mgmt.billingbenefits.models.MaccMilestone]
    :ivar primary_resource_id: Fully-qualified resource identifier of the primary MACC. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/maccs/{maccName}.
    :vartype primary_resource_id: str
    :ivar primary_billing_account_resource_id: Fully-qualified billing account resource identifier
     of the primary MACC. Format must be Azure Resource ID:
     /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}.
    :vartype primary_billing_account_resource_id: str
    """

    commitment: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Commitment towards the benefit."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime in UTC."""
    allow_contributors: Optional[bool] = rest_field(
        name="allowContributors", visibility=["read", "create", "update", "delete", "query"]
    )
    """Setting this to true means multi-entity."""
    automatic_shortfall: Optional[Union[str, "_models.EnablementMode"]] = rest_field(
        name="automaticShortfall", visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the enablement status of a feature or settings. Known values are: \"Unknown\",
     \"Enabled\", and \"Disabled\"."""
    automatic_shortfall_suppress_reason: Optional["_models.AutomaticShortfallSuppressReason"] = rest_field(
        name="automaticShortfallSuppressReason", visibility=["read", "create", "update", "delete", "query"]
    )
    """Optional field to record suppression reason for automatic shortfall."""
    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""
    status: Optional[Union[str, "_models.MaccMilestoneStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the current status of the Milestone. Known values are: \"Unknown\", \"Scheduled\",
     \"Active\", \"Pending\", \"Failed\", \"Completed\", \"Canceled\", \"Removed\",
     \"PendingSettlement\", \"ShortfallCharged\", and \"ShortfallWaived\"."""
    milestones: Optional[list["_models.MaccMilestone"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of milestones to update or add."""
    primary_resource_id: Optional[str] = rest_field(
        name="primaryResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified resource identifier of the primary MACC. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/maccs/{maccName}."""
    primary_billing_account_resource_id: Optional[str] = rest_field(
        name="primaryBillingAccountResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified billing account resource identifier of the primary MACC. Format must be Azure
     Resource ID: /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}."""

    @overload
    def __init__(
        self,
        *,
        commitment: Optional["_models.Commitment"] = None,
        end_at: Optional[datetime.datetime] = None,
        allow_contributors: Optional[bool] = None,
        automatic_shortfall: Optional[Union[str, "_models.EnablementMode"]] = None,
        automatic_shortfall_suppress_reason: Optional["_models.AutomaticShortfallSuppressReason"] = None,
        display_name: Optional[str] = None,
        status: Optional[Union[str, "_models.MaccMilestoneStatus"]] = None,
        milestones: Optional[list["_models.MaccMilestone"]] = None,
        primary_resource_id: Optional[str] = None,
        primary_billing_account_resource_id: Optional[str] = None,
    ) -> None: ...

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

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


class MaccValidateModel(BenefitValidateModel, discriminator="MACC"):
    """MACC validate model.

    :ivar properties: MACC validate properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.MaccModelProperties
    :ivar benefit_type: Type of benefit to validate. This is used to determine the model type for
     validation. Required. MACC.
    :vartype benefit_type: str or ~azure.mgmt.billingbenefits.models.MACC
    """

    properties: Optional["_models.MaccModelProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """MACC validate properties."""
    benefit_type: Literal[BenefitType.MACC] = rest_discriminator(name="benefitType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of benefit to validate. This is used to determine the model type for validation. Required.
     MACC."""

    __flattened_items = [
        "provisioning_state",
        "status",
        "entity_type",
        "display_name",
        "product_code",
        "billing_account_resource_id",
        "commitment",
        "start_at",
        "end_at",
        "system_id",
        "automatic_shortfall",
        "automatic_shortfall_suppress_reason",
        "shortfall",
        "milestones",
        "resource_id",
        "allow_contributors",
        "primary_resource_id",
        "primary_billing_account_resource_id",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 ManagedServiceIdentity(_Model):
    """Managed service identity (system assigned and/or user assigned identities).

    :ivar principal_id: The service principal ID of the system assigned identity. This property
     will only be provided for a system assigned identity.
    :vartype principal_id: str
    :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be
     provided for a system assigned identity.
    :vartype tenant_id: str
    :ivar type: The type of managed identity assigned to this resource. Required. Known values are:
     "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned".
    :vartype type: str or ~azure.mgmt.billingbenefits.models.ManagedServiceIdentityType
    :ivar user_assigned_identities: The identities assigned to this resource by the user.
    :vartype user_assigned_identities: dict[str,
     ~azure.mgmt.billingbenefits.models.UserAssignedIdentity]
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The service principal ID of the system assigned identity. This property will only be provided
     for a system assigned identity."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"])
    """The tenant ID of the system assigned identity. This property will only be provided for a system
     assigned identity."""
    type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of managed identity assigned to this resource. Required. Known values are: \"None\",
     \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\"."""
    user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field(
        name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"]
    )
    """The identities assigned to this resource by the user."""

    @overload
    def __init__(
        self,
        *,
        type: Union[str, "_models.ManagedServiceIdentityType"],
        user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None,
    ) -> None: ...

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

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


class MarketSetPricesItems(_Model):
    """Items in the MarketSetPrices array.

    :ivar markets: Required.
    :vartype markets: list[str]
    :ivar value: The locked price for the priceable node. Validation: Required. Must be greater
     than or equal to 0. If the case of billing plans. This represents the price for each cycle
     charge. Required.
    :vartype value: float
    :ivar currency: The currency of the locked price value. Validation: Required. Must be a valid
     ISO 4217 3-letter currency code. Required.
    :vartype currency: str
    """

    markets: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Required."""
    value: float = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The locked price for the priceable node. Validation: Required. Must be greater than or equal to
     0. If the case of billing plans. This represents the price for each cycle charge. Required."""
    currency: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The currency of the locked price value. Validation: Required. Must be a valid ISO 4217 3-letter
     currency code. Required."""

    @overload
    def __init__(
        self,
        *,
        markets: list[str],
        value: float,
        currency: str,
    ) -> None: ...

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

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


class Operation(_Model):
    """REST API Operation.

    :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples:
     "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action".
    :vartype name: str
    :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for
     data-plane operations and "false" for Azure Resource Manager/control-plane operations.
    :vartype is_data_action: bool
    :ivar display: Localized display information for this particular operation.
    :vartype display: ~azure.mgmt.billingbenefits.models.OperationDisplay
    :ivar origin: The intended executor of the operation; as in Resource Based Access Control
     (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system",
     and "user,system".
    :vartype origin: str or ~azure.mgmt.billingbenefits.models.Origin
    :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions
     that are for internal only APIs. "Internal"
    :vartype action_type: str or ~azure.mgmt.billingbenefits.models.ActionType
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """The name of the operation, as per Resource-Based Access Control (RBAC). Examples:
     \"Microsoft.Compute/virtualMachines/write\",
     \"Microsoft.Compute/virtualMachines/capture/action\"."""
    is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"])
    """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and
     \"false\" for Azure Resource Manager/control-plane operations."""
    display: Optional["_models.OperationDisplay"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Localized display information for this particular operation."""
    origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"])
    """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit
     logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and
     \"user,system\"."""
    action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"])
    """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for
     internal only APIs. \"Internal\""""

    @overload
    def __init__(
        self,
        *,
        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):
    """Localized display information for an operation.

    :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft
     Monitoring Insights" or "Microsoft Compute".
    :vartype provider: str
    :ivar resource: The localized friendly name of the resource type related to this operation.
     E.g. "Virtual Machines" or "Job Schedule Collections".
    :vartype resource: str
    :ivar operation: The concise, localized friendly name for the operation; suitable for
     dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine".
    :vartype operation: str
    :ivar description: The short, localized friendly description of the operation; suitable for
     tool tips and detailed views.
    :vartype description: str
    """

    provider: Optional[str] = rest_field(visibility=["read"])
    """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring
     Insights\" or \"Microsoft Compute\"."""
    resource: Optional[str] = rest_field(visibility=["read"])
    """The localized friendly name of the resource type related to this operation. E.g. \"Virtual
     Machines\" or \"Job Schedule Collections\"."""
    operation: Optional[str] = rest_field(visibility=["read"])
    """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create
     or Update Virtual Machine\", \"Restart Virtual Machine\"."""
    description: Optional[str] = rest_field(visibility=["read"])
    """The short, localized friendly description of the operation; suitable for tool tips and detailed
     views."""


class PaymentDetail(_Model):
    """Information about payment related to a savings plan order.

    :ivar due_date: Date when the payment needs to be done.
    :vartype due_date: ~datetime.date
    :ivar payment_date: Date when the transaction is completed. Is null when it is scheduled.
    :vartype payment_date: ~datetime.date
    :ivar pricing_currency_total: Amount in pricing currency. Tax not included.
    :vartype pricing_currency_total: ~azure.mgmt.billingbenefits.models.Price
    :ivar billing_currency_total: Amount charged in Billing currency. Tax not included. Is null for
     future payments.
    :vartype billing_currency_total: ~azure.mgmt.billingbenefits.models.Price
    :ivar status: Describes whether the payment is completed, failed, cancelled or scheduled in the
     future. Known values are: "Succeeded", "Failed", "Scheduled", and "Cancelled".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.PaymentStatus
    :ivar extended_status_info:
    :vartype extended_status_info: ~azure.mgmt.billingbenefits.models.ExtendedStatusInfo
    :ivar billing_account: Billing account.
    :vartype billing_account: str
    """

    due_date: Optional[datetime.date] = rest_field(
        name="dueDate", visibility=["read", "create", "update", "delete", "query"]
    )
    """Date when the payment needs to be done."""
    payment_date: Optional[datetime.date] = rest_field(
        name="paymentDate", visibility=["read", "create", "update", "delete", "query"]
    )
    """Date when the transaction is completed. Is null when it is scheduled."""
    pricing_currency_total: Optional["_models.Price"] = rest_field(
        name="pricingCurrencyTotal", visibility=["read", "create", "update", "delete", "query"]
    )
    """Amount in pricing currency. Tax not included."""
    billing_currency_total: Optional["_models.Price"] = rest_field(
        name="billingCurrencyTotal", visibility=["read", "create", "update", "delete", "query"]
    )
    """Amount charged in Billing currency. Tax not included. Is null for future payments."""
    status: Optional[Union[str, "_models.PaymentStatus"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Describes whether the payment is completed, failed, cancelled or scheduled in the future. Known
     values are: \"Succeeded\", \"Failed\", \"Scheduled\", and \"Cancelled\"."""
    extended_status_info: Optional["_models.ExtendedStatusInfo"] = rest_field(
        name="extendedStatusInfo", visibility=["read"]
    )
    billing_account: Optional[str] = rest_field(
        name="billingAccount", visibility=["read", "create", "update", "delete", "query"]
    )
    """Billing account."""

    @overload
    def __init__(
        self,
        *,
        due_date: Optional[datetime.date] = None,
        payment_date: Optional[datetime.date] = None,
        pricing_currency_total: Optional["_models.Price"] = None,
        billing_currency_total: Optional["_models.Price"] = None,
        status: Optional[Union[str, "_models.PaymentStatus"]] = None,
        billing_account: 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 Plan(_Model):
    """Plan for the resource.

    :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required.
    :vartype name: str
    :ivar publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic.
     Required.
    :vartype publisher: str
    :ivar product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to
     the OfferID specified for the artifact at the time of Data Market onboarding. Required.
    :vartype product: str
    :ivar promotion_code: A publisher provided promotion code as provisioned in Data Market for the
     said product/artifact.
    :vartype promotion_code: str
    :ivar version: The version of the desired product/artifact.
    :vartype version: str
    """

    name: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """A user defined name of the 3rd Party Artifact that is being procured. Required."""
    publisher: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. Required."""
    product: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID
     specified for the artifact at the time of Data Market onboarding. Required."""
    promotion_code: Optional[str] = rest_field(
        name="promotionCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """A publisher provided promotion code as provisioned in Data Market for the said
     product/artifact."""
    version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The version of the desired product/artifact."""

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

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

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


class PriceGuaranteeProperties(_Model):
    """Set only in price guarantee scenario.

    :ivar pricing_policy: Supported values: Protected, Locked. Known values are: "Protected" and
     "Locked".
    :vartype pricing_policy: str or ~azure.mgmt.billingbenefits.models.PricingPolicy
    :ivar price_guarantee_date: The date on which prices are to be used for guarantee calculation.
     Validation: expected to be 00 hours, Format: 2024-09-30T00:00:00Z. Must be in UTC.
    :vartype price_guarantee_date: ~datetime.datetime
    """

    pricing_policy: Optional[Union[str, "_models.PricingPolicy"]] = rest_field(
        name="pricingPolicy", visibility=["read", "create", "update", "delete", "query"]
    )
    """Supported values: Protected, Locked. Known values are: \"Protected\" and \"Locked\"."""
    price_guarantee_date: Optional[datetime.datetime] = rest_field(
        name="priceGuaranteeDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The date on which prices are to be used for guarantee calculation. Validation: expected to be
     00 hours, Format: 2024-09-30T00:00:00Z. Must be in UTC."""

    @overload
    def __init__(
        self,
        *,
        pricing_policy: Optional[Union[str, "_models.PricingPolicy"]] = None,
        price_guarantee_date: Optional[datetime.datetime] = None,
    ) -> None: ...

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

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


class PrimaryConditionalCreditProperties(ConditionalCreditProperties, discriminator="Primary"):
    """Properties for primary conditional credit.

    :ivar display_name: Display name for the conditional credit.
    :vartype display_name: str
    :ivar billing_account_resource_id: The billing account resource ID.
    :vartype billing_account_resource_id: str
    :ivar provisioning_state: The provisioning state of the resource. Known values are: "Unknown",
     "Succeeded", "Failed", "Canceled", and "Pending".
    :vartype provisioning_state: str or
     ~azure.mgmt.billingbenefits.models.ConditionalCreditsProvisioningState
    :ivar status: The status of the conditional credit. Known values are: "Unknown", "Scheduled",
     "Active", "Pending", "Failed", "Canceled", "Completed", "Stopped", and "PendingSettlement".
    :vartype status: str or ~azure.mgmt.billingbenefits.models.ConditionalCreditStatus
    :ivar start_at: Start date of the conditional credit.
    :vartype start_at: ~datetime.datetime
    :ivar end_at: End date of the conditional credit (derived from last milestone).
    :vartype end_at: ~datetime.datetime
    :ivar product_code: Product code for the conditional credit.
    :vartype product_code: str
    :ivar benefit_resource_id: Fully-qualified identifier of the benefit under applicable benefit
     list.
    :vartype benefit_resource_id: str
    :ivar resource_id: Fully-qualified resource identifier of the resource. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}.
    :vartype resource_id: str
    :ivar system_id: System identifier shared between primary and contributor conditional credits
     representing the same conditional credit program.
    :vartype system_id: str
    :ivar allow_contributors: Whether this conditional credit allows contributor billing accounts.
     Known values are: "Unknown", "Enabled", and "Disabled".
    :vartype allow_contributors: str or ~azure.mgmt.billingbenefits.models.EnablementMode
    :ivar milestones: List of milestones for this conditional credit (must include awards).
    :vartype milestones: list[~azure.mgmt.billingbenefits.models.ConditionalCreditMilestone]
    :ivar entity_type: Type of conditional credit entity. Required. PRIMARY.
    :vartype entity_type: str or ~azure.mgmt.billingbenefits.models.PRIMARY
    """

    system_id: Optional[str] = rest_field(name="systemId", visibility=["read", "create", "update", "delete", "query"])
    """System identifier shared between primary and contributor conditional credits representing the
     same conditional credit program."""
    allow_contributors: Optional[Union[str, "_models.EnablementMode"]] = rest_field(
        name="allowContributors", visibility=["read", "create", "update", "delete", "query"]
    )
    """Whether this conditional credit allows contributor billing accounts. Known values are:
     \"Unknown\", \"Enabled\", and \"Disabled\"."""
    milestones: Optional[list["_models.ConditionalCreditMilestone"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """List of milestones for this conditional credit (must include awards)."""
    entity_type: Literal[ConditionalCreditEntityType.PRIMARY] = rest_discriminator(name="entityType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of conditional credit entity. Required. PRIMARY."""

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        billing_account_resource_id: Optional[str] = None,
        status: Optional[Union[str, "_models.ConditionalCreditStatus"]] = None,
        start_at: Optional[datetime.datetime] = None,
        end_at: Optional[datetime.datetime] = None,
        product_code: Optional[str] = None,
        resource_id: Optional[str] = None,
        system_id: Optional[str] = None,
        allow_contributors: Optional[Union[str, "_models.EnablementMode"]] = None,
        milestones: Optional[list["_models.ConditionalCreditMilestone"]] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.entity_type = ConditionalCreditEntityType.PRIMARY  # type: ignore


class PurchaseRequest(_Model):
    """PurchaseRequest.

    :ivar sku: The SKU to be applied for this resource.
    :vartype sku: ~azure.mgmt.billingbenefits.models.ResourceSku
    :ivar properties:
    :vartype properties: ~azure.mgmt.billingbenefits.models.PurchaseRequestProperties
    """

    sku: Optional["_models.ResourceSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The SKU to be applied for this resource."""
    properties: Optional["_models.PurchaseRequestProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )

    __flattened_items = [
        "display_name",
        "billing_scope_id",
        "term",
        "billing_plan",
        "applied_scope_type",
        "commitment",
        "effective_date_time",
        "renew",
        "applied_scope_properties",
    ]

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

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

    :ivar display_name: Friendly name of the savings plan.
    :vartype display_name: str
    :ivar billing_scope_id: Subscription that will be charged for purchasing the benefit.
    :vartype billing_scope_id: str
    :ivar term: Represent benefit term in ISO 8601 format. Known values are: "P1M", "P1Y", "P3Y",
     and "P5Y".
    :vartype term: str or ~azure.mgmt.billingbenefits.models.Term
    :ivar billing_plan: Represents the billing plan in ISO 8601 format. Required only for monthly
     billing plans. "P1M"
    :vartype billing_plan: str or ~azure.mgmt.billingbenefits.models.BillingPlan
    :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and
     "ManagementGroup".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.AppliedScopeType
    :ivar commitment: Commitment towards the benefit.
    :vartype commitment: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar effective_date_time: DateTime of the savings plan starts providing benefit from.
    :vartype effective_date_time: ~datetime.datetime
    :ivar renew: Setting this to true will automatically purchase a new benefit on the expiration
     date time.
    :vartype renew: bool
    :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not
     applicable.
    :vartype applied_scope_properties: ~azure.mgmt.billingbenefits.models.AppliedScopeProperties
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Friendly name of the savings plan."""
    billing_scope_id: Optional[str] = rest_field(
        name="billingScopeId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Subscription that will be charged for purchasing the benefit."""
    term: Optional[Union[str, "_models.Term"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Represent benefit term in ISO 8601 format. Known values are: \"P1M\", \"P1Y\", \"P3Y\", and
     \"P5Y\"."""
    billing_plan: Optional[Union[str, "_models.BillingPlan"]] = rest_field(
        name="billingPlan", visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the billing plan in ISO 8601 format. Required only for monthly billing plans.
     \"P1M\""""
    applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = rest_field(
        name="appliedScopeType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the Applied Scope. Known values are: \"Single\", \"Shared\", and \"ManagementGroup\"."""
    commitment: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Commitment towards the benefit."""
    effective_date_time: Optional[datetime.datetime] = rest_field(
        name="effectiveDateTime", visibility=["read"], format="rfc3339"
    )
    """DateTime of the savings plan starts providing benefit from."""
    renew: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Setting this to true will automatically purchase a new benefit on the expiration date time."""
    applied_scope_properties: Optional["_models.AppliedScopeProperties"] = rest_field(
        name="appliedScopeProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties specific to applied scope type. Not required if not applicable."""

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        billing_scope_id: Optional[str] = None,
        term: Optional[Union[str, "_models.Term"]] = None,
        billing_plan: Optional[Union[str, "_models.BillingPlan"]] = None,
        applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None,
        commitment: Optional["_models.Commitment"] = None,
        renew: Optional[bool] = None,
        applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None,
    ) -> None: ...

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

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


class RenewProperties(_Model):
    """RenewProperties.

    :ivar purchase_properties:
    :vartype purchase_properties: ~azure.mgmt.billingbenefits.models.PurchaseRequest
    """

    purchase_properties: Optional["_models.PurchaseRequest"] = rest_field(
        name="purchaseProperties", visibility=["read", "create", "update", "delete", "query"]
    )

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

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

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


class ReservationOrderAliasRequest(Resource):
    """Reservation order alias.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.billingbenefits.models.SystemData
    :ivar sku: Reservation order SKU. Required.
    :vartype sku: ~azure.mgmt.billingbenefits.models.ResourceSku
    :ivar location: The Azure Region where the reservation benefits are applied to.
    :vartype location: str
    :ivar properties: Reservation order alias request properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.ReservationOrderAliasRequestProperties
    """

    sku: "_models.ResourceSku" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Reservation order SKU. Required."""
    location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The Azure Region where the reservation benefits are applied to."""
    properties: Optional["_models.ReservationOrderAliasRequestProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Reservation order alias request properties."""

    __flattened_items = [
        "display_name",
        "billing_scope_id",
        "term",
        "billing_plan",
        "applied_scope_type",
        "applied_scope_properties",
        "quantity",
        "renew",
        "reserved_resource_type",
        "review_date_time",
        "reserved_resource_properties",
    ]

    @overload
    def __init__(
        self,
        *,
        sku: "_models.ResourceSku",
        location: Optional[str] = None,
        properties: Optional["_models.ReservationOrderAliasRequestProperties"] = None,
    ) -> None: ...

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

    :ivar display_name: Display name.
    :vartype display_name: str
    :ivar billing_scope_id: Subscription that will be charged for purchasing the benefit.
    :vartype billing_scope_id: str
    :ivar term: Represent benefit term in ISO 8601 format. Known values are: "P1M", "P1Y", "P3Y",
     and "P5Y".
    :vartype term: str or ~azure.mgmt.billingbenefits.models.Term
    :ivar billing_plan: Represents the billing plan in ISO 8601 format. Required only for monthly
     billing plans. "P1M"
    :vartype billing_plan: str or ~azure.mgmt.billingbenefits.models.BillingPlan
    :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and
     "ManagementGroup".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.AppliedScopeType
    :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not
     applicable.
    :vartype applied_scope_properties: ~azure.mgmt.billingbenefits.models.AppliedScopeProperties
    :ivar quantity: Total Quantity of the SKUs purchased in the Reservation.
    :vartype quantity: int
    :ivar renew: Setting this to true will automatically purchase a new benefit on the expiration
     date time.
    :vartype renew: bool
    :ivar reserved_resource_type: The type of the resource that is being reserved. Known values
     are: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", "SqlDataWarehouse",
     "VMwareCloudSimple", "RedHatOsa", "Databricks", "AppService", "ManagedDisk", "BlockBlob",
     "RedisCache", "AzureDataExplorer", "MySql", "MariaDb", "PostgreSql", "DedicatedHost",
     "SapHana", "SqlAzureHybridBenefit", "AVS", "DataFactory", "NetAppStorage", "AzureFiles",
     "SqlEdge", and "VirtualMachineSoftware".
    :vartype reserved_resource_type: str or ~azure.mgmt.billingbenefits.models.ReservedResourceType
    :ivar review_date_time: This is the date-time when the Azure Hybrid Benefit needs to be
     reviewed.
    :vartype review_date_time: ~datetime.datetime
    :ivar reserved_resource_properties: Properties specific to each reserved resource type. Not
     required if not applicable.
    :vartype reserved_resource_properties:
     ~azure.mgmt.billingbenefits.models.ReservationOrderAliasRequestPropertiesReservedResourceProperties
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""
    billing_scope_id: Optional[str] = rest_field(
        name="billingScopeId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Subscription that will be charged for purchasing the benefit."""
    term: Optional[Union[str, "_models.Term"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Represent benefit term in ISO 8601 format. Known values are: \"P1M\", \"P1Y\", \"P3Y\", and
     \"P5Y\"."""
    billing_plan: Optional[Union[str, "_models.BillingPlan"]] = rest_field(
        name="billingPlan", visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the billing plan in ISO 8601 format. Required only for monthly billing plans.
     \"P1M\""""
    applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = rest_field(
        name="appliedScopeType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the Applied Scope. Known values are: \"Single\", \"Shared\", and \"ManagementGroup\"."""
    applied_scope_properties: Optional["_models.AppliedScopeProperties"] = rest_field(
        name="appliedScopeProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties specific to applied scope type. Not required if not applicable."""
    quantity: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Total Quantity of the SKUs purchased in the Reservation."""
    renew: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Setting this to true will automatically purchase a new benefit on the expiration date time."""
    reserved_resource_type: Optional[Union[str, "_models.ReservedResourceType"]] = rest_field(
        name="reservedResourceType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of the resource that is being reserved. Known values are: \"VirtualMachines\",
     \"SqlDatabases\", \"SuseLinux\", \"CosmosDb\", \"RedHat\", \"SqlDataWarehouse\",
     \"VMwareCloudSimple\", \"RedHatOsa\", \"Databricks\", \"AppService\", \"ManagedDisk\",
     \"BlockBlob\", \"RedisCache\", \"AzureDataExplorer\", \"MySql\", \"MariaDb\", \"PostgreSql\",
     \"DedicatedHost\", \"SapHana\", \"SqlAzureHybridBenefit\", \"AVS\", \"DataFactory\",
     \"NetAppStorage\", \"AzureFiles\", \"SqlEdge\", and \"VirtualMachineSoftware\"."""
    review_date_time: Optional[datetime.datetime] = rest_field(
        name="reviewDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """This is the date-time when the Azure Hybrid Benefit needs to be reviewed."""
    reserved_resource_properties: Optional[
        "_models.ReservationOrderAliasRequestPropertiesReservedResourceProperties"
    ] = rest_field(name="reservedResourceProperties", visibility=["read", "create", "update", "delete", "query"])
    """Properties specific to each reserved resource type. Not required if not applicable."""

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        billing_scope_id: Optional[str] = None,
        term: Optional[Union[str, "_models.Term"]] = None,
        billing_plan: Optional[Union[str, "_models.BillingPlan"]] = None,
        applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None,
        applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None,
        quantity: Optional[int] = None,
        renew: Optional[bool] = None,
        reserved_resource_type: Optional[Union[str, "_models.ReservedResourceType"]] = None,
        review_date_time: Optional[datetime.datetime] = None,
        reserved_resource_properties: Optional[
            "_models.ReservationOrderAliasRequestPropertiesReservedResourceProperties"
        ] = None,
    ) -> None: ...

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

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


class ReservationOrderAliasRequestPropertiesReservedResourceProperties(_Model):  # pylint: disable=name-too-long
    """Properties specific to each reserved resource type. Not required if not applicable.

    :ivar instance_flexibility: Turning this on will apply the reservation discount to other VMs in
     the same VM size group. Known values are: "On" and "Off".
    :vartype instance_flexibility: str or ~azure.mgmt.billingbenefits.models.InstanceFlexibility
    """

    instance_flexibility: Optional[Union[str, "_models.InstanceFlexibility"]] = rest_field(
        name="instanceFlexibility", visibility=["read", "create", "update", "delete", "query"]
    )
    """Turning this on will apply the reservation discount to other VMs in the same VM size group.
     Known values are: \"On\" and \"Off\"."""

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

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

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


class ReservationOrderAliasResponse(ProxyResource):
    """Reservation order alias.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.billingbenefits.models.SystemData
    :ivar properties: Reservation order alias response properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.ReservationOrderAliasResponseProperties
    :ivar sku: Reservation order SKU. Required.
    :vartype sku: ~azure.mgmt.billingbenefits.models.ResourceSku
    :ivar location: The Azure Region where the reserved resource lives.
    :vartype location: str
    """

    properties: Optional["_models.ReservationOrderAliasResponseProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Reservation order alias response properties."""
    sku: "_models.ResourceSku" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Reservation order SKU. Required."""
    location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The Azure Region where the reserved resource lives."""

    __flattened_items = [
        "display_name",
        "reservation_order_id",
        "provisioning_state",
        "billing_scope_id",
        "term",
        "billing_plan",
        "applied_scope_type",
        "applied_scope_properties",
        "quantity",
        "renew",
        "reserved_resource_type",
        "review_date_time",
        "reserved_resource_properties",
    ]

    @overload
    def __init__(
        self,
        *,
        sku: "_models.ResourceSku",
        properties: Optional["_models.ReservationOrderAliasResponseProperties"] = None,
        location: Optional[str] = None,
    ) -> None: ...

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

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        _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 ReservationOrderAliasResponseProperties(_Model):
    """Reservation properties.

    :ivar display_name: Display name.
    :vartype display_name: str
    :ivar reservation_order_id: Identifier of the reservation order created.
    :vartype reservation_order_id: str
    :ivar provisioning_state: Provisioning state. Known values are: "Creating", "PendingBilling",
     "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed".
    :vartype provisioning_state: str or ~azure.mgmt.billingbenefits.models.ProvisioningState
    :ivar billing_scope_id: Subscription that will be charged for purchasing the benefit.
    :vartype billing_scope_id: str
    :ivar term: Represent benefit term in ISO 8601 format. Known values are: "P1M", "P1Y", "P3Y",
     and "P5Y".
    :vartype term: str or ~azure.mgmt.billingbenefits.models.Term
    :ivar billing_plan: Represents the billing plan in ISO 8601 format. Required only for monthly
     billing plans. "P1M"
    :vartype billing_plan: str or ~azure.mgmt.billingbenefits.models.BillingPlan
    :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and
     "ManagementGroup".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.AppliedScopeType
    :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not
     applicable.
    :vartype applied_scope_properties: ~azure.mgmt.billingbenefits.models.AppliedScopeProperties
    :ivar quantity: Total Quantity of the SKUs purchased in the Reservation.
    :vartype quantity: int
    :ivar renew: Setting this to true will automatically purchase a new benefit on the expiration
     date time.
    :vartype renew: bool
    :ivar reserved_resource_type: The type of the resource that is being reserved. Known values
     are: "VirtualMachines", "SqlDatabases", "SuseLinux", "CosmosDb", "RedHat", "SqlDataWarehouse",
     "VMwareCloudSimple", "RedHatOsa", "Databricks", "AppService", "ManagedDisk", "BlockBlob",
     "RedisCache", "AzureDataExplorer", "MySql", "MariaDb", "PostgreSql", "DedicatedHost",
     "SapHana", "SqlAzureHybridBenefit", "AVS", "DataFactory", "NetAppStorage", "AzureFiles",
     "SqlEdge", and "VirtualMachineSoftware".
    :vartype reserved_resource_type: str or ~azure.mgmt.billingbenefits.models.ReservedResourceType
    :ivar review_date_time: This is the date-time when the Reservation needs to be reviewed.
    :vartype review_date_time: ~datetime.datetime
    :ivar reserved_resource_properties: Properties specific to each reserved resource type. Not
     required if not applicable.
    :vartype reserved_resource_properties:
     ~azure.mgmt.billingbenefits.models.ReservationOrderAliasResponsePropertiesReservedResourceProperties
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""
    reservation_order_id: Optional[str] = rest_field(name="reservationOrderId", visibility=["read"])
    """Identifier of the reservation order created."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state. Known values are: \"Creating\", \"PendingBilling\", \"ConfirmedBilling\",
     \"Created\", \"Succeeded\", \"Cancelled\", \"Expired\", and \"Failed\"."""
    billing_scope_id: Optional[str] = rest_field(
        name="billingScopeId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Subscription that will be charged for purchasing the benefit."""
    term: Optional[Union[str, "_models.Term"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Represent benefit term in ISO 8601 format. Known values are: \"P1M\", \"P1Y\", \"P3Y\", and
     \"P5Y\"."""
    billing_plan: Optional[Union[str, "_models.BillingPlan"]] = rest_field(
        name="billingPlan", visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the billing plan in ISO 8601 format. Required only for monthly billing plans.
     \"P1M\""""
    applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = rest_field(
        name="appliedScopeType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the Applied Scope. Known values are: \"Single\", \"Shared\", and \"ManagementGroup\"."""
    applied_scope_properties: Optional["_models.AppliedScopeProperties"] = rest_field(
        name="appliedScopeProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties specific to applied scope type. Not required if not applicable."""
    quantity: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Total Quantity of the SKUs purchased in the Reservation."""
    renew: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Setting this to true will automatically purchase a new benefit on the expiration date time."""
    reserved_resource_type: Optional[Union[str, "_models.ReservedResourceType"]] = rest_field(
        name="reservedResourceType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of the resource that is being reserved. Known values are: \"VirtualMachines\",
     \"SqlDatabases\", \"SuseLinux\", \"CosmosDb\", \"RedHat\", \"SqlDataWarehouse\",
     \"VMwareCloudSimple\", \"RedHatOsa\", \"Databricks\", \"AppService\", \"ManagedDisk\",
     \"BlockBlob\", \"RedisCache\", \"AzureDataExplorer\", \"MySql\", \"MariaDb\", \"PostgreSql\",
     \"DedicatedHost\", \"SapHana\", \"SqlAzureHybridBenefit\", \"AVS\", \"DataFactory\",
     \"NetAppStorage\", \"AzureFiles\", \"SqlEdge\", and \"VirtualMachineSoftware\"."""
    review_date_time: Optional[datetime.datetime] = rest_field(
        name="reviewDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """This is the date-time when the Reservation needs to be reviewed."""
    reserved_resource_properties: Optional[
        "_models.ReservationOrderAliasResponsePropertiesReservedResourceProperties"
    ] = rest_field(name="reservedResourceProperties", visibility=["read", "create", "update", "delete", "query"])
    """Properties specific to each reserved resource type. Not required if not applicable."""

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        billing_scope_id: Optional[str] = None,
        term: Optional[Union[str, "_models.Term"]] = None,
        billing_plan: Optional[Union[str, "_models.BillingPlan"]] = None,
        applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None,
        applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None,
        quantity: Optional[int] = None,
        renew: Optional[bool] = None,
        reserved_resource_type: Optional[Union[str, "_models.ReservedResourceType"]] = None,
        review_date_time: Optional[datetime.datetime] = None,
        reserved_resource_properties: Optional[
            "_models.ReservationOrderAliasResponsePropertiesReservedResourceProperties"
        ] = None,
    ) -> None: ...

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

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


class ReservationOrderAliasResponsePropertiesReservedResourceProperties(_Model):  # pylint: disable=name-too-long
    """Properties specific to each reserved resource type. Not required if not applicable.

    :ivar instance_flexibility: Turning this on will apply the reservation discount to other VMs in
     the same VM size group. Known values are: "On" and "Off".
    :vartype instance_flexibility: str or ~azure.mgmt.billingbenefits.models.InstanceFlexibility
    """

    instance_flexibility: Optional[Union[str, "_models.InstanceFlexibility"]] = rest_field(
        name="instanceFlexibility", visibility=["read", "create", "update", "delete", "query"]
    )
    """Turning this on will apply the reservation discount to other VMs in the same VM size group.
     Known values are: \"On\" and \"Off\"."""

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

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

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


class ResourceSku(_Model):
    """ResourceSku.

    :ivar name:
    :vartype name: str
    """

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

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

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

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


class RoleAssignmentEntity(_Model):
    """Role assignment entity.

    :ivar id: Role assignment entity id.
    :vartype id: str
    :ivar name: Role assignment entity name.
    :vartype name: str
    :ivar properties: Role assignment entity properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.RoleAssignmentEntityProperties
    """

    id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Role assignment entity id."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Role assignment entity name."""
    properties: Optional["_models.RoleAssignmentEntityProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Role assignment entity properties."""

    __flattened_items = ["principal_id", "role_definition_id", "scope"]

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

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

    :ivar principal_id: Principal Id.
    :vartype principal_id: str
    :ivar role_definition_id: Role definition id.
    :vartype role_definition_id: str
    :ivar scope: Scope of the role assignment entity.
    :vartype scope: str
    """

    principal_id: Optional[str] = rest_field(
        name="principalId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Principal Id."""
    role_definition_id: Optional[str] = rest_field(
        name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Role definition id."""
    scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Scope of the role assignment entity."""

    @overload
    def __init__(
        self,
        *,
        principal_id: Optional[str] = None,
        role_definition_id: 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 SavingsPlanModel(ProxyResource):
    """Savings plan.

    :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.billingbenefits.models.SystemData
    :ivar properties: Savings plan properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.SavingsPlanModelProperties
    :ivar sku: Savings plan SKU. Required.
    :vartype sku: ~azure.mgmt.billingbenefits.models.ResourceSku
    """

    properties: Optional["_models.SavingsPlanModelProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Savings plan properties."""
    sku: "_models.ResourceSku" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Savings plan SKU. Required."""

    __flattened_items = [
        "display_name",
        "provisioning_state",
        "display_provisioning_state",
        "billing_scope_id",
        "billing_profile_id",
        "customer_id",
        "billing_account_id",
        "term",
        "billing_plan",
        "applied_scope_type",
        "user_friendly_applied_scope_type",
        "applied_scope_properties",
        "commitment",
        "effective_date_time",
        "expiry_date_time",
        "purchase_date_time",
        "benefit_start_time",
        "extended_status_info",
        "renew",
        "utilization",
        "renew_source",
        "renew_destination",
        "renew_properties",
    ]

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

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

    :ivar display_name: Display name.
    :vartype display_name: str
    :ivar provisioning_state: Provisioning state. Known values are: "Creating", "PendingBilling",
     "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed".
    :vartype provisioning_state: str or ~azure.mgmt.billingbenefits.models.ProvisioningState
    :ivar display_provisioning_state: The provisioning state of the savings plan for display, e.g.
     Succeeded.
    :vartype display_provisioning_state: str
    :ivar billing_scope_id: Subscription that will be charged for purchasing the benefit.
    :vartype billing_scope_id: str
    :ivar billing_profile_id: Fully-qualified identifier of the billing profile where the benefit
     is applied. Present only for Field-led or Customer-led customers.
    :vartype billing_profile_id: str
    :ivar customer_id: Fully-qualified identifier of the customer where the savings plan is
     applied. Present only for Partner-led customers.
    :vartype customer_id: str
    :ivar billing_account_id: Fully-qualified identifier of the billing account where the benefit
     is applied. Present only for Enterprise Agreement customers.
    :vartype billing_account_id: str
    :ivar term: Represent benefit term in ISO 8601 format. Known values are: "P1M", "P1Y", "P3Y",
     and "P5Y".
    :vartype term: str or ~azure.mgmt.billingbenefits.models.Term
    :ivar billing_plan: Represents the billing plan in ISO 8601 format. Required only for monthly
     billing plans. "P1M"
    :vartype billing_plan: str or ~azure.mgmt.billingbenefits.models.BillingPlan
    :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and
     "ManagementGroup".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.AppliedScopeType
    :ivar user_friendly_applied_scope_type: The applied scope type of the savings plan for display,
     e.g. Shared.
    :vartype user_friendly_applied_scope_type: str
    :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not
     applicable.
    :vartype applied_scope_properties: ~azure.mgmt.billingbenefits.models.AppliedScopeProperties
    :ivar commitment: Commitment towards the benefit.
    :vartype commitment: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar effective_date_time: DateTime of the savings plan starts providing benefit from.
    :vartype effective_date_time: ~datetime.datetime
    :ivar expiry_date_time: Expiry date time.
    :vartype expiry_date_time: ~datetime.datetime
    :ivar purchase_date_time: Date time when the savings plan was purchased.
    :vartype purchase_date_time: ~datetime.datetime
    :ivar benefit_start_time: This is the DateTime when the savings plan benefit started.
    :vartype benefit_start_time: ~datetime.datetime
    :ivar extended_status_info:
    :vartype extended_status_info: ~azure.mgmt.billingbenefits.models.ExtendedStatusInfo
    :ivar renew: Setting this to true will automatically purchase a new benefit on the expiration
     date time.
    :vartype renew: bool
    :ivar utilization: Savings plan utilization.
    :vartype utilization: ~azure.mgmt.billingbenefits.models.Utilization
    :ivar renew_source: SavingsPlan Id of the SavingsPlan from which this SavingsPlan is renewed.
    :vartype renew_source: str
    :ivar renew_destination: SavingsPlan Id of the SavingsPlan which is purchased because of renew.
    :vartype renew_destination: str
    :ivar renew_properties:
    :vartype renew_properties: ~azure.mgmt.billingbenefits.models.RenewProperties
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state. Known values are: \"Creating\", \"PendingBilling\", \"ConfirmedBilling\",
     \"Created\", \"Succeeded\", \"Cancelled\", \"Expired\", and \"Failed\"."""
    display_provisioning_state: Optional[str] = rest_field(name="displayProvisioningState", visibility=["read"])
    """The provisioning state of the savings plan for display, e.g. Succeeded."""
    billing_scope_id: Optional[str] = rest_field(
        name="billingScopeId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Subscription that will be charged for purchasing the benefit."""
    billing_profile_id: Optional[str] = rest_field(name="billingProfileId", visibility=["read"])
    """Fully-qualified identifier of the billing profile where the benefit is applied. Present only
     for Field-led or Customer-led customers."""
    customer_id: Optional[str] = rest_field(name="customerId", visibility=["read"])
    """Fully-qualified identifier of the customer where the savings plan is applied. Present only for
     Partner-led customers."""
    billing_account_id: Optional[str] = rest_field(name="billingAccountId", visibility=["read"])
    """Fully-qualified identifier of the billing account where the benefit is applied. Present only
     for Enterprise Agreement customers."""
    term: Optional[Union[str, "_models.Term"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Represent benefit term in ISO 8601 format. Known values are: \"P1M\", \"P1Y\", \"P3Y\", and
     \"P5Y\"."""
    billing_plan: Optional[Union[str, "_models.BillingPlan"]] = rest_field(
        name="billingPlan", visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the billing plan in ISO 8601 format. Required only for monthly billing plans.
     \"P1M\""""
    applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = rest_field(
        name="appliedScopeType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the Applied Scope. Known values are: \"Single\", \"Shared\", and \"ManagementGroup\"."""
    user_friendly_applied_scope_type: Optional[str] = rest_field(
        name="userFriendlyAppliedScopeType", visibility=["read"]
    )
    """The applied scope type of the savings plan for display, e.g. Shared."""
    applied_scope_properties: Optional["_models.AppliedScopeProperties"] = rest_field(
        name="appliedScopeProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties specific to applied scope type. Not required if not applicable."""
    commitment: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Commitment towards the benefit."""
    effective_date_time: Optional[datetime.datetime] = rest_field(
        name="effectiveDateTime", visibility=["read"], format="rfc3339"
    )
    """DateTime of the savings plan starts providing benefit from."""
    expiry_date_time: Optional[datetime.datetime] = rest_field(
        name="expiryDateTime", visibility=["read"], format="rfc3339"
    )
    """Expiry date time."""
    purchase_date_time: Optional[datetime.datetime] = rest_field(
        name="purchaseDateTime", visibility=["read"], format="rfc3339"
    )
    """Date time when the savings plan was purchased."""
    benefit_start_time: Optional[datetime.datetime] = rest_field(
        name="benefitStartTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """This is the DateTime when the savings plan benefit started."""
    extended_status_info: Optional["_models.ExtendedStatusInfo"] = rest_field(
        name="extendedStatusInfo", visibility=["read"]
    )
    renew: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Setting this to true will automatically purchase a new benefit on the expiration date time."""
    utilization: Optional["_models.Utilization"] = rest_field(visibility=["read"])
    """Savings plan utilization."""
    renew_source: Optional[str] = rest_field(
        name="renewSource", visibility=["read", "create", "update", "delete", "query"]
    )
    """SavingsPlan Id of the SavingsPlan from which this SavingsPlan is renewed."""
    renew_destination: Optional[str] = rest_field(
        name="renewDestination", visibility=["read", "create", "update", "delete", "query"]
    )
    """SavingsPlan Id of the SavingsPlan which is purchased because of renew."""
    renew_properties: Optional["_models.RenewProperties"] = rest_field(
        name="renewProperties", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        billing_scope_id: Optional[str] = None,
        term: Optional[Union[str, "_models.Term"]] = None,
        billing_plan: Optional[Union[str, "_models.BillingPlan"]] = None,
        applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None,
        applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None,
        commitment: Optional["_models.Commitment"] = None,
        benefit_start_time: Optional[datetime.datetime] = None,
        renew: Optional[bool] = None,
        renew_source: Optional[str] = None,
        renew_destination: Optional[str] = None,
        renew_properties: Optional["_models.RenewProperties"] = None,
    ) -> None: ...

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

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


class SavingsPlanOrderAliasModel(ProxyResource):
    """Savings plan order alias.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.billingbenefits.models.SystemData
    :ivar properties: Savings plan order alias properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.SavingsPlanOrderAliasProperties
    :ivar sku: Savings plan SKU. Required.
    :vartype sku: ~azure.mgmt.billingbenefits.models.ResourceSku
    :ivar kind: Resource provider kind.
    :vartype kind: str
    """

    properties: Optional["_models.SavingsPlanOrderAliasProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Savings plan order alias properties."""
    sku: "_models.ResourceSku" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Savings plan SKU. Required."""
    kind: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource provider kind."""

    __flattened_items = [
        "display_name",
        "savings_plan_order_id",
        "provisioning_state",
        "billing_scope_id",
        "term",
        "billing_plan",
        "applied_scope_type",
        "applied_scope_properties",
        "commitment",
        "renew",
    ]

    @overload
    def __init__(
        self,
        *,
        sku: "_models.ResourceSku",
        properties: Optional["_models.SavingsPlanOrderAliasProperties"] = None,
        kind: 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:
        _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 SavingsPlanOrderAliasProperties(_Model):
    """Savings plan properties.

    :ivar display_name: Display name.
    :vartype display_name: str
    :ivar savings_plan_order_id: Identifier of the savings plan created.
    :vartype savings_plan_order_id: str
    :ivar provisioning_state: Provisioning state. Known values are: "Creating", "PendingBilling",
     "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed".
    :vartype provisioning_state: str or ~azure.mgmt.billingbenefits.models.ProvisioningState
    :ivar billing_scope_id: Subscription that will be charged for purchasing the benefit.
    :vartype billing_scope_id: str
    :ivar term: Represent benefit term in ISO 8601 format. Known values are: "P1M", "P1Y", "P3Y",
     and "P5Y".
    :vartype term: str or ~azure.mgmt.billingbenefits.models.Term
    :ivar billing_plan: Represents the billing plan in ISO 8601 format. Required only for monthly
     billing plans. "P1M"
    :vartype billing_plan: str or ~azure.mgmt.billingbenefits.models.BillingPlan
    :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and
     "ManagementGroup".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.AppliedScopeType
    :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not
     applicable.
    :vartype applied_scope_properties: ~azure.mgmt.billingbenefits.models.AppliedScopeProperties
    :ivar commitment: Commitment towards the benefit.
    :vartype commitment: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar renew: Setting this to true will automatically purchase a new benefit on the expiration
     date time.
    :vartype renew: bool
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""
    savings_plan_order_id: Optional[str] = rest_field(name="savingsPlanOrderId", visibility=["read"])
    """Identifier of the savings plan created."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state. Known values are: \"Creating\", \"PendingBilling\", \"ConfirmedBilling\",
     \"Created\", \"Succeeded\", \"Cancelled\", \"Expired\", and \"Failed\"."""
    billing_scope_id: Optional[str] = rest_field(
        name="billingScopeId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Subscription that will be charged for purchasing the benefit."""
    term: Optional[Union[str, "_models.Term"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Represent benefit term in ISO 8601 format. Known values are: \"P1M\", \"P1Y\", \"P3Y\", and
     \"P5Y\"."""
    billing_plan: Optional[Union[str, "_models.BillingPlan"]] = rest_field(
        name="billingPlan", visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the billing plan in ISO 8601 format. Required only for monthly billing plans.
     \"P1M\""""
    applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = rest_field(
        name="appliedScopeType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the Applied Scope. Known values are: \"Single\", \"Shared\", and \"ManagementGroup\"."""
    applied_scope_properties: Optional["_models.AppliedScopeProperties"] = rest_field(
        name="appliedScopeProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties specific to applied scope type. Not required if not applicable."""
    commitment: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Commitment towards the benefit."""
    renew: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Setting this to true will automatically purchase a new benefit on the expiration date time."""

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        billing_scope_id: Optional[str] = None,
        term: Optional[Union[str, "_models.Term"]] = None,
        billing_plan: Optional[Union[str, "_models.BillingPlan"]] = None,
        applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None,
        applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None,
        commitment: Optional["_models.Commitment"] = None,
        renew: 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 SavingsPlanOrderModel(ProxyResource):
    """Savings plan order.

    :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.billingbenefits.models.SystemData
    :ivar properties: Savings plan order properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.SavingsPlanOrderModelProperties
    :ivar sku: Savings plan SKU. Required.
    :vartype sku: ~azure.mgmt.billingbenefits.models.ResourceSku
    """

    properties: Optional["_models.SavingsPlanOrderModelProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Savings plan order properties."""
    sku: "_models.ResourceSku" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Savings plan SKU. Required."""

    __flattened_items = [
        "display_name",
        "provisioning_state",
        "billing_scope_id",
        "billing_profile_id",
        "customer_id",
        "billing_account_id",
        "term",
        "billing_plan",
        "expiry_date_time",
        "benefit_start_time",
        "plan_information",
        "savings_plans",
        "extended_status_info",
    ]

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

    @overload
    def __init__(self, mapping: Mapping[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 SavingsPlanOrderModelProperties(_Model):
    """Savings plan order properties.

    :ivar display_name: Display name.
    :vartype display_name: str
    :ivar provisioning_state: Provisioning state. Known values are: "Creating", "PendingBilling",
     "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed".
    :vartype provisioning_state: str or ~azure.mgmt.billingbenefits.models.ProvisioningState
    :ivar billing_scope_id: Subscription that will be charged for purchasing the benefit.
    :vartype billing_scope_id: str
    :ivar billing_profile_id: Fully-qualified identifier of the billing profile where the benefit
     is applied. Present only for Field-led or Customer-led customers.
    :vartype billing_profile_id: str
    :ivar customer_id: Fully-qualified identifier of the customer where the savings plan is
     applied. Present only for Partner-led customers.
    :vartype customer_id: str
    :ivar billing_account_id: Fully-qualified identifier of the billing account where the benefit
     is applied. Present only for Enterprise Agreement customers.
    :vartype billing_account_id: str
    :ivar term: Represent benefit term in ISO 8601 format. Known values are: "P1M", "P1Y", "P3Y",
     and "P5Y".
    :vartype term: str or ~azure.mgmt.billingbenefits.models.Term
    :ivar billing_plan: Represents the billing plan in ISO 8601 format. Required only for monthly
     billing plans. "P1M"
    :vartype billing_plan: str or ~azure.mgmt.billingbenefits.models.BillingPlan
    :ivar expiry_date_time: Expiry date time.
    :vartype expiry_date_time: ~datetime.datetime
    :ivar benefit_start_time: This is the DateTime when the savings plan benefit started.
    :vartype benefit_start_time: ~datetime.datetime
    :ivar plan_information: Information describing the type of billing plan for this savings plan.
    :vartype plan_information: ~azure.mgmt.billingbenefits.models.BillingPlanInformation
    :ivar savings_plans:
    :vartype savings_plans: list[str]
    :ivar extended_status_info:
    :vartype extended_status_info: ~azure.mgmt.billingbenefits.models.ExtendedStatusInfo
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state. Known values are: \"Creating\", \"PendingBilling\", \"ConfirmedBilling\",
     \"Created\", \"Succeeded\", \"Cancelled\", \"Expired\", and \"Failed\"."""
    billing_scope_id: Optional[str] = rest_field(
        name="billingScopeId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Subscription that will be charged for purchasing the benefit."""
    billing_profile_id: Optional[str] = rest_field(name="billingProfileId", visibility=["read"])
    """Fully-qualified identifier of the billing profile where the benefit is applied. Present only
     for Field-led or Customer-led customers."""
    customer_id: Optional[str] = rest_field(name="customerId", visibility=["read"])
    """Fully-qualified identifier of the customer where the savings plan is applied. Present only for
     Partner-led customers."""
    billing_account_id: Optional[str] = rest_field(name="billingAccountId", visibility=["read"])
    """Fully-qualified identifier of the billing account where the benefit is applied. Present only
     for Enterprise Agreement customers."""
    term: Optional[Union[str, "_models.Term"]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Represent benefit term in ISO 8601 format. Known values are: \"P1M\", \"P1Y\", \"P3Y\", and
     \"P5Y\"."""
    billing_plan: Optional[Union[str, "_models.BillingPlan"]] = rest_field(
        name="billingPlan", visibility=["read", "create", "update", "delete", "query"]
    )
    """Represents the billing plan in ISO 8601 format. Required only for monthly billing plans.
     \"P1M\""""
    expiry_date_time: Optional[datetime.datetime] = rest_field(
        name="expiryDateTime", visibility=["read"], format="rfc3339"
    )
    """Expiry date time."""
    benefit_start_time: Optional[datetime.datetime] = rest_field(
        name="benefitStartTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """This is the DateTime when the savings plan benefit started."""
    plan_information: Optional["_models.BillingPlanInformation"] = rest_field(
        name="planInformation", visibility=["read", "create", "update", "delete", "query"]
    )
    """Information describing the type of billing plan for this savings plan."""
    savings_plans: Optional[list[str]] = rest_field(
        name="savingsPlans", visibility=["read", "create", "update", "delete", "query"]
    )
    extended_status_info: Optional["_models.ExtendedStatusInfo"] = rest_field(
        name="extendedStatusInfo", visibility=["read"]
    )

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        billing_scope_id: Optional[str] = None,
        term: Optional[Union[str, "_models.Term"]] = None,
        billing_plan: Optional[Union[str, "_models.BillingPlan"]] = None,
        benefit_start_time: Optional[datetime.datetime] = None,
        plan_information: Optional["_models.BillingPlanInformation"] = None,
        savings_plans: 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 SavingsPlanSummary(_Model):
    """Savings plans list summary.

    :ivar name: This property has value 'summary'.
    :vartype name: str
    :ivar value: The roll up count summary of savings plans in each state.
    :vartype value: ~azure.mgmt.billingbenefits.models.SavingsPlanSummaryCount
    """

    name: Optional[str] = rest_field(visibility=["read"])
    """This property has value 'summary'."""
    value: Optional["_models.SavingsPlanSummaryCount"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The roll up count summary of savings plans in each state."""

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

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

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


class SavingsPlanSummaryCount(_Model):
    """The roll up count summary of savings plans in each state.

    :ivar succeeded_count: The number of savings plans in Succeeded state.
    :vartype succeeded_count: float
    :ivar failed_count: The number of savings plans in Failed state.
    :vartype failed_count: float
    :ivar expiring_count: The number of savings plans in Expiring state.
    :vartype expiring_count: float
    :ivar expired_count: The number of savings plans in Expired state.
    :vartype expired_count: float
    :ivar pending_count: The number of savings plans in Pending state.
    :vartype pending_count: float
    :ivar cancelled_count: The number of savings plans in Cancelled state.
    :vartype cancelled_count: float
    :ivar processing_count: The number of savings plans in Processing state.
    :vartype processing_count: float
    :ivar no_benefit_count: The number of savings plans in No Benefit state.
    :vartype no_benefit_count: float
    :ivar warning_count: The number of savings plans in Warning state.
    :vartype warning_count: float
    """

    succeeded_count: Optional[float] = rest_field(name="succeededCount", visibility=["read"])
    """The number of savings plans in Succeeded state."""
    failed_count: Optional[float] = rest_field(name="failedCount", visibility=["read"])
    """The number of savings plans in Failed state."""
    expiring_count: Optional[float] = rest_field(name="expiringCount", visibility=["read"])
    """The number of savings plans in Expiring state."""
    expired_count: Optional[float] = rest_field(name="expiredCount", visibility=["read"])
    """The number of savings plans in Expired state."""
    pending_count: Optional[float] = rest_field(name="pendingCount", visibility=["read"])
    """The number of savings plans in Pending state."""
    cancelled_count: Optional[float] = rest_field(name="cancelledCount", visibility=["read"])
    """The number of savings plans in Cancelled state."""
    processing_count: Optional[float] = rest_field(name="processingCount", visibility=["read"])
    """The number of savings plans in Processing state."""
    no_benefit_count: Optional[float] = rest_field(name="noBenefitCount", visibility=["read"])
    """The number of savings plans in No Benefit state."""
    warning_count: Optional[float] = rest_field(name="warningCount", visibility=["read"])
    """The number of savings plans in Warning state."""


class SavingsPlanUpdateRequest(_Model):
    """Savings plan patch request.

    :ivar properties: Savings plan patch request.
    :vartype properties: ~azure.mgmt.billingbenefits.models.SavingsPlanUpdateRequestProperties
    """

    properties: Optional["_models.SavingsPlanUpdateRequestProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Savings plan patch request."""

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

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

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


class SavingsPlanUpdateRequestProperties(_Model):
    """Savings plan patch request.

    :ivar display_name: Display name.
    :vartype display_name: str
    :ivar applied_scope_type: Type of the Applied Scope. Known values are: "Single", "Shared", and
     "ManagementGroup".
    :vartype applied_scope_type: str or ~azure.mgmt.billingbenefits.models.AppliedScopeType
    :ivar applied_scope_properties: Properties specific to applied scope type. Not required if not
     applicable.
    :vartype applied_scope_properties: ~azure.mgmt.billingbenefits.models.AppliedScopeProperties
    :ivar renew: Setting this to true will automatically purchase a new benefit on the expiration
     date time.
    :vartype renew: bool
    :ivar renew_properties:
    :vartype renew_properties: ~azure.mgmt.billingbenefits.models.RenewProperties
    """

    display_name: Optional[str] = rest_field(
        name="displayName", visibility=["read", "create", "update", "delete", "query"]
    )
    """Display name."""
    applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = rest_field(
        name="appliedScopeType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of the Applied Scope. Known values are: \"Single\", \"Shared\", and \"ManagementGroup\"."""
    applied_scope_properties: Optional["_models.AppliedScopeProperties"] = rest_field(
        name="appliedScopeProperties", visibility=["read", "create", "update", "delete", "query"]
    )
    """Properties specific to applied scope type. Not required if not applicable."""
    renew: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Setting this to true will automatically purchase a new benefit on the expiration date time."""
    renew_properties: Optional["_models.RenewProperties"] = rest_field(
        name="renewProperties", visibility=["read", "create", "update", "delete", "query"]
    )

    @overload
    def __init__(
        self,
        *,
        display_name: Optional[str] = None,
        applied_scope_type: Optional[Union[str, "_models.AppliedScopeType"]] = None,
        applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None,
        renew: Optional[bool] = None,
        renew_properties: Optional["_models.RenewProperties"] = None,
    ) -> None: ...

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

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


class SavingsPlanUpdateValidateRequest(_Model):
    """SavingsPlanUpdateValidateRequest.

    :ivar benefits:
    :vartype benefits: list[~azure.mgmt.billingbenefits.models.SavingsPlanUpdateRequestProperties]
    """

    benefits: Optional[list["_models.SavingsPlanUpdateRequestProperties"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )

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

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

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


class SavingsPlanValidateModel(BenefitValidateModel, discriminator="SavingsPlan"):
    """Savings plan validate model.

    :ivar properties: Savings plan order alias properties.
    :vartype properties: ~azure.mgmt.billingbenefits.models.SavingsPlanOrderAliasProperties
    :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.billingbenefits.models.SystemData
    :ivar sku: Savings plan SKU. Required.
    :vartype sku: ~azure.mgmt.billingbenefits.models.ResourceSku
    :ivar kind: Resource provider kind.
    :vartype kind: str
    :ivar benefit_type: Type of benefit to validate. This is used to determine the model type for
     validation. Required. SAVINGS_PLAN.
    :vartype benefit_type: str or ~azure.mgmt.billingbenefits.models.SAVINGS_PLAN
    """

    properties: Optional["_models.SavingsPlanOrderAliasProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Savings plan order alias properties."""
    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."""
    sku: "_models.ResourceSku" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Savings plan SKU. Required."""
    kind: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource provider kind."""
    benefit_type: Literal[BenefitType.SAVINGS_PLAN] = rest_discriminator(name="benefitType", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of benefit to validate. This is used to determine the model type for validation. Required.
     SAVINGS_PLAN."""

    __flattened_items = [
        "display_name",
        "savings_plan_order_id",
        "provisioning_state",
        "billing_scope_id",
        "term",
        "billing_plan",
        "applied_scope_type",
        "applied_scope_properties",
        "commitment",
        "renew",
    ]

    @overload
    def __init__(
        self,
        *,
        sku: "_models.ResourceSku",
        properties: Optional["_models.SavingsPlanOrderAliasProperties"] = None,
        kind: 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:
        _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 SavingsPlanValidateResponse(_Model):
    """SavingsPlanValidateResponse.

    :ivar benefits:
    :vartype benefits: list[~azure.mgmt.billingbenefits.models.SavingsPlanValidResponseProperty]
    :ivar next_link: Url to get the next page.
    :vartype next_link: str
    """

    benefits: Optional[list["_models.SavingsPlanValidResponseProperty"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"])
    """Url to get the next page."""

    @overload
    def __init__(
        self,
        *,
        benefits: Optional[list["_models.SavingsPlanValidResponseProperty"]] = None,
        next_link: 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 SavingsPlanValidResponseProperty(_Model):
    """Benefit scope response property.

    :ivar valid: Indicates if the provided input was valid.
    :vartype valid: bool
    :ivar reason_code: Failure reason code if the provided input was invalid.
    :vartype reason_code: str
    :ivar reason: Failure reason if the provided input was invalid.
    :vartype reason: str
    """

    valid: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Indicates if the provided input was valid."""
    reason_code: Optional[str] = rest_field(
        name="reasonCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Failure reason code if the provided input was invalid."""
    reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Failure reason if the provided input was invalid."""

    @overload
    def __init__(
        self,
        *,
        valid: Optional[bool] = None,
        reason_code: Optional[str] = None,
        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 SellerResourceListRequest(_Model):
    """List MACCs under a billing account.

    :ivar properties: Request properties to list maccs under a billing account.
    :vartype properties: ~azure.mgmt.billingbenefits.models.SellerResourceListRequestProperties
    """

    properties: Optional["_models.SellerResourceListRequestProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Request properties to list maccs under a billing account."""

    __flattened_items = ["billing_account_resource_id", "filter", "contributors", "milestones", "primary_resource_id"]

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

    @overload
    def __init__(self, mapping: Mapping[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 SellerResourceListRequestProperties(_Model):
    """Request properties to list maccs under a billing account.

    :ivar billing_account_resource_id: Fully-qualified billing account resource identifier where
     the benefit is applied. Present only for Enterprise Agreement customers. Required.
    :vartype billing_account_resource_id: str
    :ivar filter: This is an OData expresssion to filter the list of MACCs based on the properties
     of MACC passed in the filter.
    :vartype filter: str
    :ivar contributors: Setting it to true will return the list of contributors associated with the
     MACC.
    :vartype contributors: bool
    :ivar milestones: Setting it to true will return the list of milestones associated with the
     MACC.
    :vartype milestones: bool
    :ivar primary_resource_id: Fully-qualified resource identifier of the primary MACC. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/maccs/{maccName}.
    :vartype primary_resource_id: str
    """

    billing_account_resource_id: str = rest_field(
        name="billingAccountResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified billing account resource identifier where the benefit is applied. Present only
     for Enterprise Agreement customers. Required."""
    filter: Optional[str] = rest_field(name="$filter", visibility=["read", "create", "update", "delete", "query"])
    """This is an OData expresssion to filter the list of MACCs based on the properties of MACC passed
     in the filter."""
    contributors: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Setting it to true will return the list of contributors associated with the MACC."""
    milestones: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Setting it to true will return the list of milestones associated with the MACC."""
    primary_resource_id: Optional[str] = rest_field(
        name="primaryResourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified resource identifier of the primary MACC. Format:
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/maccs/{maccName}."""

    @overload
    def __init__(
        self,
        *,
        billing_account_resource_id: str,
        filter: Optional[str] = None,  # pylint: disable=redefined-builtin
        contributors: Optional[bool] = None,
        milestones: Optional[bool] = None,
        primary_resource_id: Optional[str] = None,
    ) -> None: ...

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

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


class ServiceManagedIdentity(_Model):
    """Managed service identity (system assigned and/or user assigned identities).

    :ivar principal_id: The service principal ID of the system assigned identity. This property
     will only be provided for a system assigned identity.
    :vartype principal_id: str
    :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be
     provided for a system assigned identity.
    :vartype tenant_id: str
    :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types
     are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and
     "SystemAssigned,UserAssigned".
    :vartype type: str or ~azure.mgmt.billingbenefits.models.ServiceManagedIdentityType
    :ivar user_assigned_identities: The set of user assigned identities associated with the
     resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form:
     '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
     The dictionary values can be empty objects ({}) in requests.
    :vartype user_assigned_identities: dict[str,
     ~azure.mgmt.billingbenefits.models.UserAssignedIdentity]
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The service principal ID of the system assigned identity. This property will only be provided
     for a system assigned identity."""
    tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"])
    """The tenant ID of the system assigned identity. This property will only be provided for a system
     assigned identity."""
    type: Union[str, "_models.ServiceManagedIdentityType"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Type of managed service identity (where both SystemAssigned and UserAssigned types are
     allowed). Required. Known values are: \"None\", \"SystemAssigned\", \"UserAssigned\", and
     \"SystemAssigned,UserAssigned\"."""
    user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field(
        name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"]
    )
    """The set of user assigned identities associated with the resource. The userAssignedIdentities
     dictionary keys will be ARM resource ids in the form:
     '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
     The dictionary values can be empty objects ({}) in requests."""

    @overload
    def __init__(
        self,
        *,
        type: Union[str, "_models.ServiceManagedIdentityType"],
        user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None,
    ) -> None: ...

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

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


class Shortfall(_Model):
    """MACC shortfall.

    :ivar product_code: Represents catalog UPN.
    :vartype product_code: str
    :ivar charge: Shortfall amount with grain.
    :vartype charge: ~azure.mgmt.billingbenefits.models.Commitment
    :ivar start_at: Start DateTime.
    :vartype start_at: ~datetime.datetime
    :ivar end_at: End DateTime in UTC.
    :vartype end_at: ~datetime.datetime
    :ivar resource_id: Fully-qualified resource identifier of the credits associated with the
     shortfall.
    :vartype resource_id: str
    :ivar balance_version: Points to BalanceVersion document that indicates the remaining
     commitment balance when the credit was created.
    :vartype balance_version: float
    :ivar system_id: This is an identifier of the shortfall which will not change for its lifetime.
    :vartype system_id: str
    """

    product_code: Optional[str] = rest_field(name="productCode", visibility=["read", "create"])
    """Represents catalog UPN."""
    charge: Optional["_models.Commitment"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Shortfall amount with grain."""
    start_at: Optional[datetime.datetime] = rest_field(
        name="startAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start DateTime."""
    end_at: Optional[datetime.datetime] = rest_field(
        name="endAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End DateTime in UTC."""
    resource_id: Optional[str] = rest_field(
        name="resourceId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Fully-qualified resource identifier of the credits associated with the shortfall."""
    balance_version: Optional[float] = rest_field(
        name="balanceVersion", visibility=["read", "create", "update", "delete", "query"]
    )
    """Points to BalanceVersion document that indicates the remaining commitment balance when the
     credit was created."""
    system_id: Optional[str] = rest_field(name="systemId", visibility=["read", "create"])
    """This is an identifier of the shortfall which will not change for its lifetime."""

    @overload
    def __init__(
        self,
        *,
        product_code: Optional[str] = None,
        charge: Optional["_models.Commitment"] = None,
        start_at: Optional[datetime.datetime] = None,
        end_at: Optional[datetime.datetime] = None,
        resource_id: Optional[str] = None,
        balance_version: Optional[float] = None,
        system_id: Optional[str] = None,
    ) -> None: ...

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

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


class Sku(_Model):
    """The resource model definition representing SKU.

    :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required.
    :vartype name: str
    :ivar tier: This field is required to be implemented by the Resource Provider if the service
     has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic",
     "Standard", and "Premium".
    :vartype tier: str or ~azure.mgmt.billingbenefits.models.SkuTier
    :ivar size: The SKU size. When the name field is the combination of tier and some other value,
     this would be the standalone code.
    :vartype size: str
    :ivar family: If the service has different generations of hardware, for the same SKU, then that
     can be captured here.
    :vartype family: str
    :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included.
     If scale out/in is not possible for the resource this may be omitted.
    :vartype capacity: int
    """

    name: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name of the SKU. E.g. P3. It is typically a letter+number code. Required."""
    tier: Optional[Union[str, "_models.SkuTier"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """This field is required to be implemented by the Resource Provider if the service has more than
     one tier, but is not required on a PUT. Known values are: \"Free\", \"Basic\", \"Standard\",
     and \"Premium\"."""
    size: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The SKU size. When the name field is the combination of tier and some other value, this would
     be the standalone code."""
    family: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """If the service has different generations of hardware, for the same SKU, then that can be
     captured here."""
    capacity: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """If the SKU supports scale out/in then the capacity integer should be included. If scale out/in
     is not possible for the resource this may be omitted."""

    @overload
    def __init__(
        self,
        *,
        name: str,
        tier: Optional[Union[str, "_models.SkuTier"]] = None,
        size: Optional[str] = None,
        family: Optional[str] = None,
        capacity: Optional[int] = None,
    ) -> None: ...

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

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


class 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.billingbenefits.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.billingbenefits.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 UserAssignedIdentity(_Model):
    """User assigned identity properties.

    :ivar principal_id: The principal ID of the assigned identity.
    :vartype principal_id: str
    :ivar client_id: The client ID of the assigned identity.
    :vartype client_id: str
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The principal ID of the assigned identity."""
    client_id: Optional[str] = rest_field(name="clientId", visibility=["read"])
    """The client ID of the assigned identity."""


class Utilization(_Model):
    """Savings plan utilization.

    :ivar trend: The number of days trend for a savings plan.
    :vartype trend: str
    :ivar aggregates: The array of aggregates of a savings plan's utilization.
    :vartype aggregates: list[~azure.mgmt.billingbenefits.models.UtilizationAggregates]
    """

    trend: Optional[str] = rest_field(visibility=["read"])
    """The number of days trend for a savings plan."""
    aggregates: Optional[list["_models.UtilizationAggregates"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The array of aggregates of a savings plan's utilization."""

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

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

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


class UtilizationAggregates(_Model):
    """The aggregate values of savings plan utilization.

    :ivar grain: The grain of the aggregate.
    :vartype grain: float
    :ivar grain_unit: The grain unit of the aggregate.
    :vartype grain_unit: str
    :ivar value: The aggregate value.
    :vartype value: float
    :ivar value_unit: The aggregate value unit.
    :vartype value_unit: str
    """

    grain: Optional[float] = rest_field(visibility=["read"])
    """The grain of the aggregate."""
    grain_unit: Optional[str] = rest_field(name="grainUnit", visibility=["read"])
    """The grain unit of the aggregate."""
    value: Optional[float] = rest_field(visibility=["read"])
    """The aggregate value."""
    value_unit: Optional[str] = rest_field(name="valueUnit", visibility=["read"])
    """The aggregate value unit."""
