=begin
#Daytona

#Daytona AI platform API Docs

The version of the OpenAPI document: 1.0
Contact: support@daytona.com
Generated by: https://openapi-generator.tech
Generator version: 7.21.0

=end

require 'cgi'

module DaytonaApiClient
  class PreviewApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Get sandbox ID from signed preview URL token
    # @param signed_preview_token [String] Signed preview URL token
    # @param port [Float] Port number to get sandbox ID from signed preview URL token
    # @param [Hash] opts the optional parameters
    # @return [String]
    def get_sandbox_id_from_signed_preview_url_token(signed_preview_token, port, opts = {})
      data, _status_code, _headers = get_sandbox_id_from_signed_preview_url_token_with_http_info(signed_preview_token, port, opts)
      data
    end

    # Get sandbox ID from signed preview URL token
    # @param signed_preview_token [String] Signed preview URL token
    # @param port [Float] Port number to get sandbox ID from signed preview URL token
    # @param [Hash] opts the optional parameters
    # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
    def get_sandbox_id_from_signed_preview_url_token_with_http_info(signed_preview_token, port, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: PreviewApi.get_sandbox_id_from_signed_preview_url_token ...'
      end
      # verify the required parameter 'signed_preview_token' is set
      if @api_client.config.client_side_validation && signed_preview_token.nil?
        fail ArgumentError, "Missing the required parameter 'signed_preview_token' when calling PreviewApi.get_sandbox_id_from_signed_preview_url_token"
      end
      # verify the required parameter 'port' is set
      if @api_client.config.client_side_validation && port.nil?
        fail ArgumentError, "Missing the required parameter 'port' when calling PreviewApi.get_sandbox_id_from_signed_preview_url_token"
      end
      # resource path
      local_var_path = '/preview/{signedPreviewToken}/{port}/sandbox-id'.sub('{' + 'signedPreviewToken' + '}', CGI.escape(signed_preview_token.to_s)).sub('{' + 'port' + '}', CGI.escape(port.to_s))

      # 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']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['bearer', 'oauth2']

      new_options = opts.merge(
        :operation => :"PreviewApi.get_sandbox_id_from_signed_preview_url_token",
        :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: PreviewApi#get_sandbox_id_from_signed_preview_url_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Check if user has access to the sandbox
    # @param sandbox_id [String] 
    # @param [Hash] opts the optional parameters
    # @return [Boolean]
    def has_sandbox_access(sandbox_id, opts = {})
      data, _status_code, _headers = has_sandbox_access_with_http_info(sandbox_id, opts)
      data
    end

    # Check if user has access to the sandbox
    # @param sandbox_id [String] 
    # @param [Hash] opts the optional parameters
    # @return [Array<(Boolean, Integer, Hash)>] Boolean data, response status code and response headers
    def has_sandbox_access_with_http_info(sandbox_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: PreviewApi.has_sandbox_access ...'
      end
      # verify the required parameter 'sandbox_id' is set
      if @api_client.config.client_side_validation && sandbox_id.nil?
        fail ArgumentError, "Missing the required parameter 'sandbox_id' when calling PreviewApi.has_sandbox_access"
      end
      # resource path
      local_var_path = '/preview/{sandboxId}/access'.sub('{' + 'sandboxId' + '}', CGI.escape(sandbox_id.to_s))

      # 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']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['bearer', 'oauth2']

      new_options = opts.merge(
        :operation => :"PreviewApi.has_sandbox_access",
        :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: PreviewApi#has_sandbox_access\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Check if sandbox is public
    # @param sandbox_id [String] ID of the sandbox
    # @param [Hash] opts the optional parameters
    # @return [Boolean]
    def is_sandbox_public(sandbox_id, opts = {})
      data, _status_code, _headers = is_sandbox_public_with_http_info(sandbox_id, opts)
      data
    end

    # Check if sandbox is public
    # @param sandbox_id [String] ID of the sandbox
    # @param [Hash] opts the optional parameters
    # @return [Array<(Boolean, Integer, Hash)>] Boolean data, response status code and response headers
    def is_sandbox_public_with_http_info(sandbox_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: PreviewApi.is_sandbox_public ...'
      end
      # verify the required parameter 'sandbox_id' is set
      if @api_client.config.client_side_validation && sandbox_id.nil?
        fail ArgumentError, "Missing the required parameter 'sandbox_id' when calling PreviewApi.is_sandbox_public"
      end
      # resource path
      local_var_path = '/preview/{sandboxId}/public'.sub('{' + 'sandboxId' + '}', CGI.escape(sandbox_id.to_s))

      # 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']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['bearer', 'oauth2']

      new_options = opts.merge(
        :operation => :"PreviewApi.is_sandbox_public",
        :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: PreviewApi#is_sandbox_public\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Check if sandbox auth token is valid
    # @param sandbox_id [String] ID of the sandbox
    # @param auth_token [String] Auth token of the sandbox
    # @param [Hash] opts the optional parameters
    # @return [Boolean]
    def is_valid_auth_token(sandbox_id, auth_token, opts = {})
      data, _status_code, _headers = is_valid_auth_token_with_http_info(sandbox_id, auth_token, opts)
      data
    end

    # Check if sandbox auth token is valid
    # @param sandbox_id [String] ID of the sandbox
    # @param auth_token [String] Auth token of the sandbox
    # @param [Hash] opts the optional parameters
    # @return [Array<(Boolean, Integer, Hash)>] Boolean data, response status code and response headers
    def is_valid_auth_token_with_http_info(sandbox_id, auth_token, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: PreviewApi.is_valid_auth_token ...'
      end
      # verify the required parameter 'sandbox_id' is set
      if @api_client.config.client_side_validation && sandbox_id.nil?
        fail ArgumentError, "Missing the required parameter 'sandbox_id' when calling PreviewApi.is_valid_auth_token"
      end
      # verify the required parameter 'auth_token' is set
      if @api_client.config.client_side_validation && auth_token.nil?
        fail ArgumentError, "Missing the required parameter 'auth_token' when calling PreviewApi.is_valid_auth_token"
      end
      # resource path
      local_var_path = '/preview/{sandboxId}/validate/{authToken}'.sub('{' + 'sandboxId' + '}', CGI.escape(sandbox_id.to_s)).sub('{' + 'authToken' + '}', CGI.escape(auth_token.to_s))

      # 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']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['bearer', 'oauth2']

      new_options = opts.merge(
        :operation => :"PreviewApi.is_valid_auth_token",
        :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: PreviewApi#is_valid_auth_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
