import {
  Client as SoapClient,
  createClientAsync as soapCreateClientAsync,
  IExOptions as ISoapExOptions,
} from 'soap'
import { CreateCompanies } from './definitions/CreateCompanies'
import { CreateCompaniesResponse } from './definitions/CreateCompaniesResponse'
import { GetCompaniesByStatement } from './definitions/GetCompaniesByStatement'
import { GetCompaniesByStatementResponse } from './definitions/GetCompaniesByStatementResponse'
import { PerformCompanyAction } from './definitions/PerformCompanyAction'
import { PerformCompanyActionResponse } from './definitions/PerformCompanyActionResponse'
import { UpdateCompanies } from './definitions/UpdateCompanies'
import { UpdateCompaniesResponse } from './definitions/UpdateCompaniesResponse'
import { CompanyService } from './services/CompanyService'

export interface CompanyServiceClient extends SoapClient {
  CompanyService: CompanyService
  createCompaniesAsync(
    createCompanies: CreateCompanies,
    options?: ISoapExOptions,
  ): Promise<
    [
      result: CreateCompaniesResponse,
      rawResponse: any,
      soapHeader: any,
      rawRequest: any,
    ]
  >
  getCompaniesByStatementAsync(
    getCompaniesByStatement: GetCompaniesByStatement,
    options?: ISoapExOptions,
  ): Promise<
    [
      result: GetCompaniesByStatementResponse,
      rawResponse: any,
      soapHeader: any,
      rawRequest: any,
    ]
  >
  performCompanyActionAsync(
    performCompanyAction: PerformCompanyAction,
    options?: ISoapExOptions,
  ): Promise<
    [
      result: PerformCompanyActionResponse,
      rawResponse: any,
      soapHeader: any,
      rawRequest: any,
    ]
  >
  updateCompaniesAsync(
    updateCompanies: UpdateCompanies,
    options?: ISoapExOptions,
  ): Promise<
    [
      result: UpdateCompaniesResponse,
      rawResponse: any,
      soapHeader: any,
      rawRequest: any,
    ]
  >
}

/** Create CompanyServiceClient */
export function createClientAsync(
  ...args: Parameters<typeof soapCreateClientAsync>
): Promise<CompanyServiceClient> {
  return soapCreateClientAsync(args[0], args[1], args[2]) as any
}
