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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .amount import Amount
from .invoice_line_item_resource import InvoiceLineItemResource
from .invoice_status import InvoiceStatus


class InvoiceResource(UniversalBaseModel):
    id: str = pydantic.Field()
    """
    The ID of the invoice.
    """

    total_amount: Amount = pydantic.Field()
    """
    The total amount of the invoice.
    """

    subject_id: str = pydantic.Field()
    """
    The ID of the subject for the invoice.
    """

    created_at: dt.datetime = pydantic.Field()
    """
    The date and time the invoice was created.
    """

    status: InvoiceStatus = pydantic.Field()
    """
    The status of the invoice.
    """

    hosted_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL of the hosted invoice.
    """

    line_items: typing.List[InvoiceLineItemResource] = pydantic.Field()
    """
    The line items of the invoice.
    """

    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
