from datetime import date, datetime  # noqa: F401
from typing import Dict, List  # noqa: F401

from timestep.api.openai.v1 import util
from timestep.api.openai.v1.models.base_model import Model
from timestep.api.openai.v1.models.create_completion_response_choices_inner_logprobs import \
    CreateCompletionResponseChoicesInnerLogprobs  # noqa: E501


class CreateCompletionResponseChoicesInner(Model):
    """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

    Do not edit the class manually.
    """

    def __init__(self, finish_reason=None, index=None, logprobs=None, text=None):  # noqa: E501
        """CreateCompletionResponseChoicesInner - a model defined in OpenAPI

        :param finish_reason: The finish_reason of this CreateCompletionResponseChoicesInner.  # noqa: E501
        :type finish_reason: str
        :param index: The index of this CreateCompletionResponseChoicesInner.  # noqa: E501
        :type index: int
        :param logprobs: The logprobs of this CreateCompletionResponseChoicesInner.  # noqa: E501
        :type logprobs: CreateCompletionResponseChoicesInnerLogprobs
        :param text: The text of this CreateCompletionResponseChoicesInner.  # noqa: E501
        :type text: str
        """
        self.openapi_types = {
            'finish_reason': str,
            'index': int,
            'logprobs': CreateCompletionResponseChoicesInnerLogprobs,
            'text': str
        }

        self.attribute_map = {
            'finish_reason': 'finish_reason',
            'index': 'index',
            'logprobs': 'logprobs',
            'text': 'text'
        }

        self._finish_reason = finish_reason
        self._index = index
        self._logprobs = logprobs
        self._text = text

    @classmethod
    def from_dict(cls, dikt) -> 'CreateCompletionResponseChoicesInner':
        """Returns the dict as a model

        :param dikt: A dict.
        :type: dict
        :return: The CreateCompletionResponse_choices_inner of this CreateCompletionResponseChoicesInner.  # noqa: E501
        :rtype: CreateCompletionResponseChoicesInner
        """
        return util.deserialize_model(dikt, cls)

    @property
    def finish_reason(self) -> str:
        """Gets the finish_reason of this CreateCompletionResponseChoicesInner.

        The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, or `content_filter` if content was omitted due to a flag from our content filters.   # noqa: E501

        :return: The finish_reason of this CreateCompletionResponseChoicesInner.
        :rtype: str
        """
        return self._finish_reason

    @finish_reason.setter
    def finish_reason(self, finish_reason: str):
        """Sets the finish_reason of this CreateCompletionResponseChoicesInner.

        The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, or `content_filter` if content was omitted due to a flag from our content filters.   # noqa: E501

        :param finish_reason: The finish_reason of this CreateCompletionResponseChoicesInner.
        :type finish_reason: str
        """
        allowed_values = ["stop", "length", "content_filter"]  # noqa: E501
        if finish_reason not in allowed_values:
            raise ValueError(
                "Invalid value for `finish_reason` ({0}), must be one of {1}"
                .format(finish_reason, allowed_values)
            )

        self._finish_reason = finish_reason

    @property
    def index(self) -> int:
        """Gets the index of this CreateCompletionResponseChoicesInner.


        :return: The index of this CreateCompletionResponseChoicesInner.
        :rtype: int
        """
        return self._index

    @index.setter
    def index(self, index: int):
        """Sets the index of this CreateCompletionResponseChoicesInner.


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

        self._index = index

    @property
    def logprobs(self) -> CreateCompletionResponseChoicesInnerLogprobs:
        """Gets the logprobs of this CreateCompletionResponseChoicesInner.


        :return: The logprobs of this CreateCompletionResponseChoicesInner.
        :rtype: CreateCompletionResponseChoicesInnerLogprobs
        """
        return self._logprobs

    @logprobs.setter
    def logprobs(self, logprobs: CreateCompletionResponseChoicesInnerLogprobs):
        """Sets the logprobs of this CreateCompletionResponseChoicesInner.


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

        self._logprobs = logprobs

    @property
    def text(self) -> str:
        """Gets the text of this CreateCompletionResponseChoicesInner.


        :return: The text of this CreateCompletionResponseChoicesInner.
        :rtype: str
        """
        return self._text

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


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

        self._text = text
