from yta_project_editor.settings import LAYERS_INDEXES_LIMIT, MINIMUM_DIMENSIONS, MAXIMUM_DIMENSIONS
from yta_validation.parameter import ParameterValidator


class ProjectEditorValidator:
    """
    Class to wrap validation functionality.
    """

    @staticmethod
    def validate_layer_index(
        layer_index: int
    ) -> None:
        """
        Check that the 'layer_index' provided is a
        valid value according to our settings or
        raise an exception if invalid.
        """
        ParameterValidator.validate_mandatory_number_between('layer_index', layer_index, LAYERS_INDEXES_LIMIT[0], LAYERS_INDEXES_LIMIT[1])

    @staticmethod
    def validate_dimensions(
        dimensions: tuple[int, int]
    ) -> None:
        """
        Check that the 'dimensions' provided are
        valid according to our settings or raise
        an exception if invalid.
        """
        ParameterValidator.validate_mandatory_numeric_tuple_or_list_or_array_of_2_elements_between_values('dimensions', dimensions, MINIMUM_DIMENSIONS[0], MAXIMUM_DIMENSIONS[0], MINIMUM_DIMENSIONS[1], MAXIMUM_DIMENSIONS[1])