# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...types.create_dimension_interface import CreateDimensionInterface
from ...types.create_pricing_matrix_interface import CreatePricingMatrixInterface
from ...types.create_pricing_metric_interface import CreatePricingMetricInterface
from ...types.price import Price


class CreateRateCardRequestUsageBasedRatesItem_Dimensional(UniversalBaseModel):
    usage_based_rate_type: typing.Literal["dimensional"] = "dimensional"
    code: str
    name: str
    description: typing.Optional[str] = None
    included_units: typing.Optional[int] = None
    pricing_metric: CreatePricingMetricInterface
    dimensions: typing.List[CreateDimensionInterface]
    pricing_matrix: CreatePricingMatrixInterface

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class CreateRateCardRequestUsageBasedRatesItem_Simple(UniversalBaseModel):
    usage_based_rate_type: typing.Literal["simple"] = "simple"
    code: str
    name: str
    description: typing.Optional[str] = None
    price: Price
    included_units: typing.Optional[int] = None
    pricing_metric: CreatePricingMetricInterface

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


CreateRateCardRequestUsageBasedRatesItem = typing.Union[
    CreateRateCardRequestUsageBasedRatesItem_Dimensional, CreateRateCardRequestUsageBasedRatesItem_Simple
]
