# 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 Optional
from pydantic import BaseModel, Field, StrictStr

class V1StatusCause(BaseModel):
    """
    StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.  # noqa: E501
    """
    field: Optional[StrictStr] = Field(None, description="The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed.  Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.  Examples:   \"name\" - the field \"name\" on the current resource   \"items[0].name\" - the field \"name\" on the first array entry in \"items\"")
    message: Optional[StrictStr] = Field(None, description="A human-readable description of the cause of the error.  This field may be presented as-is to a reader.")
    reason: Optional[StrictStr] = Field(None, description="A machine-readable description of the cause of the error. If this value is empty there is no information available.")
    __properties = ["field", "message", "reason"]

    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) -> V1StatusCause:
        """Create an instance of V1StatusCause 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)
        return _dict

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

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

        _obj = V1StatusCause.parse_obj({
            "field": obj.get("field"),
            "message": obj.get("message"),
            "reason": obj.get("reason")
        })
        return _obj


