from typing import (TYPE_CHECKING, Any, BinaryIO, Optional, TextIO, TypeVar,
                    Union)

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

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



@_attrs_define
class BoardPanelPosition:
    """ The position of the panel within the layout. When X and Y coordinates are not specified for any of the panels, the
    layout will be generated automatically.

        Attributes:
            x_coordinate (Union[Unset, int]): The x-axis origin point for placing the panel within the layout.
            y_coordinate (Union[Unset, int]): The y-axis origin point for placing the panel within the layout.
            height (Union[Unset, int]): The height of the panel. When not specified or set to 0, the height of the panel is
                calculated dynamically based on the panel type.
            width (Union[Unset, int]): The width of the panel. When not specified or set to 0, the width of the panel is
                calculated dynamically based on the panel type.
     """

    x_coordinate: Union[Unset, int] = UNSET
    y_coordinate: Union[Unset, int] = UNSET
    height: Union[Unset, int] = UNSET
    width: Union[Unset, int] = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)


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

        y_coordinate = self.y_coordinate

        height = self.height

        width = self.width


        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({
        })
        if x_coordinate is not UNSET:
            field_dict["x_coordinate"] = x_coordinate
        if y_coordinate is not UNSET:
            field_dict["y_coordinate"] = y_coordinate
        if height is not UNSET:
            field_dict["height"] = height
        if width is not UNSET:
            field_dict["width"] = width

        return field_dict



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

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

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

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

        board_panel_position = cls(
            x_coordinate=x_coordinate,
            y_coordinate=y_coordinate,
            height=height,
            width=width,
        )


        board_panel_position.additional_properties = d
        return board_panel_position

    @property
    def additional_keys(self) -> list[str]:
        return list(self.additional_properties.keys())

    def __getitem__(self, key: str) -> Any:
        return self.additional_properties[key]

    def __setitem__(self, key: str, value: Any) -> None:
        self.additional_properties[key] = value

    def __delitem__(self, key: str) -> None:
        del self.additional_properties[key]

    def __contains__(self, key: str) -> bool:
        return key in self.additional_properties
