# 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


class MemoryDetailResponse(UniversalBaseModel):
    """
    Full memory response with source tracking (single GET only).
    """

    id: str = pydantic.Field()
    """
    Memory ID (mem_ prefix)
    """

    content: str = pydantic.Field()
    """
    The memory text
    """

    category: str = pydantic.Field()
    """
    Memory category: fact, preference, instruction, context, biographical
    """

    scope: str = pydantic.Field()
    """
    Memory scope: global or organization
    """

    organization_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Organization ID if scope is organization
    """

    source_type: str = pydantic.Field()
    """
    How the memory was created: auto_extracted, user_created, consolidated
    """

    is_pinned: bool = pydantic.Field()
    """
    Whether the memory is pinned (prioritized)
    """

    confidence: float = pydantic.Field()
    """
    Confidence score 0.0-1.0
    """

    created_at: dt.datetime
    updated_at: dt.datetime
    last_accessed_at: typing.Optional[dt.datetime] = None
    source_thread_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Thread where memory was extracted
    """

    source_message_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Message that triggered extraction
    """

    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
