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.run_step_completion_usage import \
    RunStepCompletionUsage  # noqa: E501
from timestep.api.openai.v1.models.run_step_object_last_error import \
    RunStepObjectLastError  # noqa: E501
from timestep.api.openai.v1.models.run_step_object_step_details import \
    RunStepObjectStepDetails  # noqa: E501


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

    Do not edit the class manually.
    """

    def __init__(self, id=None, object=None, created_at=None, assistant_id=None, thread_id=None, run_id=None, type=None, status=None, step_details=None, last_error=None, expired_at=None, cancelled_at=None, failed_at=None, completed_at=None, metadata=None, usage=None):  # noqa: E501
        """RunStepObject - a model defined in OpenAPI

        :param id: The id of this RunStepObject.  # noqa: E501
        :type id: str
        :param object: The object of this RunStepObject.  # noqa: E501
        :type object: str
        :param created_at: The created_at of this RunStepObject.  # noqa: E501
        :type created_at: int
        :param assistant_id: The assistant_id of this RunStepObject.  # noqa: E501
        :type assistant_id: str
        :param thread_id: The thread_id of this RunStepObject.  # noqa: E501
        :type thread_id: str
        :param run_id: The run_id of this RunStepObject.  # noqa: E501
        :type run_id: str
        :param type: The type of this RunStepObject.  # noqa: E501
        :type type: str
        :param status: The status of this RunStepObject.  # noqa: E501
        :type status: str
        :param step_details: The step_details of this RunStepObject.  # noqa: E501
        :type step_details: RunStepObjectStepDetails
        :param last_error: The last_error of this RunStepObject.  # noqa: E501
        :type last_error: RunStepObjectLastError
        :param expired_at: The expired_at of this RunStepObject.  # noqa: E501
        :type expired_at: int
        :param cancelled_at: The cancelled_at of this RunStepObject.  # noqa: E501
        :type cancelled_at: int
        :param failed_at: The failed_at of this RunStepObject.  # noqa: E501
        :type failed_at: int
        :param completed_at: The completed_at of this RunStepObject.  # noqa: E501
        :type completed_at: int
        :param metadata: The metadata of this RunStepObject.  # noqa: E501
        :type metadata: object
        :param usage: The usage of this RunStepObject.  # noqa: E501
        :type usage: RunStepCompletionUsage
        """
        self.openapi_types = {
            'id': str,
            'object': str,
            'created_at': int,
            'assistant_id': str,
            'thread_id': str,
            'run_id': str,
            'type': str,
            'status': str,
            'step_details': RunStepObjectStepDetails,
            'last_error': RunStepObjectLastError,
            'expired_at': int,
            'cancelled_at': int,
            'failed_at': int,
            'completed_at': int,
            'metadata': object,
            'usage': RunStepCompletionUsage
        }

        self.attribute_map = {
            'id': 'id',
            'object': 'object',
            'created_at': 'created_at',
            'assistant_id': 'assistant_id',
            'thread_id': 'thread_id',
            'run_id': 'run_id',
            'type': 'type',
            'status': 'status',
            'step_details': 'step_details',
            'last_error': 'last_error',
            'expired_at': 'expired_at',
            'cancelled_at': 'cancelled_at',
            'failed_at': 'failed_at',
            'completed_at': 'completed_at',
            'metadata': 'metadata',
            'usage': 'usage'
        }

        self._id = id
        self._object = object
        self._created_at = created_at
        self._assistant_id = assistant_id
        self._thread_id = thread_id
        self._run_id = run_id
        self._type = type
        self._status = status
        self._step_details = step_details
        self._last_error = last_error
        self._expired_at = expired_at
        self._cancelled_at = cancelled_at
        self._failed_at = failed_at
        self._completed_at = completed_at
        self._metadata = metadata
        self._usage = usage

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

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

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

        The identifier of the run step, which can be referenced in API endpoints.  # noqa: E501

        :return: The id of this RunStepObject.
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id: str):
        """Sets the id of this RunStepObject.

        The identifier of the run step, which can be referenced in API endpoints.  # noqa: E501

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

        self._id = id

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

        The object type, which is always `thread.run.step`.  # noqa: E501

        :return: The object of this RunStepObject.
        :rtype: str
        """
        return self._object

    @object.setter
    def object(self, object: str):
        """Sets the object of this RunStepObject.

        The object type, which is always `thread.run.step`.  # noqa: E501

        :param object: The object of this RunStepObject.
        :type object: str
        """
        allowed_values = ["thread.run.step"]  # noqa: E501
        if object not in allowed_values:
            raise ValueError(
                "Invalid value for `object` ({0}), must be one of {1}"
                .format(object, allowed_values)
            )

        self._object = object

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

        The Unix timestamp (in seconds) for when the run step was created.  # noqa: E501

        :return: The created_at of this RunStepObject.
        :rtype: int
        """
        return self._created_at

    @created_at.setter
    def created_at(self, created_at: int):
        """Sets the created_at of this RunStepObject.

        The Unix timestamp (in seconds) for when the run step was created.  # noqa: E501

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

        self._created_at = created_at

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

        The ID of the [assistant](/docs/api-reference/assistants) associated with the run step.  # noqa: E501

        :return: The assistant_id of this RunStepObject.
        :rtype: str
        """
        return self._assistant_id

    @assistant_id.setter
    def assistant_id(self, assistant_id: str):
        """Sets the assistant_id of this RunStepObject.

        The ID of the [assistant](/docs/api-reference/assistants) associated with the run step.  # noqa: E501

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

        self._assistant_id = assistant_id

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

        The ID of the [thread](/docs/api-reference/threads) that was run.  # noqa: E501

        :return: The thread_id of this RunStepObject.
        :rtype: str
        """
        return self._thread_id

    @thread_id.setter
    def thread_id(self, thread_id: str):
        """Sets the thread_id of this RunStepObject.

        The ID of the [thread](/docs/api-reference/threads) that was run.  # noqa: E501

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

        self._thread_id = thread_id

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

        The ID of the [run](/docs/api-reference/runs) that this run step is a part of.  # noqa: E501

        :return: The run_id of this RunStepObject.
        :rtype: str
        """
        return self._run_id

    @run_id.setter
    def run_id(self, run_id: str):
        """Sets the run_id of this RunStepObject.

        The ID of the [run](/docs/api-reference/runs) that this run step is a part of.  # noqa: E501

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

        self._run_id = run_id

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

        The type of run step, which can be either `message_creation` or `tool_calls`.  # noqa: E501

        :return: The type of this RunStepObject.
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type: str):
        """Sets the type of this RunStepObject.

        The type of run step, which can be either `message_creation` or `tool_calls`.  # noqa: E501

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

        self._type = type

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

        The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.  # noqa: E501

        :return: The status of this RunStepObject.
        :rtype: str
        """
        return self._status

    @status.setter
    def status(self, status: str):
        """Sets the status of this RunStepObject.

        The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.  # noqa: E501

        :param status: The status of this RunStepObject.
        :type status: str
        """
        allowed_values = ["in_progress", "cancelled", "failed", "completed", "expired"]  # noqa: E501
        if status not in allowed_values:
            raise ValueError(
                "Invalid value for `status` ({0}), must be one of {1}"
                .format(status, allowed_values)
            )

        self._status = status

    @property
    def step_details(self) -> RunStepObjectStepDetails:
        """Gets the step_details of this RunStepObject.


        :return: The step_details of this RunStepObject.
        :rtype: RunStepObjectStepDetails
        """
        return self._step_details

    @step_details.setter
    def step_details(self, step_details: RunStepObjectStepDetails):
        """Sets the step_details of this RunStepObject.


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

        self._step_details = step_details

    @property
    def last_error(self) -> RunStepObjectLastError:
        """Gets the last_error of this RunStepObject.


        :return: The last_error of this RunStepObject.
        :rtype: RunStepObjectLastError
        """
        return self._last_error

    @last_error.setter
    def last_error(self, last_error: RunStepObjectLastError):
        """Sets the last_error of this RunStepObject.


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

        self._last_error = last_error

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

        The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.  # noqa: E501

        :return: The expired_at of this RunStepObject.
        :rtype: int
        """
        return self._expired_at

    @expired_at.setter
    def expired_at(self, expired_at: int):
        """Sets the expired_at of this RunStepObject.

        The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.  # noqa: E501

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

        self._expired_at = expired_at

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

        The Unix timestamp (in seconds) for when the run step was cancelled.  # noqa: E501

        :return: The cancelled_at of this RunStepObject.
        :rtype: int
        """
        return self._cancelled_at

    @cancelled_at.setter
    def cancelled_at(self, cancelled_at: int):
        """Sets the cancelled_at of this RunStepObject.

        The Unix timestamp (in seconds) for when the run step was cancelled.  # noqa: E501

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

        self._cancelled_at = cancelled_at

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

        The Unix timestamp (in seconds) for when the run step failed.  # noqa: E501

        :return: The failed_at of this RunStepObject.
        :rtype: int
        """
        return self._failed_at

    @failed_at.setter
    def failed_at(self, failed_at: int):
        """Sets the failed_at of this RunStepObject.

        The Unix timestamp (in seconds) for when the run step failed.  # noqa: E501

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

        self._failed_at = failed_at

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

        The Unix timestamp (in seconds) for when the run step completed.  # noqa: E501

        :return: The completed_at of this RunStepObject.
        :rtype: int
        """
        return self._completed_at

    @completed_at.setter
    def completed_at(self, completed_at: int):
        """Sets the completed_at of this RunStepObject.

        The Unix timestamp (in seconds) for when the run step completed.  # noqa: E501

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

        self._completed_at = completed_at

    @property
    def metadata(self) -> object:
        """Gets the metadata of this RunStepObject.

        Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.   # noqa: E501

        :return: The metadata of this RunStepObject.
        :rtype: object
        """
        return self._metadata

    @metadata.setter
    def metadata(self, metadata: object):
        """Sets the metadata of this RunStepObject.

        Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.   # noqa: E501

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

        self._metadata = metadata

    @property
    def usage(self) -> RunStepCompletionUsage:
        """Gets the usage of this RunStepObject.


        :return: The usage of this RunStepObject.
        :rtype: RunStepCompletionUsage
        """
        return self._usage

    @usage.setter
    def usage(self, usage: RunStepCompletionUsage):
        """Sets the usage of this RunStepObject.


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

        self._usage = usage
