# coding: utf-8

"""
    DUPR Backend APIs

    Internal RESTful APIs to access DUPR ratings, users and provide matches.

    The version of the OpenAPI document: v1.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 datetime import date
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class PlayerProfileRequest(BaseModel):
    """
    PlayerProfileRequest
    """ # noqa: E501
    full_name: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="fullName")
    first_name: Optional[StrictStr] = Field(default=None, alias="firstName")
    last_name: Optional[StrictStr] = Field(default=None, alias="lastName")
    iso_code: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="isoCode")
    phone: Optional[StrictStr] = None
    username: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=25)]] = None
    display_username: Optional[StrictBool] = Field(default=None, alias="displayUsername")
    gender: StrictStr
    birthdate: date
    hand: StrictStr
    default_rating: StrictStr = Field(alias="defaultRating")
    address_id: StrictInt = Field(alias="addressId")
    media_id: Optional[StrictInt] = Field(default=None, alias="mediaId")
    paddle_brand: Optional[StrictStr] = Field(default=None, alias="paddleBrand")
    shoe_brand: Optional[StrictStr] = Field(default=None, alias="shoeBrand")
    apparel_brand: Optional[StrictStr] = Field(default=None, alias="apparelBrand")
    preferred_ball: Optional[StrictStr] = Field(default=None, alias="preferredBall")
    preferred_side: Optional[StrictStr] = Field(default=None, alias="preferredSide")
    place_id: Optional[StrictStr] = Field(default=None, alias="placeId")
    is_valid_phone: Optional[StrictBool] = Field(default=None, alias="isValidPhone")
    __properties: ClassVar[List[str]] = ["fullName", "firstName", "lastName", "isoCode", "phone", "username", "displayUsername", "gender", "birthdate", "hand", "defaultRating", "addressId", "mediaId", "paddleBrand", "shoeBrand", "apparelBrand", "preferredBall", "preferredSide", "placeId", "isValidPhone"]

    @field_validator('gender')
    def gender_validate_enum(cls, value):
        """Validates the enum"""
        if value not in set(['MALE', 'FEMALE']):
            raise ValueError("must be one of enum values ('MALE', 'FEMALE')")
        return value

    @field_validator('hand')
    def hand_validate_enum(cls, value):
        """Validates the enum"""
        if value not in set(['RIGHT', 'LEFT', 'BOTH', 'NONE']):
            raise ValueError("must be one of enum values ('RIGHT', 'LEFT', 'BOTH', 'NONE')")
        return value

    @field_validator('default_rating')
    def default_rating_validate_enum(cls, value):
        """Validates the enum"""
        if value not in set(['SINGLES', 'DOUBLES']):
            raise ValueError("must be one of enum values ('SINGLES', 'DOUBLES')")
        return value

    @field_validator('preferred_side')
    def preferred_side_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['RIGHT', 'LEFT', 'EITHER']):
            raise ValueError("must be one of enum values ('RIGHT', 'LEFT', 'EITHER')")
        return value

    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 PlayerProfileRequest 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "fullName": obj.get("fullName"),
            "firstName": obj.get("firstName"),
            "lastName": obj.get("lastName"),
            "isoCode": obj.get("isoCode"),
            "phone": obj.get("phone"),
            "username": obj.get("username"),
            "displayUsername": obj.get("displayUsername"),
            "gender": obj.get("gender"),
            "birthdate": obj.get("birthdate"),
            "hand": obj.get("hand"),
            "defaultRating": obj.get("defaultRating"),
            "addressId": obj.get("addressId"),
            "mediaId": obj.get("mediaId"),
            "paddleBrand": obj.get("paddleBrand"),
            "shoeBrand": obj.get("shoeBrand"),
            "apparelBrand": obj.get("apparelBrand"),
            "preferredBall": obj.get("preferredBall"),
            "preferredSide": obj.get("preferredSide"),
            "placeId": obj.get("placeId"),
            "isValidPhone": obj.get("isValidPhone")
        })
        return _obj


