=begin
#PACE Funding API

#No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

OpenAPI spec version: 1.0.0
Contact:
Generated by: https://github.com/swagger-api/swagger-codegen.git

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=end

require "uri"

module PaceFunding
  class CreateContractorSalespersonApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end

    #
    #
    # @param auth_key Auth Key
    # @param first_name Contractor first name
    # @param last_name Contractor last name
    # @param phone Contractor Work number
    # @param mobile Contractor Mobile Number
    # @param email Contractor Email id
    # @param probationary Contractor probationary 1&#x3D;Yes or 0&#x3D;No
    # @param company_name Contractor company name
    # @param website Company website
    # @param company_phone Company phone number
    # @param license_number License number
    # @param license_state License state
    # @param license_expiration License Expiration Date MM/DD/YYYY
    # @param company_address Company Address Line 1
    # @param company_city Company City
    # @param company_state Company State
    # @param company_pincode Company Pincode
    # @param project_type Project Type
    # @param administrator_name Administrator/Executive Contact Name
    # @param [Hash] opts the optional parameters
    # @option opts [String] :title Contractor title
    # @option opts [String] :company_address2 Company Address Line 2
    # @return [AddContractorResponse]
    def add_contractor_post(auth_key, first_name, last_name, phone, mobile, email, probationary, company_name, website, company_phone, license_number, license_state, license_expiration, company_address, company_city, company_state, company_pincode, project_type, administrator_name, opts = {})
      data, _status_code, _headers = add_contractor_post_with_http_info(auth_key, first_name, last_name, phone, mobile, email, probationary, company_name, website, company_phone, license_number, license_state, license_expiration, company_address, company_city, company_state, company_pincode, project_type, administrator_name, opts)
      return data
    end

    #
    #
    # @param auth_key Auth Key
    # @param first_name Contractor first name
    # @param last_name Contractor last name
    # @param phone Contractor Work number
    # @param mobile Contractor Mobile Number
    # @param email Contractor Email id
    # @param probationary Contractor probationary 1&#x3D;Yes or 0&#x3D;No
    # @param company_name Contractor company name
    # @param website Company website
    # @param company_phone Company phone number
    # @param license_number License number
    # @param license_state License state
    # @param license_expiration License Expiration Date MM/DD/YYYY
    # @param company_address Company Address Line 1
    # @param company_city Company City
    # @param company_state Company State
    # @param company_pincode Company Pincode
    # @param project_type Project Type
    # @param administrator_name Administrator/Executive Contact Name
    # @param [Hash] opts the optional parameters
    # @option opts [String] :title Contractor title
    # @option opts [String] :company_address2 Company Address Line 2
    # @return [Array<(AddContractorResponse, Fixnum, Hash)>] AddContractorResponse data, response status code and response headers
    def add_contractor_post_with_http_info(auth_key, first_name, last_name, phone, mobile, email, probationary, company_name, website, company_phone, license_number, license_state, license_expiration, company_address, company_city, company_state, company_pincode, project_type, administrator_name, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CreateContractorSalespersonApi.add_contractor_post ..."
      end
      # verify the required parameter 'auth_key' is set
      fail ArgumentError, "Missing the required parameter 'auth_key' when calling CreateContractorSalespersonApi.add_contractor_post" if auth_key.nil?
      # verify the required parameter 'first_name' is set
      fail ArgumentError, "Missing the required parameter 'first_name' when calling CreateContractorSalespersonApi.add_contractor_post" if first_name.nil?
      # verify the required parameter 'last_name' is set
      fail ArgumentError, "Missing the required parameter 'last_name' when calling CreateContractorSalespersonApi.add_contractor_post" if last_name.nil?
      # verify the required parameter 'phone' is set
      fail ArgumentError, "Missing the required parameter 'phone' when calling CreateContractorSalespersonApi.add_contractor_post" if phone.nil?
      # verify the required parameter 'mobile' is set
      fail ArgumentError, "Missing the required parameter 'mobile' when calling CreateContractorSalespersonApi.add_contractor_post" if mobile.nil?
      # verify the required parameter 'email' is set
      fail ArgumentError, "Missing the required parameter 'email' when calling CreateContractorSalespersonApi.add_contractor_post" if email.nil?
      # verify the required parameter 'probationary' is set
      fail ArgumentError, "Missing the required parameter 'probationary' when calling CreateContractorSalespersonApi.add_contractor_post" if probationary.nil?
      # verify enum value
      unless ['1', '0'].include?(probationary)
        fail ArgumentError, "invalid value for 'probationary', must be one of 1, 0"
      end
      # verify the required parameter 'company_name' is set
      fail ArgumentError, "Missing the required parameter 'company_name' when calling CreateContractorSalespersonApi.add_contractor_post" if company_name.nil?
      # verify the required parameter 'website' is set
      fail ArgumentError, "Missing the required parameter 'website' when calling CreateContractorSalespersonApi.add_contractor_post" if website.nil?
      # verify the required parameter 'company_phone' is set
      fail ArgumentError, "Missing the required parameter 'company_phone' when calling CreateContractorSalespersonApi.add_contractor_post" if company_phone.nil?
      # verify the required parameter 'license_number' is set
      fail ArgumentError, "Missing the required parameter 'license_number' when calling CreateContractorSalespersonApi.add_contractor_post" if license_number.nil?
      # verify the required parameter 'license_state' is set
      fail ArgumentError, "Missing the required parameter 'license_state' when calling CreateContractorSalespersonApi.add_contractor_post" if license_state.nil?
      # verify the required parameter 'license_expiration' is set
      fail ArgumentError, "Missing the required parameter 'license_expiration' when calling CreateContractorSalespersonApi.add_contractor_post" if license_expiration.nil?
      # verify the required parameter 'company_address' is set
      fail ArgumentError, "Missing the required parameter 'company_address' when calling CreateContractorSalespersonApi.add_contractor_post" if company_address.nil?
      # verify the required parameter 'company_city' is set
      fail ArgumentError, "Missing the required parameter 'company_city' when calling CreateContractorSalespersonApi.add_contractor_post" if company_city.nil?
      # verify the required parameter 'company_state' is set
      fail ArgumentError, "Missing the required parameter 'company_state' when calling CreateContractorSalespersonApi.add_contractor_post" if company_state.nil?
      # verify the required parameter 'company_pincode' is set
      fail ArgumentError, "Missing the required parameter 'company_pincode' when calling CreateContractorSalespersonApi.add_contractor_post" if company_pincode.nil?
      # verify the required parameter 'project_type' is set
      fail ArgumentError, "Missing the required parameter 'project_type' when calling CreateContractorSalespersonApi.add_contractor_post" if project_type.nil?
      # verify the required parameter 'administrator_name' is set
      fail ArgumentError, "Missing the required parameter 'administrator_name' when calling CreateContractorSalespersonApi.add_contractor_post" if administrator_name.nil?
      if opts[:'title'] && !['Mr', 'Mrs', 'Miss'].include?(opts[:'title'])
        fail ArgumentError, 'invalid value for "title", must be one of Mr, Mrs, Miss'
      end
      # resource path
      local_var_path = "/add-contractor".sub('{format}','json')

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}

      # HTTP header 'Accept' (if needed)
      local_header_accept = ['application/xml', 'application/json']
      local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

      # HTTP header 'Content-Type'
      local_header_content_type = ['application/x-www-form-urlencoded']
      header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

      # form parameters
      form_params = {}
      form_params["auth_key"] = auth_key
      form_params["first_name"] = first_name
      form_params["last_name"] = last_name
      form_params["phone"] = phone
      form_params["mobile"] = mobile
      form_params["email"] = email
      form_params["probationary"] = probationary
      form_params["company_name"] = company_name
      form_params["website"] = website
      form_params["company_phone"] = company_phone
      form_params["license_number"] = license_number
      form_params["license_state"] = license_state
      form_params["license_expiration"] = license_expiration
      form_params["company_address"] = company_address
      form_params["company_city"] = company_city
      form_params["company_state"] = company_state
      form_params["company_pincode"] = company_pincode
      form_params["project_type"] = project_type
      form_params["administrator_name"] = administrator_name
      form_params["title"] = opts[:'title'] if !opts[:'title'].nil?
      form_params["company_address2"] = opts[:'company_address2'] if !opts[:'company_address2'].nil?

      # http body (model)
      post_body = nil
      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 => 'AddContractorResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CreateContractorSalespersonApi#add_contractor_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    #
    #
    # @param auth_key Auth Key
    # @param contractor_code Contractor Code
    # @param first_name Sales person first name
    # @param last_name Sales person last name
    # @param phone Sales person Work number
    # @param mobile Sales person Mobile Number
    # @param email Sales person Email id
    # @param address1 Sales person Address Line 1
    # @param city Sales person city name
    # @param state Sales person State
    # @param probationary Sales person probationary 1&#x3D;Yes or 0&#x3D;No
    # @param [Hash] opts the optional parameters
    # @option opts [String] :address2 Sales person Address Line 2
    # @return [AddSalespersonResponse]
    def add_salesperson_post(auth_key, contractor_code, first_name, last_name, phone, mobile, email, address1, city, state, probationary, opts = {})
      data, _status_code, _headers = add_salesperson_post_with_http_info(auth_key, contractor_code, first_name, last_name, phone, mobile, email, address1, city, state, probationary, opts)
      return data
    end

    #
    #
    # @param auth_key Auth Key
    # @param contractor_code Contractor Code
    # @param first_name Sales person first name
    # @param last_name Sales person last name
    # @param phone Sales person Work number
    # @param mobile Sales person Mobile Number
    # @param email Sales person Email id
    # @param address1 Sales person Address Line 1
    # @param city Sales person city name
    # @param state Sales person State
    # @param probationary Sales person probationary 1&#x3D;Yes or 0&#x3D;No
    # @param [Hash] opts the optional parameters
    # @option opts [String] :title Sales person title
    # @option opts [String] :address2 Sales person Address Line 2
    # @return [Array<(AddSalespersonResponse, Fixnum, Hash)>] AddSalespersonResponse data, response status code and response headers
    def add_salesperson_post_with_http_info(auth_key, contractor_code, first_name, last_name, phone, mobile, email, address1, city, state, probationary, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CreateContractorSalespersonApi.add_salesperson_post ..."
      end
      # verify the required parameter 'auth_key' is set
      fail ArgumentError, "Missing the required parameter 'auth_key' when calling CreateContractorSalespersonApi.add_salesperson_post" if auth_key.nil?
      # verify the required parameter 'contractor_code' is set
      fail ArgumentError, "Missing the required parameter 'contractor_code' when calling CreateContractorSalespersonApi.add_salesperson_post" if contractor_code.nil?
      # verify the required parameter 'first_name' is set
      fail ArgumentError, "Missing the required parameter 'first_name' when calling CreateContractorSalespersonApi.add_salesperson_post" if first_name.nil?
      # verify the required parameter 'last_name' is set
      fail ArgumentError, "Missing the required parameter 'last_name' when calling CreateContractorSalespersonApi.add_salesperson_post" if last_name.nil?
      # verify the required parameter 'phone' is set
      fail ArgumentError, "Missing the required parameter 'phone' when calling CreateContractorSalespersonApi.add_salesperson_post" if phone.nil?
      # verify the required parameter 'mobile' is set
      fail ArgumentError, "Missing the required parameter 'mobile' when calling CreateContractorSalespersonApi.add_salesperson_post" if mobile.nil?
      # verify the required parameter 'email' is set
      fail ArgumentError, "Missing the required parameter 'email' when calling CreateContractorSalespersonApi.add_salesperson_post" if email.nil?
      # verify the required parameter 'address1' is set
      fail ArgumentError, "Missing the required parameter 'address1' when calling CreateContractorSalespersonApi.add_salesperson_post" if address1.nil?
      # verify the required parameter 'city' is set
      fail ArgumentError, "Missing the required parameter 'city' when calling CreateContractorSalespersonApi.add_salesperson_post" if city.nil?
      # verify the required parameter 'state' is set
      fail ArgumentError, "Missing the required parameter 'state' when calling CreateContractorSalespersonApi.add_salesperson_post" if state.nil?
      # verify the required parameter 'probationary' is set
      fail ArgumentError, "Missing the required parameter 'probationary' when calling CreateContractorSalespersonApi.add_salesperson_post" if probationary.nil?
      # verify enum value
      unless ['1', '0'].include?(probationary)
        fail ArgumentError, "invalid value for 'probationary', must be one of 1, 0"
      end
      if opts[:'title'] && !['Mr', 'Mrs', 'Miss'].include?(opts[:'title'])
        fail ArgumentError, 'invalid value for "title", must be one of Mr, Mrs, Miss'
      end
      # resource path
      local_var_path = "/add-salesperson".sub('{format}','json')

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}

      # HTTP header 'Accept' (if needed)
      local_header_accept = ['application/xml', 'application/json']
      local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

      # HTTP header 'Content-Type'
      local_header_content_type = ['application/x-www-form-urlencoded']
      header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

      # form parameters
      form_params = {}
      form_params["auth_key"] = auth_key
      form_params["contractor_code"] = contractor_code
      form_params["first_name"] = first_name
      form_params["last_name"] = last_name
      form_params["phone"] = phone
      form_params["mobile"] = mobile
      form_params["email"] = email
      form_params["address1"] = address1
      form_params["city"] = city
      form_params["state"] = state
      form_params["probationary"] = probationary
      form_params["title"] = opts[:'title'] if !opts[:'title'].nil?
      form_params["address2"] = opts[:'address2'] if !opts[:'address2'].nil?

      # http body (model)
      post_body = nil
      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 => 'AddSalespersonResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CreateContractorSalespersonApi#add_salesperson_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
