# coding: utf-8

"""
    Typewise API

    Typewise server for text completion, autocorrection and emoji searching.  # noqa: E501

    OpenAPI spec version: 0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

import pprint
import re  # noqa: F401

import six

class SingleCompletion(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    """
    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'text': 'str',
        'score': 'float',
        'completion_starting_index': 'int',
        'token_scores': 'list[SingleCompletionTokenProbability]'
    }

    attribute_map = {
        'text': 'text',
        'score': 'score',
        'completion_starting_index': 'completionStartingIndex',
        'token_scores': 'tokenScores'
    }

    def __init__(self, text=None, score=None, completion_starting_index=None, token_scores=None):  # noqa: E501
        """SingleCompletion - a model defined in Swagger"""  # noqa: E501
        self._text = None
        self._score = None
        self._completion_starting_index = None
        self._token_scores = None
        self.discriminator = None
        if text is not None:
            self.text = text
        self.score = score
        self.completion_starting_index = completion_starting_index
        if token_scores is not None:
            self.token_scores = token_scores

    @property
    def text(self):
        """Gets the text of this SingleCompletion.  # noqa: E501

        Predicted word.  # noqa: E501

        :return: The text of this SingleCompletion.  # noqa: E501
        :rtype: str
        """
        return self._text

    @text.setter
    def text(self, text):
        """Sets the text of this SingleCompletion.

        Predicted word.  # noqa: E501

        :param text: The text of this SingleCompletion.  # noqa: E501
        :type: str
        """

        self._text = text

    @property
    def score(self):
        """Gets the score of this SingleCompletion.  # noqa: E501

        For each candidate completion, the list of the scores returned by the inference. How the score is constructed depends on the inference technique of the model.  # noqa: E501

        :return: The score of this SingleCompletion.  # noqa: E501
        :rtype: float
        """
        return self._score

    @score.setter
    def score(self, score):
        """Sets the score of this SingleCompletion.

        For each candidate completion, the list of the scores returned by the inference. How the score is constructed depends on the inference technique of the model.  # noqa: E501

        :param score: The score of this SingleCompletion.  # noqa: E501
        :type: float
        """
        if score is None:
            raise ValueError("Invalid value for `score`, must not be `None`")  # noqa: E501

        self._score = score

    @property
    def completion_starting_index(self):
        """Gets the completion_starting_index of this SingleCompletion.  # noqa: E501

        Index (relative to the end) at which the completion starts. If input is 'this is a compl' and the predicted word is 'etion', then the index will be 0. If using feature correct_typo_in_partial_word, then 'this is a compl' will return 'completion' and the index will be -5.  # noqa: E501

        :return: The completion_starting_index of this SingleCompletion.  # noqa: E501
        :rtype: int
        """
        return self._completion_starting_index

    @completion_starting_index.setter
    def completion_starting_index(self, completion_starting_index):
        """Sets the completion_starting_index of this SingleCompletion.

        Index (relative to the end) at which the completion starts. If input is 'this is a compl' and the predicted word is 'etion', then the index will be 0. If using feature correct_typo_in_partial_word, then 'this is a compl' will return 'completion' and the index will be -5.  # noqa: E501

        :param completion_starting_index: The completion_starting_index of this SingleCompletion.  # noqa: E501
        :type: int
        """
        if completion_starting_index is None:
            raise ValueError("Invalid value for `completion_starting_index`, must not be `None`")  # noqa: E501

        self._completion_starting_index = completion_starting_index

    @property
    def token_scores(self):
        """Gets the token_scores of this SingleCompletion.  # noqa: E501

        Tokens and their corresponding probabilities for the current prediction.  # noqa: E501

        :return: The token_scores of this SingleCompletion.  # noqa: E501
        :rtype: list[SingleCompletionTokenProbability]
        """
        return self._token_scores

    @token_scores.setter
    def token_scores(self, token_scores):
        """Sets the token_scores of this SingleCompletion.

        Tokens and their corresponding probabilities for the current prediction.  # noqa: E501

        :param token_scores: The token_scores of this SingleCompletion.  # noqa: E501
        :type: list[SingleCompletionTokenProbability]
        """

        self._token_scores = token_scores

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value
        if issubclass(SingleCompletion, dict):
            for key, value in self.items():
                result[key] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, SingleCompletion):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        return not self == other
