# This file was generated by liblab | https://liblab.com/

from urllib.parse import quote
from ..net import query_serializer
from .base import BaseService
from ..models.GetToolsRequest import GetToolsRequest as GetToolsRequestModel
from ..models.GetToolsResponse import GetToolsResponse as GetToolsResponseModel
from ..models.GetToolsResponse import (
    GetToolsResponseGuard as GetToolsResponseGuardModel,
)
from ..models.RunToolsRequest import RunToolsRequest as RunToolsRequestModel
from ..models.ToolhouseCallResults import (
    ToolhouseCallResults as ToolhouseCallResultsModel,
)


class Tools(BaseService):
    def get_tools(self, request_input: GetToolsRequestModel) -> GetToolsResponseModel:
        """
        Get Tools
        Parameters:
        ----------
            request_input: GetToolsRequestModel
        """

        url_endpoint = "/get_tools"
        headers = {"Content-Type": "application/json"}
        self._add_required_headers(headers)

        final_url = self._url_prefix + url_endpoint
        res = self._http.post(final_url, headers, request_input, True)
        if res and isinstance(res, dict):
            return GetToolsResponseGuardModel.return_one_of(res)
        return res

    def run_tools(
        self, request_input: RunToolsRequestModel
    ) -> ToolhouseCallResultsModel:
        """
        Run Tools
        Parameters:
        ----------
            request_input: RunToolsRequestModel
        """

        url_endpoint = "/run_tools"
        headers = {"Content-Type": "application/json"}
        self._add_required_headers(headers)

        final_url = self._url_prefix + url_endpoint
        res = self._http.post(final_url, headers, request_input, True)
        if res and isinstance(res, dict):
            return ToolhouseCallResultsModel(**res)
        return res
