from typing import Dict
from typing import Any
import uuid


def create_boxes_ndjson(datarow_id: str, schema_id: str, top: float,
                        left: float, bottom: float,
                        right: float) -> Dict[str, Any]:
    """
    * https://docs.labelbox.com/data-model/en/index-en#bounding-box

    Args:
        datarow_id (str): id of the data_row (in this case image) to add this annotation to
        schema_id (str): id of the bbox tool in the current ontology
        top, left, bottom, right (int): pixel coordinates of the bbox
    Returns:
        ndjson representation of a bounding box
    """
    return {
        "uuid": str(uuid.uuid4()),
        "schemaId": schema_id,
        "dataRow": {
            "id": datarow_id
        },
        "bbox": {
            "top": int(top),
            "left": int(left),
            "height": int(bottom - top),
            "width": int(right - left)
        }
    }