=begin
#Ahello REST API documentation

#На данной странице вы можете выполнять запросы к API, для этого необходимо указать 'appId', который  был передан вам сотрудниками тех. поддержки в поле api_key. Укажите также PartnerUserId (это CRM Id пользователя или его email ), partnerUserId передается в заголовке запроса. Важно!!! ApiKeys-аутентификация c указанием только ключа appId в ближайшее время будет работать только для данной страницы документации. Для реальных сценариев интеграции необходимо использовать HMAC-аутентификацию. В ближайшее время появится раздел помощи по основным вопросам работы с API

OpenAPI spec version: v1
Contact: petrunin@action-media.ru
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.16

=end

require 'uri'

module AktionClient
  class StopListApiApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Закрепляет существующего свободного клиента в стоп-лист
    # @param bind_model 
    # @param [Hash] opts the optional parameters
    # @return [StopList]
    def stop_list_api_bind(bind_model, opts = {})
      data, _status_code, _headers = stop_list_api_bind_with_http_info(bind_model, opts)
      data
    end

    # Закрепляет существующего свободного клиента в стоп-лист
    # @param bind_model 
    # @param [Hash] opts the optional parameters
    # @return [Array<(StopList, Fixnum, Hash)>] StopList data, response status code and response headers
    def stop_list_api_bind_with_http_info(bind_model, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_bind ...'
      end
      # verify the required parameter 'bind_model' is set
      if @api_client.config.client_side_validation && bind_model.nil?
        fail ArgumentError, "Missing the required parameter 'bind_model' when calling StopListApiApi.stop_list_api_bind"
      end
      # resource path
      local_var_path = '/stoplist/bind'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(bind_model)
      auth_names = []
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'StopList')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_bind\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Создает нового клиента и закрепляет в стоп-лист
    # @param bind_model 
    # @param [Hash] opts the optional parameters
    # @return [StopList]
    def stop_list_api_bind_new_customer(bind_model, opts = {})
      data, _status_code, _headers = stop_list_api_bind_new_customer_with_http_info(bind_model, opts)
      data
    end

    # Создает нового клиента и закрепляет в стоп-лист
    # @param bind_model 
    # @param [Hash] opts the optional parameters
    # @return [Array<(StopList, Fixnum, Hash)>] StopList data, response status code and response headers
    def stop_list_api_bind_new_customer_with_http_info(bind_model, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_bind_new_customer ...'
      end
      # verify the required parameter 'bind_model' is set
      if @api_client.config.client_side_validation && bind_model.nil?
        fail ArgumentError, "Missing the required parameter 'bind_model' when calling StopListApiApi.stop_list_api_bind_new_customer"
      end
      # resource path
      local_var_path = '/stoplist/bind/new'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(bind_model)
      auth_names = []
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'StopList')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_bind_new_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Изменяет менеджера спопровождения на СЛ
    # @param model 
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def stop_list_api_change_manager(model, opts = {})
      stop_list_api_change_manager_with_http_info(model, opts)
      nil
    end

    # Изменяет менеджера спопровождения на СЛ
    # @param model 
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def stop_list_api_change_manager_with_http_info(model, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_change_manager ...'
      end
      # verify the required parameter 'model' is set
      if @api_client.config.client_side_validation && model.nil?
        fail ArgumentError, "Missing the required parameter 'model' when calling StopListApiApi.stop_list_api_change_manager"
      end
      # resource path
      local_var_path = '/stoplist/changemanager'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(model)
      auth_names = []
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_change_manager\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Получает информацию по кол-ву стоп-листов для действующих менеджеров
    # @param [Hash] opts the optional parameters
    # @option opts [String] :partner_id 
    # @return [Array<ManagerWithStopListInfo>]
    def stop_list_api_get_managers_with_stop_list_info(opts = {})
      data, _status_code, _headers = stop_list_api_get_managers_with_stop_list_info_with_http_info(opts)
      data
    end

    # Получает информацию по кол-ву стоп-листов для действующих менеджеров
    # @param [Hash] opts the optional parameters
    # @option opts [String] :partner_id 
    # @return [Array<(Array<ManagerWithStopListInfo>, Fixnum, Hash)>] Array<ManagerWithStopListInfo> data, response status code and response headers
    def stop_list_api_get_managers_with_stop_list_info_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_get_managers_with_stop_list_info ...'
      end
      # resource path
      local_var_path = '/stoplist/bymanagers'

      # query parameters
      query_params = {}
      query_params[:'partnerId'] = opts[:'partner_id'] if !opts[:'partner_id'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = []
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'Array<ManagerWithStopListInfo>')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_get_managers_with_stop_list_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Получает стоп-лист партнера
    # @param [Hash] opts the optional parameters
    # @option opts [String] :partner_id 
    # @return [Array<StopList>]
    def stop_list_api_get_stop_lists(opts = {})
      data, _status_code, _headers = stop_list_api_get_stop_lists_with_http_info(opts)
      data
    end

    # Получает стоп-лист партнера
    # @param [Hash] opts the optional parameters
    # @option opts [String] :partner_id 
    # @return [Array<(Array<StopList>, Fixnum, Hash)>] Array<StopList> data, response status code and response headers
    def stop_list_api_get_stop_lists_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_get_stop_lists ...'
      end
      # resource path
      local_var_path = '/stoplist/list'

      # query parameters
      query_params = {}
      query_params[:'partnerId'] = opts[:'partner_id'] if !opts[:'partner_id'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = []
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'Array<StopList>')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_get_stop_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Получает настройки стоп-листа для партнера
    # @param [Hash] opts the optional parameters
    # @option opts [String] :partner_id 
    # @return [StopListSettings]
    def stop_list_api_get_stop_lists_settings(opts = {})
      data, _status_code, _headers = stop_list_api_get_stop_lists_settings_with_http_info(opts)
      data
    end

    # Получает настройки стоп-листа для партнера
    # @param [Hash] opts the optional parameters
    # @option opts [String] :partner_id 
    # @return [Array<(StopListSettings, Fixnum, Hash)>] StopListSettings data, response status code and response headers
    def stop_list_api_get_stop_lists_settings_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_get_stop_lists_settings ...'
      end
      # resource path
      local_var_path = '/stoplist/settings'

      # query parameters
      query_params = {}
      query_params[:'partnerId'] = opts[:'partner_id'] if !opts[:'partner_id'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = []
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'StopListSettings')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_get_stop_lists_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Продлевает закрепление клиента в стоп-листе
    # @param stop_list_id 
    # @param [Hash] opts the optional parameters
    # @return [StopList]
    def stop_list_api_prolong(stop_list_id, opts = {})
      data, _status_code, _headers = stop_list_api_prolong_with_http_info(stop_list_id, opts)
      data
    end

    # Продлевает закрепление клиента в стоп-листе
    # @param stop_list_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(StopList, Fixnum, Hash)>] StopList data, response status code and response headers
    def stop_list_api_prolong_with_http_info(stop_list_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_prolong ...'
      end
      # verify the required parameter 'stop_list_id' is set
      if @api_client.config.client_side_validation && stop_list_id.nil?
        fail ArgumentError, "Missing the required parameter 'stop_list_id' when calling StopListApiApi.stop_list_api_prolong"
      end
      # resource path
      local_var_path = '/stoplist/prolong/{stopListId}'.sub('{' + 'stopListId' + '}', stop_list_id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = []
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'StopList')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_prolong\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Устанавливает лимит стоп-листов для партнерского менеджера.
    # Чтобы очистить лимит необходимо установить значение -1
    # @param model 
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def stop_list_api_set_limit(model, opts = {})
      stop_list_api_set_limit_with_http_info(model, opts)
      nil
    end

    # Устанавливает лимит стоп-листов для партнерского менеджера.
    # Чтобы очистить лимит необходимо установить значение -1
    # @param model 
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def stop_list_api_set_limit_with_http_info(model, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_set_limit ...'
      end
      # verify the required parameter 'model' is set
      if @api_client.config.client_side_validation && model.nil?
        fail ArgumentError, "Missing the required parameter 'model' when calling StopListApiApi.stop_list_api_set_limit"
      end
      # resource path
      local_var_path = '/stoplist/limit'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(model)
      auth_names = []
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_set_limit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Открепляет клиента из стоп-листа
    # @param stop_list_id 
    # @param [Hash] opts the optional parameters
    # @return [StopList]
    def stop_list_api_un_bind(stop_list_id, opts = {})
      data, _status_code, _headers = stop_list_api_un_bind_with_http_info(stop_list_id, opts)
      data
    end

    # Открепляет клиента из стоп-листа
    # @param stop_list_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(StopList, Fixnum, Hash)>] StopList data, response status code and response headers
    def stop_list_api_un_bind_with_http_info(stop_list_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: StopListApiApi.stop_list_api_un_bind ...'
      end
      # verify the required parameter 'stop_list_id' is set
      if @api_client.config.client_side_validation && stop_list_id.nil?
        fail ArgumentError, "Missing the required parameter 'stop_list_id' when calling StopListApiApi.stop_list_api_un_bind"
      end
      # resource path
      local_var_path = '/stoplist/unbind/{stopListId}'.sub('{' + 'stopListId' + '}', stop_list_id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = []
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'StopList')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: StopListApiApi#stop_list_api_un_bind\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
