from __future__ import annotations

from collections.abc import Mapping
from typing import (
    Any,
    TypeVar,
)

from attrs import define as _attrs_define

from ..types import (
    UNSET,
    Unset,
)

T = TypeVar("T", bound="ScaleCluster")


@_attrs_define
class ScaleCluster:
    """
    Attributes:
        size (str):
        family (str | Unset):
    """

    size: str
    family: str | Unset = UNSET

    def to_dict(self) -> dict[str, Any]:
        size = self.size

        family = self.family

        field_dict: dict[str, Any] = {}

        field_dict.update(
            {
                "size": size,
            }
        )
        if family is not UNSET:
            field_dict["family"] = family

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        d = dict(src_dict)
        size = d.pop("size")

        family = d.pop("family", UNSET)

        scale_cluster = cls(
            size=size,
            family=family,
        )

        return scale_cluster
