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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ......core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .....commons.types.claim_id import ClaimId
from .....commons.types.service_line_id import ServiceLineId


class InvoiceItemAttributionCreate_ServiceLineId(UniversalBaseModel):
    value: ServiceLineId
    type: typing.Literal["service_line_id"] = "service_line_id"

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

        class Config:
            frozen = True
            smart_union = True


class InvoiceItemAttributionCreate_ClaimId(UniversalBaseModel):
    value: ClaimId
    type: typing.Literal["claim_id"] = "claim_id"

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

        class Config:
            frozen = True
            smart_union = True


class InvoiceItemAttributionCreate_Unattributed(UniversalBaseModel):
    """
    Points to the claim or service line that this invoice is attributed to
    """

    type: typing.Literal["unattributed"] = "unattributed"

    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


InvoiceItemAttributionCreate = typing_extensions.Annotated[
    typing.Union[
        InvoiceItemAttributionCreate_ServiceLineId,
        InvoiceItemAttributionCreate_ClaimId,
        InvoiceItemAttributionCreate_Unattributed,
    ],
    pydantic.Field(discriminator="type"),
]
