# coding: utf-8

"""
    smritea SDK API

    Public SDK API for smritea AI memory system — programmatic memory operations via API key

    The version of the OpenAPI document: 1.0.0
    Contact: support@smritea.ai
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from smritea._internal.autogen.smritea_cloud_sdk.models.commondto_relative_standing_config import CommondtoRelativeStandingConfig
from typing import Optional, Set
from typing_extensions import Self

class MemoryMemoryResponse(BaseModel):
    """
    MemoryMemoryResponse
    """ # noqa: E501
    active_from: Optional[StrictStr] = None
    active_to: Optional[StrictStr] = None
    actor_id: Optional[StrictStr] = None
    actor_name: Optional[StrictStr] = None
    actor_type: Optional[StrictStr] = None
    app_id: Optional[StrictStr] = None
    content: Optional[StrictStr] = None
    conversation_id: Optional[StrictStr] = None
    conversation_message_id: Optional[StrictStr] = None
    created_at: Optional[StrictStr] = None
    id: Optional[StrictStr] = None
    metadata: Optional[Dict[str, Any]] = None
    relative_standing: Optional[CommondtoRelativeStandingConfig] = None
    updated_at: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["active_from", "active_to", "actor_id", "actor_name", "actor_type", "app_id", "content", "conversation_id", "conversation_message_id", "created_at", "id", "metadata", "relative_standing", "updated_at"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of MemoryMemoryResponse from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of relative_standing
        if self.relative_standing:
            _dict['relative_standing'] = self.relative_standing.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of MemoryMemoryResponse from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "active_from": obj.get("active_from"),
            "active_to": obj.get("active_to"),
            "actor_id": obj.get("actor_id"),
            "actor_name": obj.get("actor_name"),
            "actor_type": obj.get("actor_type"),
            "app_id": obj.get("app_id"),
            "content": obj.get("content"),
            "conversation_id": obj.get("conversation_id"),
            "conversation_message_id": obj.get("conversation_message_id"),
            "created_at": obj.get("created_at"),
            "id": obj.get("id"),
            "metadata": obj.get("metadata"),
            "relative_standing": CommondtoRelativeStandingConfig.from_dict(obj["relative_standing"]) if obj.get("relative_standing") is not None else None,
            "updated_at": obj.get("updated_at")
        })
        return _obj


