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


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

    Do not edit the class manually.
    """

    def __init__(self, code=None, message=None):  # noqa: E501
        """RunObjectLastError - a model defined in OpenAPI

        :param code: The code of this RunObjectLastError.  # noqa: E501
        :type code: str
        :param message: The message of this RunObjectLastError.  # noqa: E501
        :type message: str
        """
        self.openapi_types = {
            'code': str,
            'message': str
        }

        self.attribute_map = {
            'code': 'code',
            'message': 'message'
        }

        self._code = code
        self._message = message

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

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

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

        One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.  # noqa: E501

        :return: The code of this RunObjectLastError.
        :rtype: str
        """
        return self._code

    @code.setter
    def code(self, code: str):
        """Sets the code of this RunObjectLastError.

        One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.  # noqa: E501

        :param code: The code of this RunObjectLastError.
        :type code: str
        """
        allowed_values = ["server_error", "rate_limit_exceeded", "invalid_prompt"]  # noqa: E501
        if code not in allowed_values:
            raise ValueError(
                "Invalid value for `code` ({0}), must be one of {1}"
                .format(code, allowed_values)
            )

        self._code = code

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

        A human-readable description of the error.  # noqa: E501

        :return: The message of this RunObjectLastError.
        :rtype: str
        """
        return self._message

    @message.setter
    def message(self, message: str):
        """Sets the message of this RunObjectLastError.

        A human-readable description of the error.  # noqa: E501

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

        self._message = message
