=begin
#CRM Associations Schema

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

The version of the OpenAPI document: v4

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

=end

require 'cgi'

module Hubspot
  module Crm
    module Associations
      module V4
        module Schema
          class DefinitionConfigurationsApi
            attr_accessor :api_client

            def initialize(api_client = ApiClient.default)
              @api_client = api_client
            end
            # Create
            # Batch create user configurations between two object types
            # @param from_object_type [String] 
            # @param to_object_type [String] 
            # @param batch_input_public_association_definition_configuration_create_request [BatchInputPublicAssociationDefinitionConfigurationCreateRequest] 
            # @param [Hash] opts the optional parameters
            # @return [BatchResponsePublicAssociationDefinitionUserConfiguration]
            def batch_create(from_object_type, to_object_type, batch_input_public_association_definition_configuration_create_request, opts = {})
              data, _status_code, _headers = batch_create_with_http_info(from_object_type, to_object_type, batch_input_public_association_definition_configuration_create_request, opts)
              data
            end

            # Create
            # Batch create user configurations between two object types
            # @param from_object_type [String] 
            # @param to_object_type [String] 
            # @param batch_input_public_association_definition_configuration_create_request [BatchInputPublicAssociationDefinitionConfigurationCreateRequest] 
            # @param [Hash] opts the optional parameters
            # @return [Array<(BatchResponsePublicAssociationDefinitionUserConfiguration, Integer, Hash)>] BatchResponsePublicAssociationDefinitionUserConfiguration data, response status code and response headers
            def batch_create_with_http_info(from_object_type, to_object_type, batch_input_public_association_definition_configuration_create_request, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefinitionConfigurationsApi.batch_create ...'
              end
              # verify the required parameter 'from_object_type' is set
              if @api_client.config.client_side_validation && from_object_type.nil?
                fail ArgumentError, "Missing the required parameter 'from_object_type' when calling DefinitionConfigurationsApi.batch_create"
              end
              # verify the required parameter 'to_object_type' is set
              if @api_client.config.client_side_validation && to_object_type.nil?
                fail ArgumentError, "Missing the required parameter 'to_object_type' when calling DefinitionConfigurationsApi.batch_create"
              end
              # verify the required parameter 'batch_input_public_association_definition_configuration_create_request' is set
              if @api_client.config.client_side_validation && batch_input_public_association_definition_configuration_create_request.nil?
                fail ArgumentError, "Missing the required parameter 'batch_input_public_association_definition_configuration_create_request' when calling DefinitionConfigurationsApi.batch_create"
              end
              # resource path
              local_var_path = '/crm/v4/associations/definitions/configurations/{fromObjectType}/{toObjectType}/batch/create'.sub('{' + 'fromObjectType' + '}', CGI.escape(from_object_type.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.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', '*/*'])
              # 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(batch_input_public_association_definition_configuration_create_request)

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

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

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

            # Delete
            # Batch delete user configurations between two object types
            # @param from_object_type [String] 
            # @param to_object_type [String] 
            # @param batch_input_public_association_spec [BatchInputPublicAssociationSpec] 
            # @param [Hash] opts the optional parameters
            # @return [nil]
            def batch_remove(from_object_type, to_object_type, batch_input_public_association_spec, opts = {})
              batch_remove_with_http_info(from_object_type, to_object_type, batch_input_public_association_spec, opts)
              nil
            end

            # Delete
            # Batch delete user configurations between two object types
            # @param from_object_type [String] 
            # @param to_object_type [String] 
            # @param batch_input_public_association_spec [BatchInputPublicAssociationSpec] 
            # @param [Hash] opts the optional parameters
            # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
            def batch_remove_with_http_info(from_object_type, to_object_type, batch_input_public_association_spec, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefinitionConfigurationsApi.batch_remove ...'
              end
              # verify the required parameter 'from_object_type' is set
              if @api_client.config.client_side_validation && from_object_type.nil?
                fail ArgumentError, "Missing the required parameter 'from_object_type' when calling DefinitionConfigurationsApi.batch_remove"
              end
              # verify the required parameter 'to_object_type' is set
              if @api_client.config.client_side_validation && to_object_type.nil?
                fail ArgumentError, "Missing the required parameter 'to_object_type' when calling DefinitionConfigurationsApi.batch_remove"
              end
              # verify the required parameter 'batch_input_public_association_spec' is set
              if @api_client.config.client_side_validation && batch_input_public_association_spec.nil?
                fail ArgumentError, "Missing the required parameter 'batch_input_public_association_spec' when calling DefinitionConfigurationsApi.batch_remove"
              end
              # resource path
              local_var_path = '/crm/v4/associations/definitions/configurations/{fromObjectType}/{toObjectType}/batch/purge'.sub('{' + 'fromObjectType' + '}', CGI.escape(from_object_type.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.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(['*/*'])
              # 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(batch_input_public_association_spec)

              # return_type
              return_type = opts[:debug_return_type]

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

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

            # Update
            # Batch update user configurations between two object types
            # @param from_object_type [String] 
            # @param to_object_type [String] 
            # @param batch_input_public_association_definition_configuration_update_request [BatchInputPublicAssociationDefinitionConfigurationUpdateRequest] 
            # @param [Hash] opts the optional parameters
            # @return [BatchResponsePublicAssociationDefinitionConfigurationUpdateResult]
            def batch_update(from_object_type, to_object_type, batch_input_public_association_definition_configuration_update_request, opts = {})
              data, _status_code, _headers = batch_update_with_http_info(from_object_type, to_object_type, batch_input_public_association_definition_configuration_update_request, opts)
              data
            end

            # Update
            # Batch update user configurations between two object types
            # @param from_object_type [String] 
            # @param to_object_type [String] 
            # @param batch_input_public_association_definition_configuration_update_request [BatchInputPublicAssociationDefinitionConfigurationUpdateRequest] 
            # @param [Hash] opts the optional parameters
            # @return [Array<(BatchResponsePublicAssociationDefinitionConfigurationUpdateResult, Integer, Hash)>] BatchResponsePublicAssociationDefinitionConfigurationUpdateResult data, response status code and response headers
            def batch_update_with_http_info(from_object_type, to_object_type, batch_input_public_association_definition_configuration_update_request, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefinitionConfigurationsApi.batch_update ...'
              end
              # verify the required parameter 'from_object_type' is set
              if @api_client.config.client_side_validation && from_object_type.nil?
                fail ArgumentError, "Missing the required parameter 'from_object_type' when calling DefinitionConfigurationsApi.batch_update"
              end
              # verify the required parameter 'to_object_type' is set
              if @api_client.config.client_side_validation && to_object_type.nil?
                fail ArgumentError, "Missing the required parameter 'to_object_type' when calling DefinitionConfigurationsApi.batch_update"
              end
              # verify the required parameter 'batch_input_public_association_definition_configuration_update_request' is set
              if @api_client.config.client_side_validation && batch_input_public_association_definition_configuration_update_request.nil?
                fail ArgumentError, "Missing the required parameter 'batch_input_public_association_definition_configuration_update_request' when calling DefinitionConfigurationsApi.batch_update"
              end
              # resource path
              local_var_path = '/crm/v4/associations/definitions/configurations/{fromObjectType}/{toObjectType}/batch/update'.sub('{' + 'fromObjectType' + '}', CGI.escape(from_object_type.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.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', '*/*'])
              # 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(batch_input_public_association_definition_configuration_update_request)

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

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

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

            # Read All
            # Returns all user configurations available on a given portal
            # @param [Hash] opts the optional parameters
            # @return [CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging]
            def get_all(opts = {})
              data, _status_code, _headers = get_all_with_http_info(opts)
              data
            end

            # Read All
            # Returns all user configurations available on a given portal
            # @param [Hash] opts the optional parameters
            # @return [Array<(CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging, Integer, Hash)>] CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging data, response status code and response headers
            def get_all_with_http_info(opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefinitionConfigurationsApi.get_all ...'
              end
              # resource path
              local_var_path = '/crm/v4/associations/definitions/configurations/all'

              # 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', '*/*'])

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

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

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

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

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

            # Read
            # Returns user configurations on all association definitions between two object types
            # @param from_object_type [String] 
            # @param to_object_type [String] 
            # @param [Hash] opts the optional parameters
            # @return [CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging]
            def get_all_between_two_object_types(from_object_type, to_object_type, opts = {})
              data, _status_code, _headers = get_all_between_two_object_types_with_http_info(from_object_type, to_object_type, opts)
              data
            end

            # Read
            # Returns user configurations on all association definitions between two object types
            # @param from_object_type [String] 
            # @param to_object_type [String] 
            # @param [Hash] opts the optional parameters
            # @return [Array<(CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging, Integer, Hash)>] CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging data, response status code and response headers
            def get_all_between_two_object_types_with_http_info(from_object_type, to_object_type, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefinitionConfigurationsApi.get_all_between_two_object_types ...'
              end
              # verify the required parameter 'from_object_type' is set
              if @api_client.config.client_side_validation && from_object_type.nil?
                fail ArgumentError, "Missing the required parameter 'from_object_type' when calling DefinitionConfigurationsApi.get_all_between_two_object_types"
              end
              # verify the required parameter 'to_object_type' is set
              if @api_client.config.client_side_validation && to_object_type.nil?
                fail ArgumentError, "Missing the required parameter 'to_object_type' when calling DefinitionConfigurationsApi.get_all_between_two_object_types"
              end
              # resource path
              local_var_path = '/crm/v4/associations/definitions/configurations/{fromObjectType}/{toObjectType}'.sub('{' + 'fromObjectType' + '}', CGI.escape(from_object_type.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.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', '*/*'])

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

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

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

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

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