# coding: utf-8

"""
    用户全部 API 文档

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

    The version of the OpenAPI document: v1
    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, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self

class RecommendFriend(BaseModel):
    """
    RecommendFriend
    """ # noqa: E501
    user_id: Optional[StrictInt] = Field(default=None, description="用户ID", alias="userID")
    nick_name: Optional[StrictStr] = Field(default=None, description="昵称", alias="nickName")
    avatar: Optional[StrictStr] = Field(default=None, description="头像")
    gender: Optional[StrictStr] = Field(default=None, description="性别")
    age: Optional[StrictInt] = Field(default=None, description="年龄")
    interest_tags: Optional[StrictStr] = Field(default=None, description="兴趣标签", alias="interestTags")
    location_name: Optional[StrictStr] = Field(default=None, description="位置名称", alias="locationName")
    latitude: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="纬度")
    longitude: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="经度")
    distance: Optional[StrictInt] = Field(default=None, description="距离")
    biography: Optional[StrictStr] = Field(default=None, description="个人简介")
    country: Optional[StrictStr] = Field(default=None, description="国家")
    state: Optional[StrictStr] = Field(default=None, description="省份")
    city: Optional[StrictStr] = Field(default=None, description="城市")
    district: Optional[StrictStr] = Field(default=None, description="区县")
    __properties: ClassVar[List[str]] = ["userID", "nickName", "avatar", "gender", "age", "interestTags", "locationName", "latitude", "longitude", "distance", "biography", "country", "state", "city", "district"]

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "userID": obj.get("userID"),
            "nickName": obj.get("nickName"),
            "avatar": obj.get("avatar"),
            "gender": obj.get("gender"),
            "age": obj.get("age"),
            "interestTags": obj.get("interestTags"),
            "locationName": obj.get("locationName"),
            "latitude": obj.get("latitude"),
            "longitude": obj.get("longitude"),
            "distance": obj.get("distance"),
            "biography": obj.get("biography"),
            "country": obj.get("country"),
            "state": obj.get("state"),
            "city": obj.get("city"),
            "district": obj.get("district")
        })
        return _obj


