# noinspection PyClassHasNoInit
class InputParameterConvertor:
    @classmethod
    def check_param_list(cls, input_data):
        if type(input_data) is not list:
            raise Exception("{0} param is not type list".format(input_data))

        return input_data

    @classmethod
    def check_valid_object(cls, object_):
        if object_ is None:
            raise Exception("Expected valid object but None was given!")

        return object_

    @classmethod
    def check_valid_parameter(cls, input_data, valid_values_set):
        if input_data not in valid_values_set:
            raise Exception('Expected values: {0}'.format(valid_values_set))

        return input_data

    @classmethod
    def convert_to_bool(cls, input_data):
        if type(input_data) is str or type(input_data) is unicode:
            InputParameterConvertor.check_valid_parameter(input_data=input_data, valid_values_set=['True', 'False', 'true', 'false'])

            return input_data == "True" or input_data == 'true'
        elif type(input_data) is bool:

            return input_data
        else:
            raise Exception("Wrong type of parameter!")

    @classmethod
    def convert_to_float(cls, input_data):
        if type(input_data) is not float:
            try:
                input_data = float(input_data)
            except:
                raise Exception("{0} param can not be transformed to float".format(input_data))

        return input_data

    @classmethod
    def convert_to_int(cls, input_data):
        if type(input_data) is not int:
            try:
                input_data = int(input_data)
            except:
                raise Exception("{0} param can not be transformed to int".format(input_data))

        return input_data

    @classmethod
    def is_int(cls, input_data):
        if type(input_data) is int:
            return input_data
        else:
            raise Exception("Parameter result value has wrong type!")
