# coding: utf-8

"""
    HashiCorp Vault API

    HTTP API that gives you full access to Vault. All API routes are prefixed with `/v1/`.

    The version of the OpenAPI document: 1.15.0
    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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class PkiTidyCancelResponse(BaseModel):
    """
    PkiTidyCancelResponse
    """ # noqa: E501
    acme_account_deleted_count: Optional[StrictInt] = Field(default=None, description="The number of revoked acme accounts removed")
    acme_account_revoked_count: Optional[StrictInt] = Field(default=None, description="The number of unused acme accounts revoked")
    acme_account_safety_buffer: Optional[StrictInt] = Field(default=None, description="Safety buffer after creation after which accounts lacking orders are revoked")
    acme_orders_deleted_count: Optional[StrictInt] = Field(default=None, description="The number of expired, unused acme orders removed")
    cert_store_deleted_count: Optional[StrictInt] = Field(default=None, description="The number of certificate storage entries deleted")
    cross_revoked_cert_deleted_count: Optional[StrictInt] = None
    current_cert_store_count: Optional[StrictInt] = Field(default=None, description="The number of revoked certificate entries deleted")
    current_revoked_cert_count: Optional[StrictInt] = Field(default=None, description="The number of revoked certificate entries deleted")
    error: Optional[StrictStr] = Field(default=None, description="The error message")
    internal_backend_uuid: Optional[StrictStr] = None
    issuer_safety_buffer: Optional[StrictInt] = Field(default=None, description="Issuer safety buffer")
    last_auto_tidy_finished: Optional[StrictStr] = Field(default=None, description="Time the last auto-tidy operation finished")
    message: Optional[StrictStr] = Field(default=None, description="Message of the operation")
    missing_issuer_cert_count: Optional[StrictInt] = None
    pause_duration: Optional[StrictStr] = Field(default=None, description="Duration to pause between tidying certificates")
    revocation_queue_deleted_count: Optional[StrictInt] = None
    revocation_queue_safety_buffer: Optional[StrictInt] = Field(default=None, description="Revocation queue safety buffer")
    revoked_cert_deleted_count: Optional[StrictInt] = Field(default=None, description="The number of revoked certificate entries deleted")
    safety_buffer: Optional[StrictInt] = Field(default=None, description="Safety buffer time duration")
    state: Optional[StrictStr] = Field(default=None, description="One of Inactive, Running, Finished, or Error")
    tidy_acme: Optional[StrictBool] = Field(default=None, description="Tidy Unused Acme Accounts, and Orders")
    tidy_cert_store: Optional[StrictBool] = Field(default=None, description="Tidy certificate store")
    tidy_cross_cluster_revoked_certs: Optional[StrictBool] = Field(default=None, description="Tidy the cross-cluster revoked certificate store")
    tidy_expired_issuers: Optional[StrictBool] = Field(default=None, description="Tidy expired issuers")
    tidy_move_legacy_ca_bundle: Optional[StrictBool] = None
    tidy_revocation_queue: Optional[StrictBool] = None
    tidy_revoked_cert_issuer_associations: Optional[StrictBool] = Field(default=None, description="Tidy revoked certificate issuer associations")
    tidy_revoked_certs: Optional[StrictBool] = Field(default=None, description="Tidy revoked certificates")
    time_finished: Optional[StrictStr] = Field(default=None, description="Time the operation finished")
    time_started: Optional[StrictStr] = Field(default=None, description="Time the operation started")
    total_acme_account_count: Optional[StrictInt] = Field(default=None, description="Total number of acme accounts iterated over")
    __properties: ClassVar[List[str]] = ["acme_account_deleted_count", "acme_account_revoked_count", "acme_account_safety_buffer", "acme_orders_deleted_count", "cert_store_deleted_count", "cross_revoked_cert_deleted_count", "current_cert_store_count", "current_revoked_cert_count", "error", "internal_backend_uuid", "issuer_safety_buffer", "last_auto_tidy_finished", "message", "missing_issuer_cert_count", "pause_duration", "revocation_queue_deleted_count", "revocation_queue_safety_buffer", "revoked_cert_deleted_count", "safety_buffer", "state", "tidy_acme", "tidy_cert_store", "tidy_cross_cluster_revoked_certs", "tidy_expired_issuers", "tidy_move_legacy_ca_bundle", "tidy_revocation_queue", "tidy_revoked_cert_issuer_associations", "tidy_revoked_certs", "time_finished", "time_started", "total_acme_account_count"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

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

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of PkiTidyCancelResponse from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "acme_account_deleted_count": obj.get("acme_account_deleted_count"),
            "acme_account_revoked_count": obj.get("acme_account_revoked_count"),
            "acme_account_safety_buffer": obj.get("acme_account_safety_buffer"),
            "acme_orders_deleted_count": obj.get("acme_orders_deleted_count"),
            "cert_store_deleted_count": obj.get("cert_store_deleted_count"),
            "cross_revoked_cert_deleted_count": obj.get("cross_revoked_cert_deleted_count"),
            "current_cert_store_count": obj.get("current_cert_store_count"),
            "current_revoked_cert_count": obj.get("current_revoked_cert_count"),
            "error": obj.get("error"),
            "internal_backend_uuid": obj.get("internal_backend_uuid"),
            "issuer_safety_buffer": obj.get("issuer_safety_buffer"),
            "last_auto_tidy_finished": obj.get("last_auto_tidy_finished"),
            "message": obj.get("message"),
            "missing_issuer_cert_count": obj.get("missing_issuer_cert_count"),
            "pause_duration": obj.get("pause_duration"),
            "revocation_queue_deleted_count": obj.get("revocation_queue_deleted_count"),
            "revocation_queue_safety_buffer": obj.get("revocation_queue_safety_buffer"),
            "revoked_cert_deleted_count": obj.get("revoked_cert_deleted_count"),
            "safety_buffer": obj.get("safety_buffer"),
            "state": obj.get("state"),
            "tidy_acme": obj.get("tidy_acme"),
            "tidy_cert_store": obj.get("tidy_cert_store"),
            "tidy_cross_cluster_revoked_certs": obj.get("tidy_cross_cluster_revoked_certs"),
            "tidy_expired_issuers": obj.get("tidy_expired_issuers"),
            "tidy_move_legacy_ca_bundle": obj.get("tidy_move_legacy_ca_bundle"),
            "tidy_revocation_queue": obj.get("tidy_revocation_queue"),
            "tidy_revoked_cert_issuer_associations": obj.get("tidy_revoked_cert_issuer_associations"),
            "tidy_revoked_certs": obj.get("tidy_revoked_certs"),
            "time_finished": obj.get("time_finished"),
            "time_started": obj.get("time_started"),
            "total_acme_account_count": obj.get("total_acme_account_count")
        })
        return _obj


