import * as _$$$MsClient from 'cn.keytop.midend.microservice.Client';

/**
 * 使用示例：111
 * import * as orgAdminClient from 'stc.ms.OrgAdminClient'
 *
 * const orgAdminClient = new orgAdminClient.OrgAdminClient()
 *  orgAdminClient.fun1('aaa','bbb','ccc')
 * .catch(error => {console.log(error)})
 * .then(value => {console.log(value)})
 *
 *
 * @author 微服务平台自动生成
 * @desc [演示-组织机构基本信息管理]接口定义
 * @date 2020-03-31 17:29:34
 **/
export class OrgAdminClient {
  private pid: string = 'stc.ms.OrgAdmin';
  private version: string = '1.2';
  private authType: _$$$MsClient.AuthType = _$$$MsClient.AuthType.BASE;
  private serviceClient: _$$$MsClient.ServiceClient;

  constructor(
    serviceClientConfig: _$$$MsClient.ServiceClientConfig = new _$$$MsClient.ServiceClientConfig()
  ) {
    this.serviceClient = new _$$$MsClient.ServiceClientImpl(
      serviceClientConfig
    );
  }

  async add(addCmOrgDTO: Add$Models.AddCmOrgDTO): Promise<Add$Models.OpResult> {
    let sid = `${this.pid}.add`;
    let tags = '';
    let header = { uri: 'org/add', pid: `${this.pid}` };
    let paramMap = {};
    let bodyObj = addCmOrgDTO;
    let response = await this.serviceClient.call(
      _$$$MsClient.HttpMethodType.POST,
      sid,
      this.version,
      tags,
      header,
      paramMap,
      bodyObj,
      this.authType,
      _$$$MsClient.RequestBodyType.RAW_JSON
    );
    if (!response) {
      return response;
    } else {
      return new Add$Models.OpResult(response);
    }
  }

  async update(cmOrg: Update$Models.CmOrg): Promise<Update$Models.OpResult> {
    let sid = `${this.pid}.update`;
    let tags = '';
    let header = { uri: 'org/update', pid: `${this.pid}` };
    let paramMap = {};
    let bodyObj = cmOrg;
    let response = await this.serviceClient.call(
      _$$$MsClient.HttpMethodType.POST,
      sid,
      this.version,
      tags,
      header,
      paramMap,
      bodyObj,
      this.authType,
      _$$$MsClient.RequestBodyType.RAW_JSON
    );
    if (!response) {
      return response;
    } else {
      return new Update$Models.OpResult(response);
    }
  }

  async delete(id: string): Promise<Delete$Models.OpResult> {
    let sid = `${this.pid}.delete`;
    let tags = '';
    let header = { uri: 'org/delete', pid: `${this.pid}` };
    let paramMap = {};
    paramMap = { id: id };
    let response = await this.serviceClient.call(
      _$$$MsClient.HttpMethodType.POST,
      sid,
      this.version,
      tags,
      header,
      paramMap,
      {},
      this.authType,
      _$$$MsClient.RequestBodyType.WWW_FORM
    );
    if (!response) {
      return response;
    } else {
      return new Delete$Models.OpResult(response);
    }
  }

  async get(id: string): Promise<Get$Models.OpResult> {
    let sid = `${this.pid}.get`;
    let tags = '';
    let header = { uri: 'org/get', pid: `${this.pid}` };
    let paramMap = {};
    paramMap = { id: id };
    let response = await this.serviceClient.get(
      sid,
      this.version,
      tags,
      header,
      paramMap,
      this.authType
    );
    if (!response) {
      return response;
    } else {
      return new Get$Models.OpResult(response);
    }
  }
}

export namespace Add$Models {
  export class AddCmOrgDTO {
    orgName?: string;
    orgCode?: string;
    tel?: string;
    email?: string;
    address?: string;
  }

  export class OpResult {
    private _ms_response_data$$$;
    private _data?: object;
    private _sUCCESS?: OpResult;
    private _fAIL?: OpResult;

