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

class V1ReplicationControllerSpec(BaseModel):
    """
    ReplicationControllerSpec is the specification of a replication controller.  # noqa: E501
    """
    min_ready_seconds: Optional[StrictInt] = Field(None, alias="minReadySeconds", description="Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)")
    replicas: Optional[StrictInt] = Field(None, description="Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller")
    selector: Optional[Dict[str, StrictStr]] = Field(None, description="Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if empty defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors")
    template: Optional[V1PodTemplateSpec] = None
    __properties = ["minReadySeconds", "replicas", "selector", "template"]

    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) -> V1ReplicationControllerSpec:
        """Create an instance of V1ReplicationControllerSpec 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 template
        if self.template:
            _dict['template'] = self.template.to_dict()
        return _dict

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

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

        _obj = V1ReplicationControllerSpec.parse_obj({
            "min_ready_seconds": obj.get("minReadySeconds"),
            "replicas": obj.get("replicas"),
            "selector": obj.get("selector"),
            "template": V1PodTemplateSpec.from_dict(obj.get("template")) if obj.get("template") is not None else None
        })
        return _obj


