from UniTAP.dev.modules.dut_tests.test_group_params_types import Param


class HdmiSinkContinuityDUTTestParam:
    """
    Class `HdmiSinkContinuityDUTTestParam` allows working with parameters from HDMI Continuity part.
    - Set and get total test time `test_time`, in seconds. Default value is 60s.
    - Set and get status period `status_period`, in seconds.
    - Set and get stop flag `stop_flag`. Stop testing when status fail.
    - Set and get flag of enabling scdc version `enable_scdc_version`. Enable to check SCDC version.
    - Set and get flag of enabling scdc status `enable_scdc_status`. Enable to check SCDC status flag.
    - Set and get flag of enabling scdc error count `enable_scdc_error_count`. Enable to check SCDC error counters.
    - Set and get SDCD error counter fail threshold `scdc_error_count`. Default value is 10.
    """
    def __init__(self, json_obj):
        self.__test_time = Param(json_obj["TSI_HDMI_SNKCTS_TEST_TIME"])
        self.__status_period = Param(json_obj["TSI_HDMI_SNKCTS_STATUS_PERIOD"])
        self.__stop_flag = Param(json_obj["TSI_HDMI_SNKCTS_STOP_TESTING"])
        self.__enable_scdc_version = Param(json_obj["TSI_HDMI_SNKCTS_SCDC_VERSION"])
        self.__enable_scdc_status = Param(json_obj["TSI_HDMI_SNKCTS_SCDC_STATUS"])
        self.__enable_scdc_error_count = Param(json_obj["TSI_HDMI_SNKCTS_SCDC_ERROR"])
        self.__scdc_error_count = Param(json_obj["TSI_HDMI_SNKCTS_SCDC_ERROR_COUNTER"])

    @property
    def test_time(self) -> int:
        """
        Set and get test time.

        Returns:
            object of `int` type
        """
        return self.__test_time.default_value

    @test_time.setter
    def test_time(self, test_time: int):
        self.__test_time.default_value = test_time

    @property
    def status_period(self) -> int:
        """
        Set and get status period.

        Returns:
            object of `int` type
        """
        return self.__status_period.default_value

    @status_period.setter
    def status_period(self, status_period: int):
        self.__status_period.default_value = status_period

    @property
    def stop_flag(self) -> bool:
        """
        Set and get flag of stop testing when status fail.

        Returns:
            object of `bool` type
        """
        return self.__stop_flag.default_value

    @stop_flag.setter
    def stop_flag(self, stop_flag: bool):
        self.__stop_flag.default_value = int(stop_flag)

    @property
    def enable_scdc_version(self) -> int:
        """
        Set and get flag of enabling scdc version.

        Returns:
            object of `bool` type
        """
        return self.__enable_scdc_version.default_value

    @enable_scdc_version.setter
    def enable_scdc_version(self, enable_scdc_version: bool):
        self.__enable_scdc_version.default_value = int(enable_scdc_version)

    @property
    def enable_scdc_status(self) -> bool:
        """
        Set and get flag of enabling scdc status.

        Returns:
            object of `bool` type
        """
        return self.__test_time.default_value

    @enable_scdc_status.setter
    def enable_scdc_status(self, enable_scdc_status: bool):
        self.__enable_scdc_status.default_value = int(enable_scdc_status)

    @property
    def enable_scdc_error_count(self) -> bool:
        """
        Set and get flag of enabling scdc error count.

        Returns:
            object of `int` type
        """
        return self.__enable_scdc_error_count.default_value

    @enable_scdc_error_count.setter
    def enable_scdc_error_count(self, enable_scdc_error_count: bool):
        self.__enable_scdc_error_count.default_value = int(enable_scdc_error_count)

    @property
    def scdc_error_count(self) -> int:
        """
        Set and get scdc error count.

        Returns:
            object of `int` type
        """
        return self.__scdc_error_count.default_value

    @scdc_error_count.setter
    def scdc_error_count(self, error_count: int):
        self.__scdc_error_count.default_value = error_count