    constructor(value) {
      this._ms_response_data$$$ = value;
      if (value) {
        this._data = value.data;
      }
      if (value) {
        this._sUCCESS = new OpResult(value.SUCCESS);
      }
      if (value) {
        this._fAIL = new OpResult(value.FAIL);
      }
    }
    get code(): string {
      return this._ms_response_data$$$.code;
    }
    set code(value: string) {
      this._ms_response_data$$$.code = value;
    }
    get message(): string {
      return this._ms_response_data$$$.message;
    }
    set message(value: string) {
      this._ms_response_data$$$.message = value;
    }
    get data(): object | undefined {
      return this._data;
    }
    set data(value: object | undefined) {
      this._data = value;
    }
    get SUCCESS(): OpResult | undefined {
      return this._sUCCESS;
    }
    set SUCCESS(value: OpResult | undefined) {
      this._sUCCESS = value;
    }
    get FAIL(): OpResult | undefined {
      return this._fAIL;
    }
    set FAIL(value: OpResult | undefined) {
      this._fAIL = value;
    }
  }
}

export namespace Update$Models {
  export class CmOrg {
    id?: string;
    orgName?: string;
    orgCode?: string;
    tel?: string;
    email?: string;
    address?: string;
  }

  export class OpResult {
    private _ms_response_data$$$;
    private _data?: object;
    private _sUCCESS?: OpResult;
    private _fAIL?: OpResult;

    constructor(value) {
      this._ms_response_data$$$ = value;
      if (value) {
        this._data = value.data;
      }
      if (value) {
        this._sUCCESS = new OpResult(value.SUCCESS);
      }
      if (value) {
        this._fAIL = new OpResult(value.FAIL);
      }
    }
    get code(): string {
      return this._ms_response_data$$$.code;
    }
    set code(value: string) {
      this._ms_response_data$$$.code = value;
    }
    get message(): string {
      return this._ms_response_data$$$.message;
    }
    set message(value: string) {
      this._ms_response_data$$$.message = value;
    }
    get data(): object | undefined {
      return this._data;
    }
    set data(value: object | undefined) {
      this._data = value;
    }
    get SUCCESS(): OpResult | undefined {
      return this._sUCCESS;
    }
    set SUCCESS(value: OpResult | undefined) {
      this._sUCCESS = value;
    }
    get FAIL(): OpResult | undefined {
      return this._fAIL;
    }
    set FAIL(value: OpResult | undefined) {
      this._fAIL = value;
    }
  }
}

export namespace Delete$Models {
  export class OpResult {
    private _ms_response_data$$$;
    private _data?: object;
    private _sUCCESS?: OpResult;
    private _fAIL?: OpResult;

    constructor(value) {
      this._ms_response_data$$$ = value;
      if (value) {
        this._data = value.data;
      }
      if (value) {
        this._sUCCESS = new OpResult(value.SUCCESS);
      }
      if (value) {
        this._fAIL = new OpResult(value.FAIL);
      }
    }
    get code(): string {
      return this._ms_response_data$$$.code;
    }
    set code(value: string) {
      this._ms_response_data$$$.code = value;
    }
    get message(): string {
      return this._ms_response_data$$$.message;
    }
    set message(value: string) {
      this._ms_response_data$$$.message = value;
    }
    get data(): object | undefined {
      return this._data;
    }
    set data(value: object | undefined) {
      this._data = value;
    }
    get SUCCESS(): OpResult | undefined {
      return this._sUCCESS;
    }
    set SUCCESS(value: OpResult | undefined) {
      this._sUCCESS = value;
    }
    get FAIL(): OpResult | undefined {
      return this._fAIL;
    }
    set FAIL(value: OpResult | undefined) {
      this._fAIL = value;
    }
  }
}

export namespace Get$Models {
  export class OpResult {
    private _ms_response_data$$$;
    private _data?: object;
    private _sUCCESS?: OpResult;
    private _fAIL?: OpResult;

    constructor(value) {
      this._ms_response_data$$$ = value;
      if (value) {
        this._data = value.data;
      }
      if (value) {
        this._sUCCESS = new OpResult(value.SUCCESS);
      }
      if (value) {
        this._fAIL = new OpResult(value.FAIL);
      }
    }
    get code(): string {
      return this._ms_response_data$$$.code;
    }
    set code(value: string) {
      this._ms_response_data$$$.code = value;
    }
    get message(): string {
      return this._ms_response_data$$$.message;
    }
    set message(value: string) {
      this._ms_response_data$$$.message = value;
    }
    get data(): object | undefined {
      return this._data;
    }
    set data(value: object | undefined) {
      this._data = value;
    }
    get SUCCESS(): OpResult | undefined {
      return this._sUCCESS;
    }
    set SUCCESS(value: OpResult | undefined) {
      this._sUCCESS = value;
    }
    get FAIL(): OpResult | undefined {
      return this._fAIL;
    }
    set FAIL(value: OpResult | undefined) {
      this._fAIL = value;
    }
  }
}
