# coding: utf-8

"""
    Kubernetes

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

    The version of the OpenAPI document: release-1.29
    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 typing import Dict, List, Optional
from pydantic import BaseModel, Field, StrictStr, conlist

class V1UserInfo(BaseModel):
    """
    UserInfo holds the information about the user needed to implement the user.Info interface.  # noqa: E501
    """
    extra: Optional[Dict[str, conlist(StrictStr)]] = Field(None, description="Any additional information provided by the authenticator.")
    groups: Optional[conlist(StrictStr)] = Field(None, description="The names of groups this user is a part of.")
    uid: Optional[StrictStr] = Field(None, description="A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.")
    username: Optional[StrictStr] = Field(None, description="The name that uniquely identifies this user among all active users.")
    __properties = ["extra", "groups", "uid", "username"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> V1UserInfo:
        """Create an instance of V1UserInfo from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of each value in extra (dict of array)
        _field_dict_of_array = {}
        if self.extra:
            for _key in self.extra:
                if self.extra[_key]:
                    _field_dict_of_array[_key] = [
                        _item.to_dict() for _item in self.extra[_key]
                    ]
            _dict['extra'] = _field_dict_of_array
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> V1UserInfo:
        """Create an instance of V1UserInfo from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return V1UserInfo.parse_obj(obj)

        _obj = V1UserInfo.parse_obj({
            "extra": obj.get("extra"),
            "groups": obj.get("groups"),
            "uid": obj.get("uid"),
            "username": obj.get("username")
        })
        return _obj


