# 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 datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional, Union
from dupr_backend.models.account_status_response import AccountStatusResponse
from dupr_backend.models.address_response import AddressResponse
from dupr_backend.models.club_role_response import ClubRoleResponse
from dupr_backend.models.club_type_response import ClubTypeResponse
from dupr_backend.models.content_response import ContentResponse
from dupr_backend.models.currency_details_response import CurrencyDetailsResponse
from typing import Optional, Set
from typing_extensions import Self

class ClubResponse(BaseModel):
    """
    ClubResponse
    """ # noqa: E501
    club_id: StrictInt = Field(alias="clubId")
    club_name: StrictStr = Field(alias="clubName")
    club_type: ClubTypeResponse = Field(alias="clubType")
    media_url: Optional[StrictStr] = Field(default=None, alias="mediaUrl")
    address: Optional[AddressResponse] = None
    short_address: Optional[StrictStr] = Field(default=None, alias="shortAddress")
    club_member_count: StrictInt = Field(alias="clubMemberCount")
    manifest: Optional[ContentResponse] = None
    short_description: Optional[ContentResponse] = Field(default=None, alias="shortDescription")
    long_description: Optional[ContentResponse] = Field(default=None, alias="longDescription")
    attributes: Optional[Dict[str, Any]] = None
    role: Optional[ClubRoleResponse] = None
    is_payment_setup: Optional[StrictBool] = Field(default=None, alias="isPaymentSetup")
    account_status: Optional[AccountStatusResponse] = Field(default=None, alias="accountStatus")
    model_type: Optional[StrictStr] = Field(default=None, alias="modelType")
    model_value: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="modelValue")
    currency_details: Optional[CurrencyDetailsResponse] = Field(default=None, alias="currencyDetails")
    created: Optional[datetime] = None
    requested_by: Optional[StrictInt] = Field(default=None, alias="requestedBy")
    club_join_type: Optional[StrictStr] = Field(default=None, alias="clubJoinType")
    pending_request_list: Optional[List[StrictInt]] = Field(default=None, alias="pendingRequestList")
    distance_in_miles: Union[StrictFloat, StrictInt] = Field(alias="distanceInMiles")
    __properties: ClassVar[List[str]] = ["clubId", "clubName", "clubType", "mediaUrl", "address", "shortAddress", "clubMemberCount", "manifest", "shortDescription", "longDescription", "attributes", "role", "isPaymentSetup", "accountStatus", "modelType", "modelValue", "currencyDetails", "created", "requestedBy", "clubJoinType", "pendingRequestList", "distanceInMiles"]

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

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

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

        if value not in set(['INVITATION', 'REQUEST', 'INVITATION_CSV', 'PARTNER_INVITE']):
            raise ValueError("must be one of enum values ('INVITATION', 'REQUEST', 'INVITATION_CSV', 'PARTNER_INVITE')")
        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 ClubResponse 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,
        )
        # override the default output from pydantic by calling `to_dict()` of club_type
        if self.club_type:
            _dict['clubType'] = self.club_type.to_dict()
        # override the default output from pydantic by calling `to_dict()` of address
        if self.address:
            _dict['address'] = self.address.to_dict()
        # override the default output from pydantic by calling `to_dict()` of manifest
        if self.manifest:
            _dict['manifest'] = self.manifest.to_dict()
        # override the default output from pydantic by calling `to_dict()` of short_description
        if self.short_description:
            _dict['shortDescription'] = self.short_description.to_dict()
        # override the default output from pydantic by calling `to_dict()` of long_description
        if self.long_description:
            _dict['longDescription'] = self.long_description.to_dict()
        # override the default output from pydantic by calling `to_dict()` of role
        if self.role:
            _dict['role'] = self.role.to_dict()
        # override the default output from pydantic by calling `to_dict()` of account_status
        if self.account_status:
            _dict['accountStatus'] = self.account_status.to_dict()
        # override the default output from pydantic by calling `to_dict()` of currency_details
        if self.currency_details:
            _dict['currencyDetails'] = self.currency_details.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "clubId": obj.get("clubId"),
            "clubName": obj.get("clubName"),
            "clubType": ClubTypeResponse.from_dict(obj["clubType"]) if obj.get("clubType") is not None else None,
            "mediaUrl": obj.get("mediaUrl"),
            "address": AddressResponse.from_dict(obj["address"]) if obj.get("address") is not None else None,
            "shortAddress": obj.get("shortAddress"),
            "clubMemberCount": obj.get("clubMemberCount"),
            "manifest": ContentResponse.from_dict(obj["manifest"]) if obj.get("manifest") is not None else None,
            "shortDescription": ContentResponse.from_dict(obj["shortDescription"]) if obj.get("shortDescription") is not None else None,
            "longDescription": ContentResponse.from_dict(obj["longDescription"]) if obj.get("longDescription") is not None else None,
            "attributes": obj.get("attributes"),
            "role": ClubRoleResponse.from_dict(obj["role"]) if obj.get("role") is not None else None,
            "isPaymentSetup": obj.get("isPaymentSetup"),
            "accountStatus": AccountStatusResponse.from_dict(obj["accountStatus"]) if obj.get("accountStatus") is not None else None,
            "modelType": obj.get("modelType"),
            "modelValue": obj.get("modelValue"),
            "currencyDetails": CurrencyDetailsResponse.from_dict(obj["currencyDetails"]) if obj.get("currencyDetails") is not None else None,
            "created": obj.get("created"),
            "requestedBy": obj.get("requestedBy"),
            "clubJoinType": obj.get("clubJoinType"),
            "pendingRequestList": obj.get("pendingRequestList"),
            "distanceInMiles": obj.get("distanceInMiles")
        })
        return _obj


