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

from ......core.pydantic_utilities import UniversalBaseModel
from .....commons.types.rate_id import RateId
import pydantic
import typing
from .rate_entry import RateEntry
from ......core.pydantic_utilities import IS_PYDANTIC_V2


class NewRateVersion(UniversalBaseModel):
    rate_id: RateId
    previous_version: int = pydantic.Field()
    """
    New versions of rates must indicate the exact version they modify. When the system attempts to save this new version, if the latest version in the system does not equal this previos_version, the request will be rejected with a EntityConflictError.
    """

    entries: typing.List[RateEntry]

    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
