import {
  Client as SoapClient,
  createClientAsync as soapCreateClientAsync,
  IExOptions as ISoapExOptions,
} from 'soap'
import { GetSegmentPopulationResultsByIds } from './definitions/GetSegmentPopulationResultsByIds'
import { GetSegmentPopulationResultsByIdsResponse } from './definitions/GetSegmentPopulationResultsByIdsResponse'
import { PerformSegmentPopulationAction } from './definitions/PerformSegmentPopulationAction'
import { PerformSegmentPopulationActionResponse } from './definitions/PerformSegmentPopulationActionResponse'
import { UpdateSegmentMemberships } from './definitions/UpdateSegmentMemberships'
import { UpdateSegmentMembershipsResponse } from './definitions/UpdateSegmentMembershipsResponse'
import { SegmentPopulationService } from './services/SegmentPopulationService'

export interface SegmentPopulationServiceClient extends SoapClient {
  SegmentPopulationService: SegmentPopulationService
  getSegmentPopulationResultsByIdsAsync(
    getSegmentPopulationResultsByIds: GetSegmentPopulationResultsByIds,
    options?: ISoapExOptions,
  ): Promise<
    [
      result: GetSegmentPopulationResultsByIdsResponse,
      rawResponse: any,
      soapHeader: any,
      rawRequest: any,
    ]
  >
  performSegmentPopulationActionAsync(
    performSegmentPopulationAction: PerformSegmentPopulationAction,
    options?: ISoapExOptions,
  ): Promise<
    [
      result: PerformSegmentPopulationActionResponse,
      rawResponse: any,
      soapHeader: any,
      rawRequest: any,
    ]
  >
  updateSegmentMembershipsAsync(
    updateSegmentMemberships: UpdateSegmentMemberships,
    options?: ISoapExOptions,
  ): Promise<
    [
      result: UpdateSegmentMembershipsResponse,
      rawResponse: any,
      soapHeader: any,
      rawRequest: any,
    ]
  >
}

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