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


class HdmiSourceDUTTestParam:
    """
    Class `HdmiSourceDUTTestParam` allows working with parameters from HDMI DSC source part.
    - Set and get timeout `timeout`.
    """
    def __init__(self, json_obj):
        self.__timeout = json_obj["TSI_HDMI_SRCCTS_TIMEOUT"]

    @property
    def timeout(self) -> int:
        """
        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
