from UniTAP.libs.lib_tsi.tsi_types import TSI_DPRX_LOG_IF_SEL, TSI_HDRX_LOG_IF_SEL, TSI_DPRX_LOG_CTRL_VALUE_LINK_PAT, \
    TSI_DPRX_VBID_LOG_SEL, TSI_DPRX_MSA_LOG_SEL, TSI_PDC_USBC_LOG_THRESH


class AdditionalEventFilter:

    def __init__(self):
        self.__ci_control = 0
        self.__value = None

    @property
    def ci_control(self):
        return self.__ci_control

    @property
    def value(self):
        return self.__value

    @ci_control.setter
    def ci_control(self, ci_control: int):
        if ci_control <= 0:
            raise ValueError(f"CI control must be more than 0.")
        self.__ci_control = ci_control

    @value.setter
    def value(self, value):
        self.__value = value


class AdditionalSDPEventFilter(AdditionalEventFilter):

    def __init__(self):
        super().__init__()
        self.ci_control = TSI_DPRX_LOG_IF_SEL
        self.value = [0] * 8


class AdditionalInfoFrameEventFilter(AdditionalEventFilter):

    def __init__(self):
        super().__init__()
        self.ci_control = TSI_HDRX_LOG_IF_SEL
        self.value = [0] * 8


class AdditionalLinkPatternEventFilter(AdditionalEventFilter):

    def __init__(self):
        super().__init__()
        self.ci_control = TSI_DPRX_LOG_CTRL_VALUE_LINK_PAT
        self.value = [0] * 3


class AdditionalVBIDEventFilter(AdditionalEventFilter):

    def __init__(self):
        super().__init__()
        self.ci_control = TSI_DPRX_VBID_LOG_SEL
        self.value = 0


class AdditionalMSAEventFilter(AdditionalEventFilter):

    def __init__(self):
        super().__init__()
        self.ci_control = TSI_DPRX_MSA_LOG_SEL
        self.value = 0


class AdditionalLSEEventFilter(AdditionalEventFilter):

    def __init__(self):
        super().__init__()
        self.ci_control = TSI_PDC_USBC_LOG_THRESH
        self.value = [0] * 5
