# 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, StrictInt, StrictStr

class V1LeaseSpec(BaseModel):
    """
    LeaseSpec is a specification of a Lease.  # noqa: E501
    """
    acquire_time: Optional[datetime] = Field(None, alias="acquireTime", description="acquireTime is a time when the current lease was acquired.")
    holder_identity: Optional[StrictStr] = Field(None, alias="holderIdentity", description="holderIdentity contains the identity of the holder of a current lease.")
    lease_duration_seconds: Optional[StrictInt] = Field(None, alias="leaseDurationSeconds", description="leaseDurationSeconds is a duration that candidates for a lease need to wait to force acquire it. This is measure against time of last observed renewTime.")
    lease_transitions: Optional[StrictInt] = Field(None, alias="leaseTransitions", description="leaseTransitions is the number of transitions of a lease between holders.")
    renew_time: Optional[datetime] = Field(None, alias="renewTime", description="renewTime is a time when the current holder of a lease has last updated the lease.")
    __properties = ["acquireTime", "holderIdentity", "leaseDurationSeconds", "leaseTransitions", "renewTime"]

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

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

        _obj = V1LeaseSpec.parse_obj({
            "acquire_time": obj.get("acquireTime"),
            "holder_identity": obj.get("holderIdentity"),
            "lease_duration_seconds": obj.get("leaseDurationSeconds"),
            "lease_transitions": obj.get("leaseTransitions"),
            "renew_time": obj.get("renewTime")
        })
        return _obj


