from .edid_types import *


class EdidParser:

    __BLOCK_SIZE = 128

    def __init__(self):
        pass

    def find_main_block(self, block_type: MainBlockType, data: bytearray) -> bytearray:
        for i in range(0, len(data), self.__BLOCK_SIZE):
            if data[i] == block_type.value:
                return data[i: i + self.__BLOCK_SIZE]
        return bytearray()

    def find_additional_block(self, block_type: AdditionalBlockType, data: bytearray) -> bytearray:
        for i in range(0, len(data)):
            if data[i] == block_type.value:
                return data[i:]
        return bytearray()
