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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class InvoiceAttachment(UncheckedBaseModel):
    """
    Represents a file attached to an [invoice](entity:Invoice).
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Square-assigned ID of the attachment.
    """

    filename: typing.Optional[str] = pydantic.Field(default=None)
    """
    The file name of the attachment, which is displayed on the invoice.
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    The description of the attachment, which is displayed on the invoice.
    This field maps to the seller-defined **Message** field.
    """

    filesize: typing.Optional[int] = pydantic.Field(default=None)
    """
    The file size of the attachment in bytes.
    """

    hash: typing.Optional[str] = pydantic.Field(default=None)
    """
    The MD5 hash that was generated from the file contents.
    """

    mime_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    The mime type of the attachment.
    The following mime types are supported: 
    image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf.
    """

    uploaded_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp when the attachment was uploaded, in RFC 3339 format.
    """

    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
