# 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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self

class GeoLocationResponseModel(BaseModel):
    """
    GeoLocationResponseModel
    """ # noqa: E501
    latitude: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="纬度")
    longitude: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="经度")
    location_name: Optional[StrictStr] = Field(default=None, description="地点的名称", alias="locationName")
    location_type: Optional[StrictStr] = Field(default=None, description="地点的类型，如家庭、工作、学校等", alias="locationType")
    recipient_name: Optional[StrictStr] = Field(default=None, description="收货人姓名", alias="recipientName")
    phone_number: Optional[StrictStr] = Field(default=None, description="收货人联系电话", alias="phoneNumber")
    email: 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="区/县")
    street: Optional[StrictStr] = Field(default=None, description="街道")
    zip_code: Optional[StrictStr] = Field(default=None, description="邮政编码", alias="zipCode")
    address: Optional[StrictStr] = Field(default=None, description="详细的地址信息")
    map_type: Optional[StrictStr] = Field(default=None, description="地址类型，百度、高德、谷歌", alias="mapType")
    remark: Optional[StrictStr] = Field(default=None, description="备注")
    tags: Optional[StrictStr] = Field(default=None, description="标签")
    enable: Optional[StrictBool] = Field(default=None, description="启用")
    show_index: Optional[StrictInt] = Field(default=None, description="排序", alias="showIndex")
    create_date: Optional[datetime] = Field(default=None, description="创建时间", alias="createDate")
    last_update: Optional[datetime] = Field(default=None, description="最后更新的时间", alias="lastUpdate")
    id: Optional[StrictInt] = Field(default=None, description="ID")
    __properties: ClassVar[List[str]] = ["latitude", "longitude", "locationName", "locationType", "recipientName", "phoneNumber", "email", "country", "state", "city", "district", "street", "zipCode", "address", "mapType", "remark", "tags", "enable", "showIndex", "createDate", "lastUpdate", "id"]

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "latitude": obj.get("latitude"),
            "longitude": obj.get("longitude"),
            "locationName": obj.get("locationName"),
            "locationType": obj.get("locationType"),
            "recipientName": obj.get("recipientName"),
            "phoneNumber": obj.get("phoneNumber"),
            "email": obj.get("email"),
            "country": obj.get("country"),
            "state": obj.get("state"),
            "city": obj.get("city"),
            "district": obj.get("district"),
            "street": obj.get("street"),
            "zipCode": obj.get("zipCode"),
            "address": obj.get("address"),
            "mapType": obj.get("mapType"),
            "remark": obj.get("remark"),
            "tags": obj.get("tags"),
            "enable": obj.get("enable"),
            "showIndex": obj.get("showIndex"),
            "createDate": obj.get("createDate"),
            "lastUpdate": obj.get("lastUpdate"),
            "id": obj.get("id")
        })
        return _obj


