from UniTAP.libs.lib_tsi.tsi_io import PortIO
from ctypes import c_uint32


class HdmiCapabilities:

    def __init__(self, ci_control: int, port_io: PortIO):
        self.__io = port_io

        caps = self.__io.get(ci_control, c_uint32)[1]
        self.__cap_tmds = caps & 0x1
        self.__cap_frl = (caps >> 1) & 0x1
        self.__cap_arc = (caps >> 2) & 0x1
        self.__cap_hdcp = (caps >> 3) & 0x1
        self.__cap_behavior_14 = (caps >> 4) & 0x1
        self.__cap_behavior_20 = (caps >> 5) & 0x1
        self.__cap_behavior_21 = (caps >> 6) & 0x1

    @property
    def support_tmds(self) -> bool:
        return self.__cap_tmds

    @property
    def support_frl(self) -> bool:
        return self.__cap_tmds

    @property
    def support_arc(self) -> bool:
        return self.__cap_tmds

    @property
    def support_hdcp(self) -> bool:
        return self.__cap_tmds

    @property
    def support_hdmi_mode_14(self) -> bool:
        return self.__cap_tmds

    @property
    def support_hdmi_mode_20(self) -> bool:
        return self.__cap_tmds

    @property
    def support_hdmi_mode_21(self) -> bool:
        return self.__cap_tmds
