# coding: utf-8

"""
    FlowHunt

    FlowHunt API

    The version of the OpenAPI document: 2.0.0
    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, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from flowhunt.models.pointer_type import PointerType
from flowhunt.models.vector_document_type import VectorDocumentType
from typing import Optional, Set
from typing_extensions import Self

class QuerySimilarityTaskRequest(BaseModel):
    """
    QuerySimilarityTaskRequest
    """ # noqa: E501
    post_back_url: Optional[StrictStr] = None
    document_type: Optional[VectorDocumentType] = None
    pointer_type: Optional[PointerType] = None
    schema_type: Optional[StrictStr] = None
    limit: Optional[StrictInt] = None
    score_trheshold: Optional[Union[StrictFloat, StrictInt]] = None
    with_vectors: Optional[StrictBool] = None
    pointer_position_from: Optional[StrictInt] = None
    pointer_position_to: Optional[StrictInt] = None
    vector_id_from: Optional[StrictInt] = None
    vector_id_to: Optional[StrictInt] = None
    filter_url: Optional[StrictStr] = None
    filter_domains: Optional[List[StrictStr]] = None
    query: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["post_back_url", "document_type", "pointer_type", "schema_type", "limit", "score_trheshold", "with_vectors", "pointer_position_from", "pointer_position_to", "vector_id_from", "vector_id_to", "filter_url", "filter_domains", "query"]

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "post_back_url": obj.get("post_back_url"),
            "document_type": obj.get("document_type"),
            "pointer_type": obj.get("pointer_type"),
            "schema_type": obj.get("schema_type"),
            "limit": obj.get("limit"),
            "score_trheshold": obj.get("score_trheshold"),
            "with_vectors": obj.get("with_vectors"),
            "pointer_position_from": obj.get("pointer_position_from"),
            "pointer_position_to": obj.get("pointer_position_to"),
            "vector_id_from": obj.get("vector_id_from"),
            "vector_id_to": obj.get("vector_id_to"),
            "filter_url": obj.get("filter_url"),
            "filter_domains": obj.get("filter_domains"),
            "query": obj.get("query")
        })
        return _obj


