#####################################################################
# NOTE: THIS FILE IS AUTOGENERATED BY GENERATE_TYPES.PY. DO NOT EDIT!
#####################################################################

from ...compiler.registry import register_data
from ..base import Datatype

# Type imports
from ..datatypes import common as common
from .timestamp import Timestamp


@register_data
class BoundingBox(Datatype):
    """Bounding box associated with an object detection.

    Defines the upper left and lower right corners of a detected object
    in an image frame. Origin (0,0) is the top left corner of the input image.
    (image_height, image_width) is the bottom right corner.
    Also the class and confidence threshold associated with the box.

    Attributes:
        y_min (float): minimum y offset percentage with respect to image size [0.0-1.0]
        x_min (float): minimum x offset percentage with respect to image size [0.0-1.0]
        y_max (float): maximum y offset percentage with respect to image size [0.0-1.0]
        x_max (float): maximum x offset percentage with respect to image size [0.0-1.0]
    """

    y_min: float | None = None
    x_min: float | None = None
    y_max: float | None = None
    x_max: float | None = None


@register_data
class HSV(Datatype):
    """HSV values generated by a color filter.

    Color filter represented by hue, saturation, and value Uses OpenCV ranges defined ![here](https://docs.opencv.org/4.x/df/d9d/tutorial_py_colorspaces.html).

    Attributes:
        h (int): hue range is [0,179]
        s (int): saturation range is [0,255]
        v (int): value range is [0,255]
    """

    h: int | None = None
    s: int | None = None
    v: int | None = None


@register_data
class Detection(Datatype):
    """Object detection generated by a model.

    Attributes:
        detection_id (int): can be multiple objects per frame
        class_name (str): class name of detection
        score (float): confidence score
        bbox (BoundingBox): bounding box
    """

    detection_id: int | None = None
    class_name: str | None = None
    score: float | None = None
    bbox: BoundingBox | None = None


@register_data
class DetectionResult(Datatype):
    """List of object detections.

    Attributes:
        detections (List[Detection]): list of detections
        frame_id (int): frame corresponding to these detections
    """

    detections: list[Detection] | None = None
    frame_id: int | None = None


@register_data
class AvoidanceResult(Datatype):
    """Avoidance result generated by an avoidance model.

    Attributes:
        actuation_vector (float): actuation vector towards safe area
    """

    actuation_vector: float | None = None


@register_data
class SLAMResult(Datatype):
    """SLAM result generated by a SLAM model.

    Attributes:
        relative_position (common.Position): relative position estimate relative to SLAM initialization
        global_position (common.Location): global position estimate
    """

    relative_position: common.Position | None = None
    global_position: common.Location | None = None


@register_data
class ComputeResult(Datatype):
    """Compute result generated by a compute server.

    Attributes:
        timestamp (Timestamp): inference timestamp
        engine_name (str): engine that generated the result
        detection_result (DetectionResult): object detection
        avoidance_result (AvoidanceResult): avoidance directive
        slam_result (SLAMResult): SLAM position estimate
        generic_result (str): JSON result
    """

    timestamp: Timestamp | None = None
    engine_name: str | None = None
    detection_result: DetectionResult | None = None
    avoidance_result: AvoidanceResult | None = None
    slam_result: SLAMResult | None = None
    generic_result: str | None = None


@register_data
class FrameResult(Datatype):
    """Compute results generated by datasink modules

    Attributes:
        type (str)
        frame_id (int): For correlation
        result (List[ComputeResult])
    """

    type: str | None = None
    frame_id: int | None = None
    result: list[ComputeResult] | None = None
