# coding: utf-8

"""
Earnix Elevate Data API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

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

Do not edit the class manually.
"""


from typing import List, Optional

from pydantic.v1 import Field, StrictInt, validate_arguments
from typing_extensions import Annotated

from earnix_elevate.clients.data.api_client import ApiClient
from earnix_elevate.clients.data.api_response import ApiResponse
from earnix_elevate.clients.data.exceptions import ApiTypeError
from earnix_elevate.clients.data.models.create_recipe_request import CreateRecipeRequest
from earnix_elevate.clients.data.models.create_recipe_version_request import (
    CreateRecipeVersionRequest,
)
from earnix_elevate.clients.data.models.dataset_version_usage import DatasetVersionUsage
from earnix_elevate.clients.data.models.list_query import ListQuery
from earnix_elevate.clients.data.models.recipe_response import RecipeResponse
from earnix_elevate.clients.data.models.recipe_version_response import (
    RecipeVersionResponse,
)
from earnix_elevate.clients.data.models.recipes_response import RecipesResponse
from earnix_elevate.clients.data.models.update_recipe_request import UpdateRecipeRequest
from earnix_elevate.clients.data.models.update_recipe_version_request import (
    UpdateRecipeVersionRequest,
)


class RecipeServiceApi:
    """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_arguments
    def create_recipe(
        self,
        create_recipe_request: Annotated[
            CreateRecipeRequest,
            Field(
                ...,
                description="Request body containing the configuration details needed to create a new Recipe, including name, description, language, type, and initial code",
            ),
        ],
        **kwargs,
    ) -> RecipeResponse:
        """Create new recipe

        Creates a new recipe with version 1. The recipe can then be reused across multiple datasets.

        :param create_recipe_request: Request body containing the configuration details needed to create a new Recipe, including name, description, language, type, and initial code (required)
        :type create_recipe_request: CreateRecipeRequest
        :return: Returns the result object.
        :rtype: RecipeResponse
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the create_recipe_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.create_recipe_with_http_info(create_recipe_request, **kwargs)

    @validate_arguments
    def create_recipe_with_http_info(
        self,
        create_recipe_request: Annotated[
            CreateRecipeRequest,
            Field(
                ...,
                description="Request body containing the configuration details needed to create a new Recipe, including name, description, language, type, and initial code",
            ),
        ],
        **kwargs,
    ) -> ApiResponse:
        """Create new recipe

        Creates a new recipe with version 1. The recipe can then be reused across multiple datasets.

        :param create_recipe_request: Request body containing the configuration details needed to create a new Recipe, including name, description, language, type, and initial code (required)
        :type create_recipe_request: CreateRecipeRequest
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(RecipeResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["create_recipe_request"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_recipe" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params["create_recipe_request"] is not None:
            _body_params = _params["create_recipe_request"]

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

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get(
            "_content_type",
            self.api_client.select_header_content_type(["application/json"]),
        )
        if _content_types_list:
            _header_params["Content-Type"] = _content_types_list

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "201": "RecipeResponse",
        }

        return self.api_client.call_api(
            "/v1/recipes",
            "POST",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )

    @validate_arguments
    def create_recipe_version(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        create_recipe_version_request: Annotated[
            CreateRecipeVersionRequest,
            Field(
                ...,
                description="Request body containing optional code for creating a new version of a Recipe. If code is not provided, it will be copied from the latest version",
            ),
        ],
        **kwargs,
    ) -> RecipeVersionResponse:
        """Create new recipe version

        Creates new RecipeVersionEntity with versionNumber = latestVersionNumber + 1. If code is provided in the request, uses that code for the new version. If code is not provided, copies code from the latest version. Updates RecipeEntity.latestVersionNumber. Returns RecipeVersionResponse.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param create_recipe_version_request: Request body containing optional code for creating a new version of a Recipe. If code is not provided, it will be copied from the latest version (required)
        :type create_recipe_version_request: CreateRecipeVersionRequest
        :return: Returns the result object.
        :rtype: RecipeVersionResponse
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the create_recipe_version_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.create_recipe_version_with_http_info(
            recipe_id, create_recipe_version_request, **kwargs
        )

    @validate_arguments
    def create_recipe_version_with_http_info(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        create_recipe_version_request: Annotated[
            CreateRecipeVersionRequest,
            Field(
                ...,
                description="Request body containing optional code for creating a new version of a Recipe. If code is not provided, it will be copied from the latest version",
            ),
        ],
        **kwargs,
    ) -> ApiResponse:
        """Create new recipe version

        Creates new RecipeVersionEntity with versionNumber = latestVersionNumber + 1. If code is provided in the request, uses that code for the new version. If code is not provided, copies code from the latest version. Updates RecipeEntity.latestVersionNumber. Returns RecipeVersionResponse.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param create_recipe_version_request: Request body containing optional code for creating a new version of a Recipe. If code is not provided, it will be copied from the latest version (required)
        :type create_recipe_version_request: CreateRecipeVersionRequest
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(RecipeVersionResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["recipe_id", "create_recipe_version_request"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_recipe_version" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params["recipe_id"] is not None:
            _path_params["recipe-id"] = _params["recipe_id"]

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params["create_recipe_version_request"] is not None:
            _body_params = _params["create_recipe_version_request"]

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

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get(
            "_content_type",
            self.api_client.select_header_content_type(["application/json"]),
        )
        if _content_types_list:
            _header_params["Content-Type"] = _content_types_list

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "201": "RecipeVersionResponse",
        }

        return self.api_client.call_api(
            "/v1/recipes/{recipe-id}/versions",
            "POST",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )

    @validate_arguments
    def get_recipe(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        **kwargs,
    ) -> RecipeResponse:
        """Get recipe

        Returns Recipe - recipe base information from RecipeEntity (id, name, description, language, latestVersionNumber). Does NOT include version-specific code. To get code, use GET /v1/recipes/{recipe-id}/versions/{version-number}

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :return: Returns the result object.
        :rtype: RecipeResponse
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the get_recipe_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.get_recipe_with_http_info(recipe_id, **kwargs)

    @validate_arguments
    def get_recipe_with_http_info(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        **kwargs,
    ) -> ApiResponse:
        """Get recipe

        Returns Recipe - recipe base information from RecipeEntity (id, name, description, language, latestVersionNumber). Does NOT include version-specific code. To get code, use GET /v1/recipes/{recipe-id}/versions/{version-number}

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(RecipeResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["recipe_id"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_recipe" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params["recipe_id"] is not None:
            _path_params["recipe-id"] = _params["recipe_id"]

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "application/problem+json"]
        )

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "200": "RecipeResponse",
        }

        return self.api_client.call_api(
            "/v1/recipes/{recipe-id}",
            "GET",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )

    @validate_arguments
    def get_recipe_version(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        version_number: Annotated[
            StrictInt, Field(..., description="Version number of the recipe")
        ],
        **kwargs,
    ) -> RecipeVersionResponse:
        """Get specific recipe version

        Returns RecipeVersionResponse - combines RecipeEntity base fields (via Recipe) with specific RecipeVersionEntity. Allows retrieving any historical version including code and lock status.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param version_number: Version number of the recipe (required)
        :type version_number: int
        :return: Returns the result object.
        :rtype: RecipeVersionResponse
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the get_recipe_version_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.get_recipe_version_with_http_info(
            recipe_id, version_number, **kwargs
        )

    @validate_arguments
    def get_recipe_version_with_http_info(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        version_number: Annotated[
            StrictInt, Field(..., description="Version number of the recipe")
        ],
        **kwargs,
    ) -> ApiResponse:
        """Get specific recipe version

        Returns RecipeVersionResponse - combines RecipeEntity base fields (via Recipe) with specific RecipeVersionEntity. Allows retrieving any historical version including code and lock status.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param version_number: Version number of the recipe (required)
        :type version_number: int
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(RecipeVersionResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["recipe_id", "version_number"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_recipe_version" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params["recipe_id"] is not None:
            _path_params["recipe-id"] = _params["recipe_id"]

        if _params["version_number"] is not None:
            _path_params["version-number"] = _params["version_number"]

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "application/problem+json"]
        )

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "200": "RecipeVersionResponse",
        }

        return self.api_client.call_api(
            "/v1/recipes/{recipe-id}/versions/{version-number}",
            "GET",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )

    @validate_arguments
    def get_recipe_version_usage(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        version_number: Annotated[
            StrictInt, Field(..., description="Version number of the recipe")
        ],
        **kwargs,
    ) -> List[DatasetVersionUsage]:
        """Get recipe version usage details

        Returns RecipeUsageResponse - lists all dataset versions using this specific recipe version with full dataset version metadata (dataset ID, version, name, status, node ID, created/modified info). Includes DRAFT and RELEASED dataset versions.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param version_number: Version number of the recipe (required)
        :type version_number: int
        :return: Returns the result object.
        :rtype: List[DatasetVersionUsage]
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the get_recipe_version_usage_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.get_recipe_version_usage_with_http_info(
            recipe_id, version_number, **kwargs
        )

    @validate_arguments
    def get_recipe_version_usage_with_http_info(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        version_number: Annotated[
            StrictInt, Field(..., description="Version number of the recipe")
        ],
        **kwargs,
    ) -> ApiResponse:
        """Get recipe version usage details

        Returns RecipeUsageResponse - lists all dataset versions using this specific recipe version with full dataset version metadata (dataset ID, version, name, status, node ID, created/modified info). Includes DRAFT and RELEASED dataset versions.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param version_number: Version number of the recipe (required)
        :type version_number: int
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(List[DatasetVersionUsage], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["recipe_id", "version_number"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_recipe_version_usage" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params["recipe_id"] is not None:
            _path_params["recipe-id"] = _params["recipe_id"]

        if _params["version_number"] is not None:
            _path_params["version-number"] = _params["version_number"]

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "application/problem+json"]
        )

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "200": "List[DatasetVersionUsage]",
        }

        return self.api_client.call_api(
            "/v1/recipes/{recipe-id}/versions/{version-number}/usage",
            "GET",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )

    @validate_arguments
    def list_recipe_versions(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        **kwargs,
    ) -> List[RecipeVersionResponse]:
        """List all versions of recipe

        Returns all versions of the recipe sorted by version number descending. Includes versionNumber, code, and isLocked for each version.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :return: Returns the result object.
        :rtype: List[RecipeVersionResponse]
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the list_recipe_versions_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.list_recipe_versions_with_http_info(recipe_id, **kwargs)

    @validate_arguments
    def list_recipe_versions_with_http_info(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        **kwargs,
    ) -> ApiResponse:
        """List all versions of recipe

        Returns all versions of the recipe sorted by version number descending. Includes versionNumber, code, and isLocked for each version.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(List[RecipeVersionResponse], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["recipe_id"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_recipe_versions" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params["recipe_id"] is not None:
            _path_params["recipe-id"] = _params["recipe_id"]

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "application/problem+json"]
        )

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "200": "List[RecipeVersionResponse]",
        }

        return self.api_client.call_api(
            "/v1/recipes/{recipe-id}/versions",
            "GET",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )

    @validate_arguments
    def list_recipes(
        self,
        list_query: Annotated[
            Optional[ListQuery], Field(description="List query parameters")
        ] = None,
        **kwargs,
    ) -> RecipesResponse:
        """List all recipes with latest version

        Returns array of recipes with nested latest version. Each item includes base info (recipeId, name, description, language, type) AND latestVersion object containing (versionNumber, code, isLocked).

        :param list_query: List query parameters
        :type list_query: ListQuery
        :return: Returns the result object.
        :rtype: RecipesResponse
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the list_recipes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.list_recipes_with_http_info(list_query, **kwargs)

    @validate_arguments
    def list_recipes_with_http_info(
        self,
        list_query: Annotated[
            Optional[ListQuery], Field(description="List query parameters")
        ] = None,
        **kwargs,
    ) -> ApiResponse:
        """List all recipes with latest version

        Returns array of recipes with nested latest version. Each item includes base info (recipeId, name, description, language, type) AND latestVersion object containing (versionNumber, code, isLocked).

        :param list_query: List query parameters
        :type list_query: ListQuery
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(RecipesResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["list_query"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_recipes" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get("list_query") is not None:
            _query_params.append(("listQuery", _params["list_query"]))

        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "application/problem+json"]
        )

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "200": "RecipesResponse",
        }

        return self.api_client.call_api(
            "/v1/recipes",
            "GET",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )

    @validate_arguments
    def update_recipe(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        update_recipe_request: Annotated[
            UpdateRecipeRequest,
            Field(
                ...,
                description="Request body containing the updated configuration for an existing Recipe, including metadata changes such as name and description",
            ),
        ],
        **kwargs,
    ) -> RecipeResponse:
        """Update recipe

        Updates RecipeEntity fields ONLY: name, description. These are shared across all versions and can ALWAYS be updated regardless of lock status. Does NOT update code. Returns Recipe.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param update_recipe_request: Request body containing the updated configuration for an existing Recipe, including metadata changes such as name and description (required)
        :type update_recipe_request: UpdateRecipeRequest
        :return: Returns the result object.
        :rtype: RecipeResponse
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the update_recipe_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.update_recipe_with_http_info(
            recipe_id, update_recipe_request, **kwargs
        )

    @validate_arguments
    def update_recipe_with_http_info(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        update_recipe_request: Annotated[
            UpdateRecipeRequest,
            Field(
                ...,
                description="Request body containing the updated configuration for an existing Recipe, including metadata changes such as name and description",
            ),
        ],
        **kwargs,
    ) -> ApiResponse:
        """Update recipe

        Updates RecipeEntity fields ONLY: name, description. These are shared across all versions and can ALWAYS be updated regardless of lock status. Does NOT update code. Returns Recipe.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param update_recipe_request: Request body containing the updated configuration for an existing Recipe, including metadata changes such as name and description (required)
        :type update_recipe_request: UpdateRecipeRequest
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(RecipeResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["recipe_id", "update_recipe_request"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_recipe" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params["recipe_id"] is not None:
            _path_params["recipe-id"] = _params["recipe_id"]

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params["update_recipe_request"] is not None:
            _body_params = _params["update_recipe_request"]

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

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get(
            "_content_type",
            self.api_client.select_header_content_type(["application/json"]),
        )
        if _content_types_list:
            _header_params["Content-Type"] = _content_types_list

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "200": "RecipeResponse",
        }

        return self.api_client.call_api(
            "/v1/recipes/{recipe-id}",
            "PUT",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )

    @validate_arguments
    def update_recipe_version(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        version_number: Annotated[
            StrictInt, Field(..., description="Version number of the recipe")
        ],
        update_recipe_version_request: Annotated[
            UpdateRecipeVersionRequest,
            Field(
                ...,
                description="Request body containing the updated code for a specific Recipe version. Can only update code if the version is not locked",
            ),
        ],
        **kwargs,
    ) -> RecipeVersionResponse:
        """Update recipe version

        Update version-specific code. Can ONLY update code if version is NOT locked (not used in released datasets). If version is locked, returns 409 CONFLICT with suggestion to create new version. This is the ONLY way to update recipe code.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param version_number: Version number of the recipe (required)
        :type version_number: int
        :param update_recipe_version_request: Request body containing the updated code for a specific Recipe version. Can only update code if the version is not locked (required)
        :type update_recipe_version_request: UpdateRecipeVersionRequest
        :return: Returns the result object.
        :rtype: RecipeVersionResponse
        """
        kwargs["_return_http_data_only"] = True
        if "_preload_content" in kwargs:
            message = "Error! Please call the update_recipe_version_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"
            raise ValueError(message)
        return self.update_recipe_version_with_http_info(
            recipe_id, version_number, update_recipe_version_request, **kwargs
        )

    @validate_arguments
    def update_recipe_version_with_http_info(
        self,
        recipe_id: Annotated[
            StrictInt,
            Field(..., description="Unique identifier of the recipe to operate on"),
        ],
        version_number: Annotated[
            StrictInt, Field(..., description="Version number of the recipe")
        ],
        update_recipe_version_request: Annotated[
            UpdateRecipeVersionRequest,
            Field(
                ...,
                description="Request body containing the updated code for a specific Recipe version. Can only update code if the version is not locked",
            ),
        ],
        **kwargs,
    ) -> ApiResponse:
        """Update recipe version

        Update version-specific code. Can ONLY update code if version is NOT locked (not used in released datasets). If version is locked, returns 409 CONFLICT with suggestion to create new version. This is the ONLY way to update recipe code.

        :param recipe_id: Unique identifier of the recipe to operate on (required)
        :type recipe_id: int
        :param version_number: Version number of the recipe (required)
        :type version_number: int
        :param update_recipe_version_request: Request body containing the updated code for a specific Recipe version. Can only update code if the version is not locked (required)
        :type update_recipe_version_request: UpdateRecipeVersionRequest
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, 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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
        :rtype: tuple(RecipeVersionResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = ["recipe_id", "version_number", "update_recipe_version_request"]
        _all_params.extend(
            [
                "async_req",
                "_return_http_data_only",
                "_preload_content",
                "_request_timeout",
                "_request_auth",
                "_content_type",
                "_headers",
            ]
        )

        # validate the arguments
        for _key, _val in _params["kwargs"].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_recipe_version" % _key
                )
            _params[_key] = _val
        del _params["kwargs"]

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params["recipe_id"] is not None:
            _path_params["recipe-id"] = _params["recipe_id"]

        if _params["version_number"] is not None:
            _path_params["version-number"] = _params["version_number"]

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get("_headers", {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params["update_recipe_version_request"] is not None:
            _body_params = _params["update_recipe_version_request"]

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

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get(
            "_content_type",
            self.api_client.select_header_content_type(["application/json"]),
        )
        if _content_types_list:
            _header_params["Content-Type"] = _content_types_list

        # authentication setting
        _auth_settings = ["BearerAuth"]

        _response_types_map = {
            "200": "RecipeVersionResponse",
        }

        return self.api_client.call_api(
            "/v1/recipes/{recipe-id}/versions/{version-number}",
            "PUT",
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get("async_req"),
            _return_http_data_only=_params.get("_return_http_data_only"),
            _preload_content=_params.get("_preload_content", True),
            _request_timeout=_params.get("_request_timeout"),
            collection_formats=_collection_formats,
            _request_auth=_params.get("_request_auth"),
        )
