from __future__ import annotations

from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar

from attrs import define as _attrs_define

if TYPE_CHECKING:
    from ..models.point import Point


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


@_attrs_define
class ShapesResult:
    """
    Attributes:
        time_ms (float):
        point_1 (Point): Captcha Server
            No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

            The version of the OpenAPI document: 0.1


            NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
            https://openapi-generator.tech
            Do not edit the class manually.
        point_2 (Point): Captcha Server
            No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

            The version of the OpenAPI document: 0.1


            NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
            https://openapi-generator.tech
            Do not edit the class manually.
    """

    time_ms: float
    point_1: Point
    point_2: Point

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

        point_1 = self.point_1.to_dict()

        point_2 = self.point_2.to_dict()

        field_dict: dict[str, Any] = {}

        field_dict.update(
            {
                "time_ms": time_ms,
                "point_1": point_1,
                "point_2": point_2,
            }
        )

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.point import Point

        d = dict(src_dict)
        time_ms = d.pop("time_ms")

        point_1 = Point.from_dict(d.pop("point_1"))

        point_2 = Point.from_dict(d.pop("point_2"))

        shapes_result = cls(
            time_ms=time_ms,
            point_1=point_1,
            point_2=point_2,
        )

        return shapes_result
