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.fine_tuning_job_error import \
    FineTuningJobError  # noqa: E501
from timestep.api.openai.v1.models.fine_tuning_job_hyperparameters import \
    FineTuningJobHyperparameters  # noqa: E501
from timestep.api.openai.v1.models.fine_tuning_job_integrations_inner import \
    FineTuningJobIntegrationsInner  # noqa: E501


class FineTuningJob(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, created_at=None, error=None, fine_tuned_model=None, finished_at=None, hyperparameters=None, model=None, object=None, organization_id=None, result_files=None, status=None, trained_tokens=None, training_file=None, validation_file=None, integrations=None, seed=None, estimated_finish=None):  # noqa: E501
        """FineTuningJob - a model defined in OpenAPI

        :param id: The id of this FineTuningJob.  # noqa: E501
        :type id: str
        :param created_at: The created_at of this FineTuningJob.  # noqa: E501
        :type created_at: int
        :param error: The error of this FineTuningJob.  # noqa: E501
        :type error: FineTuningJobError
        :param fine_tuned_model: The fine_tuned_model of this FineTuningJob.  # noqa: E501
        :type fine_tuned_model: str
        :param finished_at: The finished_at of this FineTuningJob.  # noqa: E501
        :type finished_at: int
        :param hyperparameters: The hyperparameters of this FineTuningJob.  # noqa: E501
        :type hyperparameters: FineTuningJobHyperparameters
        :param model: The model of this FineTuningJob.  # noqa: E501
        :type model: str
        :param object: The object of this FineTuningJob.  # noqa: E501
        :type object: str
        :param organization_id: The organization_id of this FineTuningJob.  # noqa: E501
        :type organization_id: str
        :param result_files: The result_files of this FineTuningJob.  # noqa: E501
        :type result_files: List[str]
        :param status: The status of this FineTuningJob.  # noqa: E501
        :type status: str
        :param trained_tokens: The trained_tokens of this FineTuningJob.  # noqa: E501
        :type trained_tokens: int
        :param training_file: The training_file of this FineTuningJob.  # noqa: E501
        :type training_file: str
        :param validation_file: The validation_file of this FineTuningJob.  # noqa: E501
        :type validation_file: str
        :param integrations: The integrations of this FineTuningJob.  # noqa: E501
        :type integrations: List[FineTuningJobIntegrationsInner]
        :param seed: The seed of this FineTuningJob.  # noqa: E501
        :type seed: int
        :param estimated_finish: The estimated_finish of this FineTuningJob.  # noqa: E501
        :type estimated_finish: int
        """
        self.openapi_types = {
            'id': str,
            'created_at': int,
            'error': FineTuningJobError,
            'fine_tuned_model': str,
            'finished_at': int,
            'hyperparameters': FineTuningJobHyperparameters,
            'model': str,
            'object': str,
            'organization_id': str,
            'result_files': List[str],
            'status': str,
            'trained_tokens': int,
            'training_file': str,
            'validation_file': str,
            'integrations': List[FineTuningJobIntegrationsInner],
            'seed': int,
            'estimated_finish': int
        }

        self.attribute_map = {
            'id': 'id',
            'created_at': 'created_at',
            'error': 'error',
            'fine_tuned_model': 'fine_tuned_model',
            'finished_at': 'finished_at',
            'hyperparameters': 'hyperparameters',
            'model': 'model',
            'object': 'object',
            'organization_id': 'organization_id',
            'result_files': 'result_files',
            'status': 'status',
            'trained_tokens': 'trained_tokens',
            'training_file': 'training_file',
            'validation_file': 'validation_file',
            'integrations': 'integrations',
            'seed': 'seed',
            'estimated_finish': 'estimated_finish'
        }

        self._id = id
        self._created_at = created_at
        self._error = error
        self._fine_tuned_model = fine_tuned_model
        self._finished_at = finished_at
        self._hyperparameters = hyperparameters
        self._model = model
        self._object = object
        self._organization_id = organization_id
        self._result_files = result_files
        self._status = status
        self._trained_tokens = trained_tokens
        self._training_file = training_file
        self._validation_file = validation_file
        self._integrations = integrations
        self._seed = seed
        self._estimated_finish = estimated_finish

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

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

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

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

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

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

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

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

        self._id = id

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

        The Unix timestamp (in seconds) for when the fine-tuning job was created.  # noqa: E501

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

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

        The Unix timestamp (in seconds) for when the fine-tuning job was created.  # noqa: E501

        :param created_at: The created_at of this FineTuningJob.
        :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 error(self) -> FineTuningJobError:
        """Gets the error of this FineTuningJob.


        :return: The error of this FineTuningJob.
        :rtype: FineTuningJobError
        """
        return self._error

    @error.setter
    def error(self, error: FineTuningJobError):
        """Sets the error of this FineTuningJob.


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

        self._error = error

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

        The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.  # noqa: E501

        :return: The fine_tuned_model of this FineTuningJob.
        :rtype: str
        """
        return self._fine_tuned_model

    @fine_tuned_model.setter
    def fine_tuned_model(self, fine_tuned_model: str):
        """Sets the fine_tuned_model of this FineTuningJob.

        The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.  # noqa: E501

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

        self._fine_tuned_model = fine_tuned_model

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

        The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.  # noqa: E501

        :return: The finished_at of this FineTuningJob.
        :rtype: int
        """
        return self._finished_at

    @finished_at.setter
    def finished_at(self, finished_at: int):
        """Sets the finished_at of this FineTuningJob.

        The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.  # noqa: E501

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

        self._finished_at = finished_at

    @property
    def hyperparameters(self) -> FineTuningJobHyperparameters:
        """Gets the hyperparameters of this FineTuningJob.


        :return: The hyperparameters of this FineTuningJob.
        :rtype: FineTuningJobHyperparameters
        """
        return self._hyperparameters

    @hyperparameters.setter
    def hyperparameters(self, hyperparameters: FineTuningJobHyperparameters):
        """Sets the hyperparameters of this FineTuningJob.


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

        self._hyperparameters = hyperparameters

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

        The base model that is being fine-tuned.  # noqa: E501

        :return: The model of this FineTuningJob.
        :rtype: str
        """
        return self._model

    @model.setter
    def model(self, model: str):
        """Sets the model of this FineTuningJob.

        The base model that is being fine-tuned.  # noqa: E501

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

        self._model = model

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

        The object type, which is always \"fine_tuning.job\".  # noqa: E501

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

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

        The object type, which is always \"fine_tuning.job\".  # noqa: E501

        :param object: The object of this FineTuningJob.
        :type object: str
        """
        allowed_values = ["fine_tuning.job"]  # 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 organization_id(self) -> str:
        """Gets the organization_id of this FineTuningJob.

        The organization that owns the fine-tuning job.  # noqa: E501

        :return: The organization_id of this FineTuningJob.
        :rtype: str
        """
        return self._organization_id

    @organization_id.setter
    def organization_id(self, organization_id: str):
        """Sets the organization_id of this FineTuningJob.

        The organization that owns the fine-tuning job.  # noqa: E501

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

        self._organization_id = organization_id

    @property
    def result_files(self) -> List[str]:
        """Gets the result_files of this FineTuningJob.

        The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents).  # noqa: E501

        :return: The result_files of this FineTuningJob.
        :rtype: List[str]
        """
        return self._result_files

    @result_files.setter
    def result_files(self, result_files: List[str]):
        """Sets the result_files of this FineTuningJob.

        The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents).  # noqa: E501

        :param result_files: The result_files of this FineTuningJob.
        :type result_files: List[str]
        """
        if result_files is None:
            raise ValueError("Invalid value for `result_files`, must not be `None`")  # noqa: E501

        self._result_files = result_files

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

        The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.  # noqa: E501

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

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

        The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.  # noqa: E501

        :param status: The status of this FineTuningJob.
        :type status: str
        """
        allowed_values = ["validating_files", "queued", "running", "succeeded", "failed", "cancelled"]  # 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 trained_tokens(self) -> int:
        """Gets the trained_tokens of this FineTuningJob.

        The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.  # noqa: E501

        :return: The trained_tokens of this FineTuningJob.
        :rtype: int
        """
        return self._trained_tokens

    @trained_tokens.setter
    def trained_tokens(self, trained_tokens: int):
        """Sets the trained_tokens of this FineTuningJob.

        The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.  # noqa: E501

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

        self._trained_tokens = trained_tokens

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

        The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents).  # noqa: E501

        :return: The training_file of this FineTuningJob.
        :rtype: str
        """
        return self._training_file

    @training_file.setter
    def training_file(self, training_file: str):
        """Sets the training_file of this FineTuningJob.

        The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents).  # noqa: E501

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

        self._training_file = training_file

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

        The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents).  # noqa: E501

        :return: The validation_file of this FineTuningJob.
        :rtype: str
        """
        return self._validation_file

    @validation_file.setter
    def validation_file(self, validation_file: str):
        """Sets the validation_file of this FineTuningJob.

        The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents).  # noqa: E501

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

        self._validation_file = validation_file

    @property
    def integrations(self) -> List[FineTuningJobIntegrationsInner]:
        """Gets the integrations of this FineTuningJob.

        A list of integrations to enable for this fine-tuning job.  # noqa: E501

        :return: The integrations of this FineTuningJob.
        :rtype: List[FineTuningJobIntegrationsInner]
        """
        return self._integrations

    @integrations.setter
    def integrations(self, integrations: List[FineTuningJobIntegrationsInner]):
        """Sets the integrations of this FineTuningJob.

        A list of integrations to enable for this fine-tuning job.  # noqa: E501

        :param integrations: The integrations of this FineTuningJob.
        :type integrations: List[FineTuningJobIntegrationsInner]
        """
        if integrations is not None and len(integrations) > 5:
            raise ValueError("Invalid value for `integrations`, number of items must be less than or equal to `5`")  # noqa: E501

        self._integrations = integrations

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

        The seed used for the fine-tuning job.  # noqa: E501

        :return: The seed of this FineTuningJob.
        :rtype: int
        """
        return self._seed

    @seed.setter
    def seed(self, seed: int):
        """Sets the seed of this FineTuningJob.

        The seed used for the fine-tuning job.  # noqa: E501

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

        self._seed = seed

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

        The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.  # noqa: E501

        :return: The estimated_finish of this FineTuningJob.
        :rtype: int
        """
        return self._estimated_finish

    @estimated_finish.setter
    def estimated_finish(self, estimated_finish: int):
        """Sets the estimated_finish of this FineTuningJob.

        The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.  # noqa: E501

        :param estimated_finish: The estimated_finish of this FineTuningJob.
        :type estimated_finish: int
        """

        self._estimated_finish = estimated_finish
