# 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, Union
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class PlayerSignUpRequest(BaseModel):
    """
    PlayerSignUpRequest
    """ # noqa: E501
    full_name: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="fullName")
    first_name: StrictStr = Field(alias="firstName")
    last_name: StrictStr = Field(alias="lastName")
    email: Annotated[str, Field(min_length=1, strict=True)]
    iso_code: Optional[StrictStr] = Field(default=None, alias="isoCode")
    phone: Optional[StrictStr] = None
    password: Annotated[str, Field(min_length=1, strict=True)]
    ambassador_code: Optional[StrictStr] = Field(default=None, alias="ambassadorCode")
    media_id: Optional[StrictInt] = Field(default=None, alias="mediaId")
    gender: StrictStr
    birthdate: date
    address_id: StrictInt = Field(alias="addressId")
    hand: StrictStr
    singles_rating: Optional[Union[Annotated[float, Field(le=8.0, strict=True, ge=0.1)], Annotated[int, Field(le=8, strict=True, ge=1)]]] = Field(default=None, alias="singlesRating")
    doubles_rating: Optional[Union[Annotated[float, Field(le=8.0, strict=True, ge=0.1)], Annotated[int, Field(le=8, strict=True, ge=1)]]] = Field(default=None, alias="doublesRating")
    default_rating: Optional[StrictStr] = Field(default=None, alias="defaultRating")
    enable_newsletter: StrictBool = Field(alias="enableNewsletter")
    username: Optional[StrictStr] = None
    user_id: Optional[StrictInt] = Field(default=None, alias="userId")
    client_key: Optional[StrictStr] = Field(default=None, alias="clientKey")
    identifier: Optional[StrictStr] = Field(default=None, description="An unique identifier of this user from your platform")
    marketing_opt_in: Optional[StrictBool] = Field(default=None, alias="marketingOptIn")
    terms_of_service: Optional[StrictBool] = Field(default=None, alias="termsOfService")
    __properties: ClassVar[List[str]] = ["fullName", "firstName", "lastName", "email", "isoCode", "phone", "password", "ambassadorCode", "mediaId", "gender", "birthdate", "addressId", "hand", "singlesRating", "doublesRating", "defaultRating", "enableNewsletter", "username", "userId", "clientKey", "identifier", "marketingOptIn", "termsOfService"]

    @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 is None:
            return value

        if value not in set(['SINGLES', 'DOUBLES']):
            raise ValueError("must be one of enum values ('SINGLES', 'DOUBLES')")
        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 PlayerSignUpRequest 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 PlayerSignUpRequest 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"),
            "email": obj.get("email"),
            "isoCode": obj.get("isoCode"),
            "phone": obj.get("phone"),
            "password": obj.get("password"),
            "ambassadorCode": obj.get("ambassadorCode"),
            "mediaId": obj.get("mediaId"),
            "gender": obj.get("gender"),
            "birthdate": obj.get("birthdate"),
            "addressId": obj.get("addressId"),
            "hand": obj.get("hand"),
            "singlesRating": obj.get("singlesRating"),
            "doublesRating": obj.get("doublesRating"),
            "defaultRating": obj.get("defaultRating"),
            "enableNewsletter": obj.get("enableNewsletter"),
            "username": obj.get("username"),
            "userId": obj.get("userId"),
            "clientKey": obj.get("clientKey"),
            "identifier": obj.get("identifier"),
            "marketingOptIn": obj.get("marketingOptIn"),
            "termsOfService": obj.get("termsOfService")
        })
        return _obj


