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


class Hdcp3CTestParam:
    """
    Class `Hdcp3CTestParam` describes requirement parameters for HDCP 3C tests:
    - Set and get `timeout`. Describes test timeout, in milliseconds.
    - Set and get `repeater_multiple_outputs`. Describes repeater multiple outputs (enable/disable).
    """
    def __init__(self, json_obj):
        self.__timeout = Param(json_obj["TSI_TEST_CFG_HDCP2_3C_TIMEOUT"])
        self.__repeater_multiple_outputs = Param(json_obj["TSI_TEST_CFG_HDCP2_3C_REPEATER_MULTIPLE_OUTPUTS"])

    @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

    @property
    def repeater_multiple_outputs(self) -> bool:
        """
        Set and get repeater multiple outputs (enable/disable).

        Returns:
            object of bool type
        """
        return self.__repeater_multiple_outputs.default_value

    @repeater_multiple_outputs.setter
    def repeater_multiple_outputs(self, repeater_multiple_outputs: bool):
        self.__repeater_multiple_outputs.default_value = repeater_multiple_outputs
