# 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 .rule_summary import RuleSummary


class AttachmentResponse(UniversalBaseModel):
    """
    Response schema for attachment.
    """

    id: str = pydantic.Field()
    """
    Attachment ID with ratt_ prefix
    """

    rule_id: str = pydantic.Field()
    """
    Rule ID
    """

    entity_type: str = pydantic.Field()
    """
    Entity type
    """

    entity_id: str = pydantic.Field()
    """
    Entity ID
    """

    priority: int = pydantic.Field()
    """
    Priority (1-100)
    """

    character_limit: typing.Optional[int] = pydantic.Field(default=None)
    """
    Character limit
    """

    attached_by: str = pydantic.Field()
    """
    User ID who attached the entity
    """

    attached_at: int = pydantic.Field()
    """
    Unix timestamp of attachment
    """

    is_active: bool = pydantic.Field()
    """
    Whether attachment is active
    """

    created_at: dt.datetime = pydantic.Field()
    """
    Creation timestamp
    """

    updated_at: dt.datetime = pydantic.Field()
    """
    Last update timestamp
    """

    rule_summary: typing.Optional[RuleSummary] = pydantic.Field(default=None)
    """
    Summary of the attached rule
    """

    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
