from pycs.database.Result import Result


#pylint: disable=too-few-public-methods
class MediaImageLabel:
    """
    An image label with an optional frame index for videos.
    """

    def __init__(self, result: Result):
        self.label = result.label
        self.frame = result.data['frame'] if 'frame' in result.data else None

    def serialize(self) -> dict:
        """
        serialize all object properties to a dict

        :return: dict
        """
        return dict({'type': 'image-label'}, **self.__dict__)
