# coding: utf-8

"""
    HCX API

    The HCX REST API. Please see https://api.ncloud-docs.com/docs/ai-naver-clovastudio-summary for more details.

    The version of the OpenAPI document: 24.1.5
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictBytes, StrictStr, field_validator
from typing import Optional, Union
from typing_extensions import Annotated
from pyhcx.models.delete_training_task200_response import DeleteTrainingTask200Response
from pyhcx.models.get_training_task_list_response import GetTrainingTaskListResponse
from pyhcx.models.training_task_response import TrainingTaskResponse

from pyhcx.api_client import ApiClient, RequestSerialized
from pyhcx.api_response import ApiResponse
from pyhcx.rest import RESTResponseType


class FineTuningApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def create_training_task(
        self,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Annotated[StrictStr, Field(description="request id")],
        model: Annotated[StrictStr, Field(description="Tuning model name")],
        training_dataset: Annotated[Union[StrictBytes, StrictStr], Field(description="Path to the training dataset file")],
        name: Annotated[Optional[StrictStr], Field(description="Training name (default: training creation date)")] = None,
        tuning_type: Annotated[Optional[StrictStr], Field(description="Tuning technique")] = None,
        task_type: Annotated[Optional[StrictStr], Field(description="Task type")] = None,
        train_epochs: Annotated[Optional[StrictStr], Field(description="Number of epochs for training")] = None,
        learning_rate: Annotated[Optional[StrictStr], Field(description="Learning rate")] = None,
        training_dataset_file_path: Annotated[Optional[StrictStr], Field(description="Path to the large dataset file (if uploaded to NCP Object Storage)")] = None,
        training_dataset_bucket: Annotated[Optional[StrictStr], Field(description="Bucket name where the large dataset file is uploaded (required if trainingDatasetFilePath is provided)")] = None,
        training_dataset_access_key: Annotated[Optional[StrictStr], Field(description="Access key for the large dataset file (required if trainingDatasetFilePath is provided)")] = None,
        training_dataset_secret_key: Annotated[Optional[StrictStr], Field(description="Secret key for the large dataset file (required if trainingDatasetFilePath is provided)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> TrainingTaskResponse:
        """create_training_task


        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id: request id (required)
        :type x_ncp_clovastudio_request_id: str
        :param model: Tuning model name (required)
        :type model: str
        :param training_dataset: Path to the training dataset file (required)
        :type training_dataset: bytearray
        :param name: Training name (default: training creation date)
        :type name: str
        :param tuning_type: Tuning technique
        :type tuning_type: str
        :param task_type: Task type
        :type task_type: str
        :param train_epochs: Number of epochs for training
        :type train_epochs: str
        :param learning_rate: Learning rate
        :type learning_rate: str
        :param training_dataset_file_path: Path to the large dataset file (if uploaded to NCP Object Storage)
        :type training_dataset_file_path: str
        :param training_dataset_bucket: Bucket name where the large dataset file is uploaded (required if trainingDatasetFilePath is provided)
        :type training_dataset_bucket: str
        :param training_dataset_access_key: Access key for the large dataset file (required if trainingDatasetFilePath is provided)
        :type training_dataset_access_key: str
        :param training_dataset_secret_key: Secret key for the large dataset file (required if trainingDatasetFilePath is provided)
        :type training_dataset_secret_key: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_training_task_serialize(
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            model=model,
            training_dataset=training_dataset,
            name=name,
            tuning_type=tuning_type,
            task_type=task_type,
            train_epochs=train_epochs,
            learning_rate=learning_rate,
            training_dataset_file_path=training_dataset_file_path,
            training_dataset_bucket=training_dataset_bucket,
            training_dataset_access_key=training_dataset_access_key,
            training_dataset_secret_key=training_dataset_secret_key,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TrainingTaskResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def create_training_task_with_http_info(
        self,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Annotated[StrictStr, Field(description="request id")],
        model: Annotated[StrictStr, Field(description="Tuning model name")],
        training_dataset: Annotated[Union[StrictBytes, StrictStr], Field(description="Path to the training dataset file")],
        name: Annotated[Optional[StrictStr], Field(description="Training name (default: training creation date)")] = None,
        tuning_type: Annotated[Optional[StrictStr], Field(description="Tuning technique")] = None,
        task_type: Annotated[Optional[StrictStr], Field(description="Task type")] = None,
        train_epochs: Annotated[Optional[StrictStr], Field(description="Number of epochs for training")] = None,
        learning_rate: Annotated[Optional[StrictStr], Field(description="Learning rate")] = None,
        training_dataset_file_path: Annotated[Optional[StrictStr], Field(description="Path to the large dataset file (if uploaded to NCP Object Storage)")] = None,
        training_dataset_bucket: Annotated[Optional[StrictStr], Field(description="Bucket name where the large dataset file is uploaded (required if trainingDatasetFilePath is provided)")] = None,
        training_dataset_access_key: Annotated[Optional[StrictStr], Field(description="Access key for the large dataset file (required if trainingDatasetFilePath is provided)")] = None,
        training_dataset_secret_key: Annotated[Optional[StrictStr], Field(description="Secret key for the large dataset file (required if trainingDatasetFilePath is provided)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> ApiResponse[TrainingTaskResponse]:
        """create_training_task


        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id: request id (required)
        :type x_ncp_clovastudio_request_id: str
        :param model: Tuning model name (required)
        :type model: str
        :param training_dataset: Path to the training dataset file (required)
        :type training_dataset: bytearray
        :param name: Training name (default: training creation date)
        :type name: str
        :param tuning_type: Tuning technique
        :type tuning_type: str
        :param task_type: Task type
        :type task_type: str
        :param train_epochs: Number of epochs for training
        :type train_epochs: str
        :param learning_rate: Learning rate
        :type learning_rate: str
        :param training_dataset_file_path: Path to the large dataset file (if uploaded to NCP Object Storage)
        :type training_dataset_file_path: str
        :param training_dataset_bucket: Bucket name where the large dataset file is uploaded (required if trainingDatasetFilePath is provided)
        :type training_dataset_bucket: str
        :param training_dataset_access_key: Access key for the large dataset file (required if trainingDatasetFilePath is provided)
        :type training_dataset_access_key: str
        :param training_dataset_secret_key: Secret key for the large dataset file (required if trainingDatasetFilePath is provided)
        :type training_dataset_secret_key: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_training_task_serialize(
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            model=model,
            training_dataset=training_dataset,
            name=name,
            tuning_type=tuning_type,
            task_type=task_type,
            train_epochs=train_epochs,
            learning_rate=learning_rate,
            training_dataset_file_path=training_dataset_file_path,
            training_dataset_bucket=training_dataset_bucket,
            training_dataset_access_key=training_dataset_access_key,
            training_dataset_secret_key=training_dataset_secret_key,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TrainingTaskResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def create_training_task_without_preload_content(
        self,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Annotated[StrictStr, Field(description="request id")],
        model: Annotated[StrictStr, Field(description="Tuning model name")],
        training_dataset: Annotated[Union[StrictBytes, StrictStr], Field(description="Path to the training dataset file")],
        name: Annotated[Optional[StrictStr], Field(description="Training name (default: training creation date)")] = None,
        tuning_type: Annotated[Optional[StrictStr], Field(description="Tuning technique")] = None,
        task_type: Annotated[Optional[StrictStr], Field(description="Task type")] = None,
        train_epochs: Annotated[Optional[StrictStr], Field(description="Number of epochs for training")] = None,
        learning_rate: Annotated[Optional[StrictStr], Field(description="Learning rate")] = None,
        training_dataset_file_path: Annotated[Optional[StrictStr], Field(description="Path to the large dataset file (if uploaded to NCP Object Storage)")] = None,
        training_dataset_bucket: Annotated[Optional[StrictStr], Field(description="Bucket name where the large dataset file is uploaded (required if trainingDatasetFilePath is provided)")] = None,
        training_dataset_access_key: Annotated[Optional[StrictStr], Field(description="Access key for the large dataset file (required if trainingDatasetFilePath is provided)")] = None,
        training_dataset_secret_key: Annotated[Optional[StrictStr], Field(description="Secret key for the large dataset file (required if trainingDatasetFilePath is provided)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> RESTResponseType:
        """create_training_task


        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id: request id (required)
        :type x_ncp_clovastudio_request_id: str
        :param model: Tuning model name (required)
        :type model: str
        :param training_dataset: Path to the training dataset file (required)
        :type training_dataset: bytearray
        :param name: Training name (default: training creation date)
        :type name: str
        :param tuning_type: Tuning technique
        :type tuning_type: str
        :param task_type: Task type
        :type task_type: str
        :param train_epochs: Number of epochs for training
        :type train_epochs: str
        :param learning_rate: Learning rate
        :type learning_rate: str
        :param training_dataset_file_path: Path to the large dataset file (if uploaded to NCP Object Storage)
        :type training_dataset_file_path: str
        :param training_dataset_bucket: Bucket name where the large dataset file is uploaded (required if trainingDatasetFilePath is provided)
        :type training_dataset_bucket: str
        :param training_dataset_access_key: Access key for the large dataset file (required if trainingDatasetFilePath is provided)
        :type training_dataset_access_key: str
        :param training_dataset_secret_key: Secret key for the large dataset file (required if trainingDatasetFilePath is provided)
        :type training_dataset_secret_key: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_training_task_serialize(
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            model=model,
            training_dataset=training_dataset,
            name=name,
            tuning_type=tuning_type,
            task_type=task_type,
            train_epochs=train_epochs,
            learning_rate=learning_rate,
            training_dataset_file_path=training_dataset_file_path,
            training_dataset_bucket=training_dataset_bucket,
            training_dataset_access_key=training_dataset_access_key,
            training_dataset_secret_key=training_dataset_secret_key,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TrainingTaskResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _create_training_task_serialize(
        self,
        x_ncp_apigw_timestamp,
        x_ncp_clovastudio_request_id,
        model,
        training_dataset,
        name,
        tuning_type,
        task_type,
        train_epochs,
        learning_rate,
        training_dataset_file_path,
        training_dataset_bucket,
        training_dataset_access_key,
        training_dataset_secret_key,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _hosts = [
            'https://clovastudio.apigw.ntruss.com'
        ]
        _host = _hosts[_host_index]

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[str, Union[str, bytes]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        if x_ncp_apigw_timestamp is not None:
            _header_params['X-NCP-APIGW-TIMESTAMP'] = x_ncp_apigw_timestamp
        if x_ncp_clovastudio_request_id is not None:
            _header_params['X-NCP-CLOVASTUDIO-REQUEST-ID'] = x_ncp_clovastudio_request_id
        # process the form parameters
        if name is not None:
            _form_params.append(('name', name))
        if model is not None:
            _form_params.append(('model', model))
        if tuning_type is not None:
            _form_params.append(('tuningType', tuning_type))
        if task_type is not None:
            _form_params.append(('taskType', task_type))
        if train_epochs is not None:
            _form_params.append(('trainEpochs', train_epochs))
        if learning_rate is not None:
            _form_params.append(('learningRate', learning_rate))
        if training_dataset is not None:
            _files['trainingDataset'] = training_dataset
        if training_dataset_file_path is not None:
            _form_params.append(('trainingDatasetFilePath', training_dataset_file_path))
        if training_dataset_bucket is not None:
            _form_params.append(('trainingDatasetBucket', training_dataset_bucket))
        if training_dataset_access_key is not None:
            _form_params.append(('trainingDatasetAccessKey', training_dataset_access_key))
        if training_dataset_secret_key is not None:
            _form_params.append(('trainingDatasetSecretKey', training_dataset_secret_key))
        # process the body parameter


        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            [
                'application/json'
            ]
        )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'multipart/form-data'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'ApigwSignatureKey', 
            'IamAccessKey'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/tuning/v2/tasks',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def delete_training_task(
        self,
        task_id: StrictStr,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Optional[StrictStr] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> DeleteTrainingTask200Response:
        """delete_training_task


        :param task_id: (required)
        :type task_id: str
        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id:
        :type x_ncp_clovastudio_request_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_training_task_serialize(
            task_id=task_id,
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "DeleteTrainingTask200Response",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def delete_training_task_with_http_info(
        self,
        task_id: StrictStr,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Optional[StrictStr] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> ApiResponse[DeleteTrainingTask200Response]:
        """delete_training_task


        :param task_id: (required)
        :type task_id: str
        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id:
        :type x_ncp_clovastudio_request_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_training_task_serialize(
            task_id=task_id,
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "DeleteTrainingTask200Response",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def delete_training_task_without_preload_content(
        self,
        task_id: StrictStr,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Optional[StrictStr] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> RESTResponseType:
        """delete_training_task


        :param task_id: (required)
        :type task_id: str
        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id:
        :type x_ncp_clovastudio_request_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_training_task_serialize(
            task_id=task_id,
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "DeleteTrainingTask200Response",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _delete_training_task_serialize(
        self,
        task_id,
        x_ncp_apigw_timestamp,
        x_ncp_clovastudio_request_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _hosts = [
            'https://clovastudio.apigw.ntruss.com'
        ]
        _host = _hosts[_host_index]

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[str, Union[str, bytes]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if task_id is not None:
            _path_params['taskId'] = task_id
        # process the query parameters
        # process the header parameters
        if x_ncp_apigw_timestamp is not None:
            _header_params['X-NCP-APIGW-TIMESTAMP'] = x_ncp_apigw_timestamp
        if x_ncp_clovastudio_request_id is not None:
            _header_params['X-NCP-CLOVASTUDIO-REQUEST-ID'] = x_ncp_clovastudio_request_id
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            [
                'application/json'
            ]
        )


        # authentication setting
        _auth_settings: List[str] = [
            'ApigwSignatureKey', 
            'IamAccessKey'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/tuning/v2/tasks/{taskId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_training_task_list(
        self,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Annotated[StrictStr, Field(description="request id")],
        size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None,
        page: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> GetTrainingTaskListResponse:
        """get_training_task_list


        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id: request id (required)
        :type x_ncp_clovastudio_request_id: str
        :param size:
        :type size: int
        :param page:
        :type page: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_training_task_list_serialize(
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            size=size,
            page=page,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetTrainingTaskListResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_training_task_list_with_http_info(
        self,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Annotated[StrictStr, Field(description="request id")],
        size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None,
        page: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> ApiResponse[GetTrainingTaskListResponse]:
        """get_training_task_list


        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id: request id (required)
        :type x_ncp_clovastudio_request_id: str
        :param size:
        :type size: int
        :param page:
        :type page: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_training_task_list_serialize(
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            size=size,
            page=page,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetTrainingTaskListResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_training_task_list_without_preload_content(
        self,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Annotated[StrictStr, Field(description="request id")],
        size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None,
        page: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> RESTResponseType:
        """get_training_task_list


        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id: request id (required)
        :type x_ncp_clovastudio_request_id: str
        :param size:
        :type size: int
        :param page:
        :type page: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_training_task_list_serialize(
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            size=size,
            page=page,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetTrainingTaskListResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_training_task_list_serialize(
        self,
        x_ncp_apigw_timestamp,
        x_ncp_clovastudio_request_id,
        size,
        page,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _hosts = [
            'https://clovastudio.apigw.ntruss.com'
        ]
        _host = _hosts[_host_index]

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[str, Union[str, bytes]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if size is not None:
            
            _query_params.append(('size', size))
            
        if page is not None:
            
            _query_params.append(('page', page))
            
        # process the header parameters
        if x_ncp_apigw_timestamp is not None:
            _header_params['X-NCP-APIGW-TIMESTAMP'] = x_ncp_apigw_timestamp
        if x_ncp_clovastudio_request_id is not None:
            _header_params['X-NCP-CLOVASTUDIO-REQUEST-ID'] = x_ncp_clovastudio_request_id
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            [
                'application/json'
            ]
        )


        # authentication setting
        _auth_settings: List[str] = [
            'ApigwSignatureKey', 
            'IamAccessKey'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/tuning/v2/tasks',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_training_task_status(
        self,
        task_id: StrictStr,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Optional[StrictStr] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> TrainingTaskResponse:
        """get_training_task_status


        :param task_id: (required)
        :type task_id: str
        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id:
        :type x_ncp_clovastudio_request_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_training_task_status_serialize(
            task_id=task_id,
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TrainingTaskResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_training_task_status_with_http_info(
        self,
        task_id: StrictStr,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Optional[StrictStr] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> ApiResponse[TrainingTaskResponse]:
        """get_training_task_status


        :param task_id: (required)
        :type task_id: str
        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id:
        :type x_ncp_clovastudio_request_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_training_task_status_serialize(
            task_id=task_id,
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TrainingTaskResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_training_task_status_without_preload_content(
        self,
        task_id: StrictStr,
        x_ncp_apigw_timestamp: StrictStr,
        x_ncp_clovastudio_request_id: Optional[StrictStr] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0,
    ) -> RESTResponseType:
        """get_training_task_status


        :param task_id: (required)
        :type task_id: str
        :param x_ncp_apigw_timestamp: (required)
        :type x_ncp_apigw_timestamp: str
        :param x_ncp_clovastudio_request_id:
        :type x_ncp_clovastudio_request_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_training_task_status_serialize(
            task_id=task_id,
            x_ncp_apigw_timestamp=x_ncp_apigw_timestamp,
            x_ncp_clovastudio_request_id=x_ncp_clovastudio_request_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TrainingTaskResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_training_task_status_serialize(
        self,
        task_id,
        x_ncp_apigw_timestamp,
        x_ncp_clovastudio_request_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _hosts = [
            'https://clovastudio.apigw.ntruss.com'
        ]
        _host = _hosts[_host_index]

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[str, Union[str, bytes]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if task_id is not None:
            _path_params['taskId'] = task_id
        # process the query parameters
        # process the header parameters
        if x_ncp_apigw_timestamp is not None:
            _header_params['X-NCP-APIGW-TIMESTAMP'] = x_ncp_apigw_timestamp
        if x_ncp_clovastudio_request_id is not None:
            _header_params['X-NCP-CLOVASTUDIO-REQUEST-ID'] = x_ncp_clovastudio_request_id
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            [
                'application/json'
            ]
        )


        # authentication setting
        _auth_settings: List[str] = [
            'ApigwSignatureKey', 
            'IamAccessKey'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/tuning/v2/tasks/{taskId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


