from . import exceptions as E


class WordList():

    def __init__(self, words_list=None, comma_separated_words=None):
        self.value = words_list or comma_separated_words or None
        if type(self.value) is list or tuple:
            for item in self.value:
                if type(item) is not str:
                    raise E.UnexpectedDataType(str, type(item))
        elif type(self.value) is str:
            if self.value.find(',') == -1:
                raise E.IsNotCommaSeparatedValues()
        else:
            raise E.UnexpectedDataType((list, tuple, str), type(self.value))

    def __str__(self):
        return self.value
