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

class V1CertificateSigningRequestCondition(BaseModel):
    """
    CertificateSigningRequestCondition describes a condition of a CertificateSigningRequest object  # noqa: E501
    """
    last_transition_time: Optional[datetime] = Field(None, alias="lastTransitionTime", description="lastTransitionTime is the time the condition last transitioned from one status to another. If unset, when a new condition type is added or an existing condition's status is changed, the server defaults this to the current time.")
    last_update_time: Optional[datetime] = Field(None, alias="lastUpdateTime", description="lastUpdateTime is the time of the last update to this condition")
    message: Optional[StrictStr] = Field(None, description="message contains a human readable message with details about the request state")
    reason: Optional[StrictStr] = Field(None, description="reason indicates a brief reason for the request state")
    status: StrictStr = Field(..., description="status of the condition, one of True, False, Unknown. Approved, Denied, and Failed conditions may not be \"False\" or \"Unknown\".")
    type: StrictStr = Field(..., description="type of the condition. Known conditions are \"Approved\", \"Denied\", and \"Failed\".  An \"Approved\" condition is added via the /approval subresource, indicating the request was approved and should be issued by the signer.  A \"Denied\" condition is added via the /approval subresource, indicating the request was denied and should not be issued by the signer.  A \"Failed\" condition is added via the /status subresource, indicating the signer failed to issue the certificate.  Approved and Denied conditions are mutually exclusive. Approved, Denied, and Failed conditions cannot be removed once added.  Only one condition of a given type is allowed.")
    __properties = ["lastTransitionTime", "lastUpdateTime", "message", "reason", "status", "type"]

    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) -> V1CertificateSigningRequestCondition:
        """Create an instance of V1CertificateSigningRequestCondition 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) -> V1CertificateSigningRequestCondition:
        """Create an instance of V1CertificateSigningRequestCondition from a dict"""
        if obj is None:
            return None

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

        _obj = V1CertificateSigningRequestCondition.parse_obj({
            "last_transition_time": obj.get("lastTransitionTime"),
            "last_update_time": obj.get("lastUpdateTime"),
            "message": obj.get("message"),
            "reason": obj.get("reason"),
            "status": obj.get("status"),
            "type": obj.get("type")
        })
        return _obj


