# coding: utf-8

"""
    NetHSM
    All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian.   # noqa: E501
    The version of the OpenAPI document: v1
    Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
"""

from __future__ import annotations
from nethsm.client.shared_imports.schema_imports import *  # pyright: ignore [reportWildcardImportFromLibrary]


from nethsm.client.components.schema import cluster_log_list
from nethsm.client.components.schema import cluster_snapshot
from nethsm.client.components.schema import cluster_state
Properties = typing.TypedDict(
    'Properties',
    {
        "clusterLogs": typing.Type[cluster_log_list.ClusterLogList],
        "clusterSnapshot": typing.Type[cluster_snapshot.ClusterSnapshot],
        "clusterState": typing.Type[cluster_state.ClusterState],
    }
)


class HealthDiagnoseDataDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):

    __required_keys__: typing.FrozenSet[str] = frozenset({
        "clusterLogs",
        "clusterState",
    })
    __optional_keys__: typing.FrozenSet[str] = frozenset({
        "clusterSnapshot",
    })
    
    def __new__(
        cls,
        *,
        clusterLogs: typing.Union[
            cluster_log_list.ClusterLogListTupleInput,
            cluster_log_list.ClusterLogListTuple
        ],
        clusterState: typing.Union[
            cluster_state.ClusterStateDictInput,
            cluster_state.ClusterStateDict,
        ],
        clusterSnapshot: typing.Union[
            cluster_snapshot.ClusterSnapshotDictInput,
            cluster_snapshot.ClusterSnapshotDict,
            schemas.Unset
        ] = schemas.unset,
        configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
        **kwargs: schemas.INPUT_TYPES_ALL,
    ):
        arg_: typing.Dict[str, typing.Any] = {
            "clusterLogs": clusterLogs,
            "clusterState": clusterState,
        }
        for key_, val in (
            ("clusterSnapshot", clusterSnapshot),
        ):
            if isinstance(val, schemas.Unset):
                continue
            arg_[key_] = val
        arg_.update(kwargs)
        used_arg_ = typing.cast(HealthDiagnoseDataDictInput, arg_)
        return HealthDiagnoseData.validate(used_arg_, configuration=configuration_)
    
    @staticmethod
    def from_dict_(
        arg: typing.Union[
            HealthDiagnoseDataDictInput,
            HealthDiagnoseDataDict
        ],
        configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
    ) -> HealthDiagnoseDataDict:
        return HealthDiagnoseData.validate(arg, configuration=configuration)
    
    @property
    def clusterLogs(self) -> cluster_log_list.ClusterLogListTuple:
        return typing.cast(
            cluster_log_list.ClusterLogListTuple,
            self.__getitem__("clusterLogs")
        )
    
    @property
    def clusterState(self) -> cluster_state.ClusterStateDict:
        return typing.cast(
            cluster_state.ClusterStateDict,
            self.__getitem__("clusterState")
        )
    
    @property
    def clusterSnapshot(self) -> typing.Union[cluster_snapshot.ClusterSnapshotDict, schemas.Unset]:
        val = self.get("clusterSnapshot", schemas.unset)
        if isinstance(val, schemas.Unset):
            return val
        return typing.cast(
            cluster_snapshot.ClusterSnapshotDict,
            val
        )
    
    def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
        schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
        return self.get(name, schemas.unset)
HealthDiagnoseDataDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]


@dataclasses.dataclass(frozen=True)
class HealthDiagnoseData(
    schemas.Schema[HealthDiagnoseDataDict, tuple]
):
    """NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
    Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator

    Do not edit the class manually.

    Information about the health of the etcd process on the current node,
including the process running state, exit code, and recent logs.

    """
    types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
    required: typing.FrozenSet[str] = frozenset({
        "clusterLogs",
        "clusterState",
    })
    properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore
    type_to_output_cls: typing.Mapping[
        typing.Type,
        typing.Type
    ] = dataclasses.field(
        default_factory=lambda: {
            schemas.immutabledict: HealthDiagnoseDataDict
        }
    )

    @classmethod
    def validate(
        cls,
        arg: typing.Union[
            HealthDiagnoseDataDictInput,
            HealthDiagnoseDataDict,
        ],
        configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
    ) -> HealthDiagnoseDataDict:
        return super().validate_base(
            arg,
            configuration=configuration,
        )

