=begin
#Daytona Toolbox API

#Daytona Toolbox API

The version of the OpenAPI document: v0.0.0-dev

Generated by: https://openapi-generator.tech
Generator version: 7.21.0

=end

require 'cgi'

module DaytonaToolboxApiClient
  class LspApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Get code completions
    # Get code completion suggestions from the LSP server
    # @param request [LspCompletionParams] Completion request
    # @param [Hash] opts the optional parameters
    # @return [CompletionList]
    def completions(request, opts = {})
      data, _status_code, _headers = completions_with_http_info(request, opts)
      data
    end

    # Get code completions
    # Get code completion suggestions from the LSP server
    # @param request [LspCompletionParams] Completion request
    # @param [Hash] opts the optional parameters
    # @return [Array<(CompletionList, Integer, Hash)>] CompletionList data, response status code and response headers
    def completions_with_http_info(request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: LspApi.completions ...'
      end
      # verify the required parameter 'request' is set
      if @api_client.config.client_side_validation && request.nil?
        fail ArgumentError, "Missing the required parameter 'request' when calling LspApi.completions"
      end
      # resource path
      local_var_path = '/lsp/completions'

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
      # HTTP header 'Content-Type'
      content_type = @api_client.select_header_content_type(['application/json'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body] || @api_client.object_to_http_body(request)

      # return_type
      return_type = opts[:debug_return_type] || 'CompletionList'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"LspApi.completions",
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )

      data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: LspApi#completions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Notify document closed
    # Notify the LSP server that a document has been closed
    # @param request [LspDocumentRequest] Document request
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def did_close(request, opts = {})
      did_close_with_http_info(request, opts)
      nil
    end

    # Notify document closed
    # Notify the LSP server that a document has been closed
    # @param request [LspDocumentRequest] Document request
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def did_close_with_http_info(request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: LspApi.did_close ...'
      end
      # verify the required parameter 'request' is set
      if @api_client.config.client_side_validation && request.nil?
        fail ArgumentError, "Missing the required parameter 'request' when calling LspApi.did_close"
      end
      # resource path
      local_var_path = '/lsp/did-close'

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Content-Type'
      content_type = @api_client.select_header_content_type(['application/json'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body] || @api_client.object_to_http_body(request)

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"LspApi.did_close",
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )

      data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: LspApi#did_close\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Notify document opened
    # Notify the LSP server that a document has been opened
    # @param request [LspDocumentRequest] Document request
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def did_open(request, opts = {})
      did_open_with_http_info(request, opts)
      nil
    end

    # Notify document opened
    # Notify the LSP server that a document has been opened
    # @param request [LspDocumentRequest] Document request
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def did_open_with_http_info(request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: LspApi.did_open ...'
      end
      # verify the required parameter 'request' is set
      if @api_client.config.client_side_validation && request.nil?
        fail ArgumentError, "Missing the required parameter 'request' when calling LspApi.did_open"
      end
      # resource path
      local_var_path = '/lsp/did-open'

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Content-Type'
      content_type = @api_client.select_header_content_type(['application/json'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body] || @api_client.object_to_http_body(request)

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"LspApi.did_open",
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )

      data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: LspApi#did_open\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Get document symbols
    # Get symbols (functions, classes, etc.) from a document
    # @param language_id [String] Language ID (e.g., python, typescript)
    # @param path_to_project [String] Path to project
    # @param uri [String] Document URI
    # @param [Hash] opts the optional parameters
    # @return [Array<LspSymbol>]
    def document_symbols(language_id, path_to_project, uri, opts = {})
      data, _status_code, _headers = document_symbols_with_http_info(language_id, path_to_project, uri, opts)
      data
    end

    # Get document symbols
    # Get symbols (functions, classes, etc.) from a document
    # @param language_id [String] Language ID (e.g., python, typescript)
    # @param path_to_project [String] Path to project
    # @param uri [String] Document URI
    # @param [Hash] opts the optional parameters
    # @return [Array<(Array<LspSymbol>, Integer, Hash)>] Array<LspSymbol> data, response status code and response headers
    def document_symbols_with_http_info(language_id, path_to_project, uri, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: LspApi.document_symbols ...'
      end
      # verify the required parameter 'language_id' is set
      if @api_client.config.client_side_validation && language_id.nil?
        fail ArgumentError, "Missing the required parameter 'language_id' when calling LspApi.document_symbols"
      end
      # verify the required parameter 'path_to_project' is set
      if @api_client.config.client_side_validation && path_to_project.nil?
        fail ArgumentError, "Missing the required parameter 'path_to_project' when calling LspApi.document_symbols"
      end
      # verify the required parameter 'uri' is set
      if @api_client.config.client_side_validation && uri.nil?
        fail ArgumentError, "Missing the required parameter 'uri' when calling LspApi.document_symbols"
      end
      # resource path
      local_var_path = '/lsp/document-symbols'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'languageId'] = language_id
      query_params[:'pathToProject'] = path_to_project
      query_params[:'uri'] = uri

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'Array<LspSymbol>'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"LspApi.document_symbols",
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )

      data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: LspApi#document_symbols\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Start LSP server
    # Start a Language Server Protocol server for the specified language
    # @param request [LspServerRequest] LSP server request
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def start(request, opts = {})
      start_with_http_info(request, opts)
      nil
    end

    # Start LSP server
    # Start a Language Server Protocol server for the specified language
    # @param request [LspServerRequest] LSP server request
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def start_with_http_info(request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: LspApi.start ...'
      end
      # verify the required parameter 'request' is set
      if @api_client.config.client_side_validation && request.nil?
        fail ArgumentError, "Missing the required parameter 'request' when calling LspApi.start"
      end
      # resource path
      local_var_path = '/lsp/start'

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Content-Type'
      content_type = @api_client.select_header_content_type(['application/json'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body] || @api_client.object_to_http_body(request)

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"LspApi.start",
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )

      data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: LspApi#start\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Stop LSP server
    # Stop a Language Server Protocol server
    # @param request [LspServerRequest] LSP server request
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def stop(request, opts = {})
      stop_with_http_info(request, opts)
      nil
    end

    # Stop LSP server
    # Stop a Language Server Protocol server
    # @param request [LspServerRequest] LSP server request
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def stop_with_http_info(request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: LspApi.stop ...'
      end
      # verify the required parameter 'request' is set
      if @api_client.config.client_side_validation && request.nil?
        fail ArgumentError, "Missing the required parameter 'request' when calling LspApi.stop"
      end
      # resource path
      local_var_path = '/lsp/stop'

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Content-Type'
      content_type = @api_client.select_header_content_type(['application/json'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body] || @api_client.object_to_http_body(request)

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"LspApi.stop",
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )

      data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: LspApi#stop\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Get workspace symbols
    # Search for symbols across the entire workspace
    # @param query [String] Search query
    # @param language_id [String] Language ID (e.g., python, typescript)
    # @param path_to_project [String] Path to project
    # @param [Hash] opts the optional parameters
    # @return [Array<LspSymbol>]
    def workspace_symbols(query, language_id, path_to_project, opts = {})
      data, _status_code, _headers = workspace_symbols_with_http_info(query, language_id, path_to_project, opts)
      data
    end

    # Get workspace symbols
    # Search for symbols across the entire workspace
    # @param query [String] Search query
    # @param language_id [String] Language ID (e.g., python, typescript)
    # @param path_to_project [String] Path to project
    # @param [Hash] opts the optional parameters
    # @return [Array<(Array<LspSymbol>, Integer, Hash)>] Array<LspSymbol> data, response status code and response headers
    def workspace_symbols_with_http_info(query, language_id, path_to_project, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: LspApi.workspace_symbols ...'
      end
      # verify the required parameter 'query' is set
      if @api_client.config.client_side_validation && query.nil?
        fail ArgumentError, "Missing the required parameter 'query' when calling LspApi.workspace_symbols"
      end
      # verify the required parameter 'language_id' is set
      if @api_client.config.client_side_validation && language_id.nil?
        fail ArgumentError, "Missing the required parameter 'language_id' when calling LspApi.workspace_symbols"
      end
      # verify the required parameter 'path_to_project' is set
      if @api_client.config.client_side_validation && path_to_project.nil?
        fail ArgumentError, "Missing the required parameter 'path_to_project' when calling LspApi.workspace_symbols"
      end
      # resource path
      local_var_path = '/lsp/workspacesymbols'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'query'] = query
      query_params[:'languageId'] = language_id
      query_params[:'pathToProject'] = path_to_project

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'Array<LspSymbol>'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"LspApi.workspace_symbols",
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )

      data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: LspApi#workspace_symbols\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
