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


class Hdcp3ATestParam:
    """
    Class `Hdcp3ATestParam` describes requirement parameters for HDCP 3A tests:
    - Set and get `timeout`. Describes test timeout, in milliseconds.
    """
    def __init__(self, json_obj):
        self.__timeout = Param(json_obj["TSI_TEST_CFG_HDCP2_3A_TIMEOUT"])

    @property
    def timeout(self):
        """
        Set and get test timeout, in milliseconds.

        Returns:
            object of int type
        """
        return self.__timeout.default_value

    @timeout.setter
    def timeout(self, timeout: int):
        if not(self.__timeout.min_value < timeout < self.__timeout.max_value):
            raise ValueError(f"Timeout cannot be less than {self.__timeout.min_value} and more than "
                             f"{self.__timeout.max_value}.")
        self.__timeout.default_value = timeout
