# coding: utf-8

"""
    GoodMem API

    API for interacting with the GoodMem service, providing vector-based memory storage and retrieval with multiple embedder support. The service enables creation of memory spaces, storing memories with vector representations, and efficient similarity-based retrieval.

    The version of the OpenAPI document: v1
    Contact: support@goodmem.io
    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, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from goodmem_client.models.distribution_type import DistributionType
from goodmem_client.models.modality import Modality
from goodmem_client.models.provider_type import ProviderType
from typing import Optional, Set
from typing_extensions import Self

class EmbedderResponse(BaseModel):
    """
    Embedder configuration information
    """ # noqa: E501
    embedder_id: StrictStr = Field(description="Unique identifier of the embedder", alias="embedderId")
    display_name: StrictStr = Field(description="User-facing name of the embedder", alias="displayName")
    description: Optional[StrictStr] = Field(default=None, description="Description of the embedder")
    provider_type: ProviderType = Field(alias="providerType")
    endpoint_url: StrictStr = Field(description="API endpoint URL", alias="endpointUrl")
    api_path: StrictStr = Field(description="API path for embeddings request", alias="apiPath")
    model_identifier: StrictStr = Field(description="Model identifier", alias="modelIdentifier")
    dimensionality: StrictInt = Field(description="Output vector dimensions")
    distribution_type: DistributionType = Field(alias="distributionType")
    max_sequence_length: Optional[StrictInt] = Field(default=None, description="Maximum input sequence length", alias="maxSequenceLength")
    supported_modalities: Optional[List[Modality]] = Field(default=None, description="Supported content modalities", alias="supportedModalities")
    labels: Optional[Dict[str, StrictStr]] = Field(default=None, description="User-defined labels for categorization")
    version: Optional[StrictStr] = Field(default=None, description="Version information")
    monitoring_endpoint: Optional[StrictStr] = Field(default=None, description="Monitoring endpoint URL", alias="monitoringEndpoint")
    owner_id: StrictStr = Field(description="Owner ID of the embedder", alias="ownerId")
    created_at: StrictInt = Field(description="Creation timestamp (milliseconds since epoch)", alias="createdAt")
    updated_at: StrictInt = Field(description="Last update timestamp (milliseconds since epoch)", alias="updatedAt")
    created_by_id: StrictStr = Field(description="ID of the user who created the embedder", alias="createdById")
    updated_by_id: StrictStr = Field(description="ID of the user who last updated the embedder", alias="updatedById")
    __properties: ClassVar[List[str]] = ["embedderId", "displayName", "description", "providerType", "endpointUrl", "apiPath", "modelIdentifier", "dimensionality", "distributionType", "maxSequenceLength", "supportedModalities", "labels", "version", "monitoringEndpoint", "ownerId", "createdAt", "updatedAt", "createdById", "updatedById"]

    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 EmbedderResponse 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,
        )
        # set to None if description (nullable) is None
        # and model_fields_set contains the field
        if self.description is None and "description" in self.model_fields_set:
            _dict['description'] = None

        # set to None if max_sequence_length (nullable) is None
        # and model_fields_set contains the field
        if self.max_sequence_length is None and "max_sequence_length" in self.model_fields_set:
            _dict['maxSequenceLength'] = None

        # set to None if supported_modalities (nullable) is None
        # and model_fields_set contains the field
        if self.supported_modalities is None and "supported_modalities" in self.model_fields_set:
            _dict['supportedModalities'] = None

        # set to None if labels (nullable) is None
        # and model_fields_set contains the field
        if self.labels is None and "labels" in self.model_fields_set:
            _dict['labels'] = None

        # set to None if version (nullable) is None
        # and model_fields_set contains the field
        if self.version is None and "version" in self.model_fields_set:
            _dict['version'] = None

        # set to None if monitoring_endpoint (nullable) is None
        # and model_fields_set contains the field
        if self.monitoring_endpoint is None and "monitoring_endpoint" in self.model_fields_set:
            _dict['monitoringEndpoint'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "embedderId": obj.get("embedderId"),
            "displayName": obj.get("displayName"),
            "description": obj.get("description"),
            "providerType": obj.get("providerType"),
            "endpointUrl": obj.get("endpointUrl"),
            "apiPath": obj.get("apiPath"),
            "modelIdentifier": obj.get("modelIdentifier"),
            "dimensionality": obj.get("dimensionality"),
            "distributionType": obj.get("distributionType"),
            "maxSequenceLength": obj.get("maxSequenceLength"),
            "supportedModalities": obj.get("supportedModalities"),
            "labels": obj.get("labels"),
            "version": obj.get("version"),
            "monitoringEndpoint": obj.get("monitoringEndpoint"),
            "ownerId": obj.get("ownerId"),
            "createdAt": obj.get("createdAt"),
            "updatedAt": obj.get("updatedAt"),
            "createdById": obj.get("createdById"),
            "updatedById": obj.get("updatedById")
        })
        return _obj


