# coding: utf-8

"""
    FastAPI

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 0.1.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 typing import Optional
from pydantic import BaseModel, StrictInt, StrictStr

class SearchStudy(BaseModel):
    """
    SearchStudy
    """
    author_name_fragment: Optional[StrictStr] = None
    accession_id: Optional[StrictStr] = None
    file_references_count_lte: Optional[StrictInt] = None
    file_references_count_gte: Optional[StrictInt] = None
    images_count_lte: Optional[StrictInt] = None
    images_count_gte: Optional[StrictInt] = None
    tag: Optional[StrictStr] = None
    __properties = ["author_name_fragment", "accession_id", "file_references_count_lte", "file_references_count_gte", "images_count_lte", "images_count_gte", "tag"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

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

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # set to None if author_name_fragment (nullable) is None
        # and __fields_set__ contains the field
        if self.author_name_fragment is None and "author_name_fragment" in self.__fields_set__:
            _dict['author_name_fragment'] = None

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

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

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

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> SearchStudy:
        """Create an instance of SearchStudy from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return SearchStudy.parse_obj(obj)

        _obj = SearchStudy.parse_obj({
            "author_name_fragment": obj.get("author_name_fragment"),
            "accession_id": obj.get("accession_id"),
            "file_references_count_lte": obj.get("file_references_count_lte"),
            "file_references_count_gte": obj.get("file_references_count_gte"),
            "images_count_lte": obj.get("images_count_lte"),
            "images_count_gte": obj.get("images_count_gte"),
            "tag": obj.get("tag")
        })
        return _obj


