from typing import Tuple
from typing import List


def create_annotation(annotation_id: int, image_id: int, category_id: int, is_crowd: int, area: int,
                      bounding_box: Tuple[int, int, int, int], segmentation: List[Tuple[int, int]]) -> dict:
    """
    Converts input data to COCO annotation information storing format.

    :param int annotation_id: unique identificator of the annotation
    :param int image_id: identificator of related image
    :param int category_id: identificator of related category (annotation class)
    :param int is_crowd:
        "iscrowd": 0 if your segmentation based on polygon (object instance)
        "iscrowd": 1 if your segmentation based uncompressed RLE (crowd)
    :param float area: area occupied by segmentation in pixels
    :param Tuple[float, float, float, float] bounding_box:
        coordinates of bbox in format (x,y,w,h)
    :param list segmentation: polygon coordinates
    :return: dict of the annotation information in COCO format
    """
    return {
        "id": annotation_id,
        "image_id": image_id,
        "category_id": category_id,
        "iscrowd": is_crowd,
        "area": area,  # float
        "bbox": bounding_box,  # [x,y,width,height]
        "segmentation": segmentation  # [polygon]
    }