# This file is generated. Do not modify by hand.
# pylint: disable=line-too-long, unused-argument, unused-import, f-string-without-interpolation, too-many-branches, too-many-statements, unnecessary-pass
from dataclasses import dataclass, field
from typing import List, Optional, Dict, Any, TYPE_CHECKING
import decimal
import bson
from ..ascii.simple_tuning_param_definition import SimpleTuningParamDefinition


@dataclass
class GetSimpleTuningParamDefinitionResponse:

    params: List[SimpleTuningParamDefinition] = field(default_factory=list)

    @staticmethod
    def zero_values() -> 'GetSimpleTuningParamDefinitionResponse':
        return GetSimpleTuningParamDefinitionResponse(
            params=[],
        )

    @staticmethod
    def from_binary(data_bytes: bytes) -> 'GetSimpleTuningParamDefinitionResponse':
        """" Deserialize a binary representation of this class. """
        data = bson.loads(data_bytes)  # type: Dict[str, Any]
        return GetSimpleTuningParamDefinitionResponse.from_dict(data)

    def to_binary(self) -> bytes:
        """" Serialize this class to a binary representation. """
        self.validate()
        return bson.dumps(self.to_dict())  # type: ignore

    def to_dict(self) -> Dict[str, Any]:
        return {
            'params': [item.to_dict() for item in self.params] if self.params is not None else [],
        }

    @staticmethod
    def from_dict(data: Dict[str, Any]) -> 'GetSimpleTuningParamDefinitionResponse':
        return GetSimpleTuningParamDefinitionResponse(
            params=[SimpleTuningParamDefinition.from_dict(item) for item in data.get('params')],  # type: ignore
        )

    def validate(self) -> None:
        """" Validates the properties of the instance. """
        if self.params is not None:
            if not isinstance(self.params, list):
                raise ValueError('Property "Params" of "GetSimpleTuningParamDefinitionResponse" is not a list.')

            for i, params_item in enumerate(self.params):
                if params_item is None:
                    raise ValueError(f'Item {i} in property "Params" of "GetSimpleTuningParamDefinitionResponse" is None.')

                if not isinstance(params_item, SimpleTuningParamDefinition):
                    raise ValueError(f'Item {i} in property "Params" of "GetSimpleTuningParamDefinitionResponse" is not an instance of "SimpleTuningParamDefinition".')

                params_item.validate()
