# 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.dimension_interface import DimensionInterface
from ...types.price import Price
from ...types.pricing_matrix_interface import PricingMatrixInterface
from ...types.pricing_metric_interface import PricingMetricInterface


class CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional(UniversalBaseModel):
    usage_based_rate_type: typing.Literal["dimensional"] = "dimensional"
    id: str
    code: str
    name: str
    description: str
    included_units: int
    pricing_metric: PricingMetricInterface
    dimensions: typing.List[DimensionInterface]
    pricing_matrix: PricingMatrixInterface

    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 CreateRateCardVersionRequestUsageBasedRatesItem_Simple(UniversalBaseModel):
    usage_based_rate_type: typing.Literal["simple"] = "simple"
    id: str
    code: str
    name: str
    description: str
    price: Price
    included_units: int
    pricing_metric: PricingMetricInterface

    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


CreateRateCardVersionRequestUsageBasedRatesItem = typing.Union[
    CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional, CreateRateCardVersionRequestUsageBasedRatesItem_Simple
]
