/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('gts-dayu', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model CreateByAccountRequest {
  phone?: string(name='Phone', description='phone'),
  dingOrgId?: string(name='DingOrgId', description='dingOrgId'),
  accountUserId?: string(name='AccountUserId', description='accountUserId'),
}

model CreateByAccountResponseBody = {
  errorMsg?: string(name='ErrorMsg', description='errorMsg'),
  data?: boolean(name='Data', description='data'),
  errorCode?: string(name='ErrorCode', description='errorCode'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model CreateByAccountResponse = {
  headers: map[string]string(name='headers'),
  body: CreateByAccountResponseBody(name='body'),
}

async function createByAccountWithOptions(request: CreateByAccountRequest, runtime: Util.RuntimeOptions): CreateByAccountResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = query,
  };
  return doRPCRequest('CreateByAccount', '2021-03-24', 'HTTPS', 'GET', 'AK', 'json', req, runtime);
}

async function createByAccount(request: CreateByAccountRequest): CreateByAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return createByAccountWithOptions(request, runtime);
}

model CreatePidRequest {
  contactPersonName?: string(name='ContactPersonName', description='contactPersonName'),
  aliyunUid?: string(name='AliyunUid', description='aliyunUid'),
  licenseNum?: string(name='LicenseNum', description='licenseNum'),
  contactPersonPhone?: string(name='ContactPersonPhone', description='contactPersonPhone'),
  contactPersonMail?: string(name='ContactPersonMail', description='contactPersonMail'),
}

model CreatePidResponseBody = {
  message?: string(name='Message', description='message'),
  data?: string(name='Data', description='data'),
  code?: string(name='Code', description='code'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model CreatePidResponse = {
  headers: map[string]string(name='headers'),
  body: CreatePidResponseBody(name='body'),
}

async function createPidWithOptions(request: CreatePidRequest, runtime: Util.RuntimeOptions): CreatePidResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('CreatePid', '2021-03-24', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function createPid(request: CreatePidRequest): CreatePidResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPidWithOptions(request, runtime);
}

model AddApplyOrderRequest {
  articleSpecName?: string(name='ArticleSpecName', description='articleSpecName'),
  gmtModified?: long(name='GmtModified', description='gmtModified'),
  hardwareWarranty?: string(name='HardwareWarranty', description='hardwareWarranty'),
  productModel?: string(name='ProductModel', description='productModel'),
  articleName?: string(name='ArticleName', description='articleName'),
  expectTime?: long(name='ExpectTime', description='expectTime'),
  bpId?: string(name='BpId', description='bpId'),
  articleSpecCode?: string(name='ArticleSpecCode', description='articleSpecCode'),
  applyOrderId?: string(name='ApplyOrderId', description='applyOrderId'),
  remark?: string(name='Remark', description='remark'),
  hardwareLevel?: string(name='HardwareLevel', description='hardwareLevel'),
  requestor?: string(name='Requestor', description='requestor'),
  applicant?: string(name='Applicant', description='applicant'),
  laboratoryAddress?: string(name='LaboratoryAddress', description='laboratoryAddress'),
  signNum?: int32(name='SignNum', description='signNum'),
  laboratoryCode?: string(name='LaboratoryCode', description='laboratoryCode'),
  subitemName?: string(name='SubitemName', description='subitemName'),
  bpidName?: string(name='BpidName', description='bpidName'),
  articleSpecDesc?: string(name='ArticleSpecDesc', description='articleSpecDesc'),
  articleCode?: string(name='ArticleCode', description='articleCode'),
  designatedBrand?: string(name='DesignatedBrand', description='designatedBrand'),
  budget?: string(name='Budget', description='budget'),
  applyDesc?: string(name='ApplyDesc', description='applyDesc'),
  purchaseDesc?: string(name='PurchaseDesc', description='purchaseDesc'),
}

model AddApplyOrderResponseBody = {
  errorMsg?: string(name='ErrorMsg', description='errorMsg'),
  data?: boolean(name='Data', description='data'),
  errorCode?: string(name='ErrorCode', description='errorCode'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model AddApplyOrderResponse = {
  headers: map[string]string(name='headers'),
  body: AddApplyOrderResponseBody(name='body'),
}

async function addApplyOrderWithOptions(request: AddApplyOrderRequest, runtime: Util.RuntimeOptions): AddApplyOrderResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('AddApplyOrder', '2021-03-24', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function addApplyOrder(request: AddApplyOrderRequest): AddApplyOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return addApplyOrderWithOptions(request, runtime);
}

model QueryApplyOrderAllDetailRequest {
  id?: string(name='Id'),
  type?: string(name='Type'),
}

model QueryApplyOrderAllDetailResponseBody = {
  errorMsg?: string(name='ErrorMsg', description='errorMsg'),
  data?: {
    applyOrderId?: string(name='ApplyOrderId'),
    bpId?: string(name='BpId'),
    articleSpecCode?: string(name='ArticleSpecCode'),
    articleSpecDesc?: string(name='ArticleSpecDesc'),
    applyDesc?: string(name='ApplyDesc'),
    budget?: string(name='Budget'),
    laboratoryAddress?: string(name='LaboratoryAddress'),
    articleName?: string(name='ArticleName'),
    currentPurchaseNum?: int32(name='CurrentPurchaseNum'),
    expectTime?: long(name='ExpectTime'),
    hardwareWarranty?: string(name='HardwareWarranty'),
    hardwareWarrantyLevel?: string(name='HardwareWarrantyLevel'),
    designatedBrand?: string(name='DesignatedBrand'),
    productModel?: string(name='ProductModel'),
    purchaseDesc?: string(name='PurchaseDesc'),
    remark?: string(name='Remark'),
    subOrders?: [ 
      {
        subOrderId?: string(name='SubOrderId'),
        applyOrderId?: long(name='ApplyOrderId'),
        orderType?: string(name='OrderType'),
        articleSpecDesc?: string(name='ArticleSpecDesc'),
        categoryName?: string(name='CategoryName'),
        purchaseUse?: string(name='PurchaseUse'),
        signNum?: string(name='SignNum'),
        unitPrice?: string(name='UnitPrice'),
        sumPrice?: string(name='SumPrice'),
        purchaseType?: string(name='PurchaseType'),
        brand?: string(name='Brand'),
        supplierName?: string(name='SupplierName'),
        supplierApproveUrl?: string(name='SupplierApproveUrl'),
        attachmentId?: string(name='AttachmentId'),
        attachmentIds?: [ string ](name='AttachmentIds'),
        remark?: string(name='Remark'),
        prNumber?: string(name='PrNumber'),
        prNumberUrl?: string(name='PrNumberUrl'),
        prLineId?: string(name='PrLineId'),
        poId?: string(name='PoId'),
        poIdUrl?: string(name='PoIdUrl'),
        status?: string(name='Status'),
        uom?: string(name='Uom'),
        preShipTime?: long(name='PreShipTime'),
        shipTime?: long(name='ShipTime'),
        signTime?: long(name='SignTime'),
        installTime?: long(name='InstallTime'),
        acceptedTime?: long(name='AcceptedTime'),
        purchaseDesc?: string(name='PurchaseDesc'),
        productions?: [ 
          {
            productId?: string(name='ProductId'),
            productModel?: string(name='ProductModel'),
            num?: int32(name='Num'),
            poId?: string(name='PoId'),
            factoryName?: string(name='FactoryName'),
            batchNo?: string(name='BatchNo'),
            preSnNo?: string(name='PreSnNo'),
            warranty?: int32(name='Warranty'),
            warrantyLevel?: string(name='WarrantyLevel'),
            status?: string(name='Status'),
            uom?: string(name='Uom'),
            acceptTime?: long(name='AcceptTime'),
          }
        ](name='Productions'),
        goodsDetails?: [ 
          {
            productId?: string(name='ProductId'),
            productModel?: string(name='ProductModel'),
            num?: int32(name='Num'),
            poId?: string(name='PoId'),
            factoryName?: string(name='FactoryName'),
            batchNo?: string(name='BatchNo'),
            preSnNo?: string(name='PreSnNo'),
            warranty?: int32(name='Warranty'),
            warrantyLevel?: string(name='WarrantyLevel'),
            status?: string(name='Status'),
            uom?: string(name='Uom'),
            acceptTime?: long(name='AcceptTime'),
          }
        ](name='GoodsDetails'),
      }
    ](name='SubOrders'),
  }(name='Data', description='data'),
  errorCode?: string(name='ErrorCode', description='errorCode'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model QueryApplyOrderAllDetailResponse = {
  headers: map[string]string(name='headers'),
  body: QueryApplyOrderAllDetailResponseBody(name='body'),
}

async function queryApplyOrderAllDetailWithOptions(request: QueryApplyOrderAllDetailRequest, runtime: Util.RuntimeOptions): QueryApplyOrderAllDetailResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = query,
  };
  return doRPCRequest('QueryApplyOrderAllDetail', '2021-03-24', 'HTTPS', 'GET', 'AK', 'json', req, runtime);
}

async function queryApplyOrderAllDetail(request: QueryApplyOrderAllDetailRequest): QueryApplyOrderAllDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryApplyOrderAllDetailWithOptions(request, runtime);
}

model QueryCompanyInfoRequest {
  param0?: string(name='Param0', description='param0'),
}

model QueryCompanyInfoResponseBody = {
  message?: string(name='Message', description='message'),
  data?: {
    entName?: string(name='entName'),
    legalName?: string(name='legalName'),
    recCap?: string(name='recCap'),
    website?: string(name='website'),
    entAddress?: string(name='entAddress'),
    opScope?: string(name='opScope'),
    industry?: string(name='industry'),
  }(name='Data', description='data'),
  code?: string(name='Code', description='code'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model QueryCompanyInfoResponse = {
  headers: map[string]string(name='headers'),
  body: QueryCompanyInfoResponseBody(name='body'),
}

async function queryCompanyInfoWithOptions(request: QueryCompanyInfoRequest, runtime: Util.RuntimeOptions): QueryCompanyInfoResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = query,
  };
  return doRPCRequest('QueryCompanyInfo', '2021-03-24', 'HTTPS', 'GET', 'AK', 'json', req, runtime);
}

async function queryCompanyInfo(request: QueryCompanyInfoRequest): QueryCompanyInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCompanyInfoWithOptions(request, runtime);
}

model TaskListRequest {
  prLineId?: string(name='PrLineId', description='prLineId'),
  bpId?: string(name='BpId', description='bpId'),
  articleSpecCode?: string(name='ArticleSpecCode', description='articleSpecCode'),
  pageSize?: int32(name='PageSize', description='pageSize'),
  applyOrderId?: int32(name='ApplyOrderId', description='applyOrderId'),
  prNumber?: string(name='PrNumber', description='prNumber'),
  requirementId?: string(name='RequirementId', description='requirementId'),
  pageNum?: int32(name='PageNum', description='pageNum'),
  poId?: string(name='PoId', description='poId'),
  status?: string(name='Status', description='status'),
}

model TaskListResponseBody = {
  errorMsg?: string(name='ErrorMsg', description='errorMsg'),
  data?: {
    pageNum?: int32(name='PageNum'),
    pageSize?: int32(name='PageSize'),
    rows?: [ 
      {
        id?: int32(name='Id'),
        applyOrderId?: string(name='ApplyOrderId'),
        requirementId?: string(name='RequirementId'),
        bpId?: string(name='BpId'),
        articleSpecCode?: string(name='ArticleSpecCode'),
        articleSpecDesc?: string(name='ArticleSpecDesc'),
        poId?: string(name='PoId'),
        prLineId?: string(name='PrLineId'),
        prNo?: string(name='PrNo'),
        status?: string(name='Status'),
        preShipTime?: long(name='PreShipTime'),
        shipTime?: long(name='ShipTime'),
        signTime?: long(name='SignTime'),
        installTime?: long(name='InstallTime'),
        acceptedTime?: long(name='AcceptedTime'),
        bpidName?: string(name='BpidName'),
      }
    ](name='Rows'),
    total?: long(name='Total'),
  }(name='Data', description='data'),
  errorCode?: string(name='ErrorCode', description='errorCode'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model TaskListResponse = {
  headers: map[string]string(name='headers'),
  body: TaskListResponseBody(name='body'),
}

async function taskListWithOptions(request: TaskListRequest, runtime: Util.RuntimeOptions): TaskListResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('TaskList', '2021-03-24', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function taskList(request: TaskListRequest): TaskListResponse {
  var runtime = new Util.RuntimeOptions{};
  return taskListWithOptions(request, runtime);
}

model QueryPersonInfoRequest {
  accountUserId?: string(name='AccountUserId', description='accountUserId'),
}

model QueryPersonInfoResponseBody = {
  errorMsg?: string(name='ErrorMsg', description='errorMsg'),
  data?: {
    id?: string(name='Id'),
    isCompleted?: boolean(name='IsCompleted'),
    pid?: string(name='Pid'),
    name?: string(name='Name'),
    sex?: long(name='Sex'),
    age?: long(name='Age'),
    phoneNo?: string(name='PhoneNo'),
    email?: string(name='Email'),
  }(name='Data', description='data'),
  errorCode?: string(name='ErrorCode', description='errorCode'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model QueryPersonInfoResponse = {
  headers: map[string]string(name='headers'),
  body: QueryPersonInfoResponseBody(name='body'),
}

async function queryPersonInfoWithOptions(request: QueryPersonInfoRequest, runtime: Util.RuntimeOptions): QueryPersonInfoResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = query,
  };
  return doRPCRequest('QueryPersonInfo', '2021-03-24', 'HTTPS', 'GET', 'AK', 'json', req, runtime);
}

async function queryPersonInfo(request: QueryPersonInfoRequest): QueryPersonInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryPersonInfoWithOptions(request, runtime);
}

model PushCertDataRequest {
  gmtModified?: string(name='GmtModified', description='gmtModified'),
  idCard?: string(name='IdCard', description='idCard'),
  effectiveTime?: int32(name='EffectiveTime', description='effectiveTime'),
  companyName?: string(name='CompanyName', description='companyName'),
  creatorId?: string(name='CreatorId', description='creatorId'),
  creatorName?: string(name='CreatorName', description='creatorName'),
  authName?: string(name='AuthName', description='authName'),
  authProperties?: int32(name='AuthProperties', description='authProperties'),
  authTime?: string(name='AuthTime', description='authTime'),
  certificateSerialNumber?: string(name='CertificateSerialNumber', description='certificateSerialNumber'),
  valid?: int32(name='Valid', description='valid'),
  id?: long(name='Id', description='id'),
  employeeName?: string(name='EmployeeName', description='employeeName'),
  dingId?: string(name='DingId', description='dingId'),
  authDirection?: int32(name='AuthDirection', description='authDirection'),
  upStringrName?: string(name='UpStringrName', description='upStringrName'),
  employeeId?: string(name='EmployeeId', description='employeeId'),
  telephone?: string(name='Telephone', description='telephone'),
  authConfigId?: long(name='AuthConfigId', description='authConfigId'),
  gmtCreate?: string(name='GmtCreate', description='gmtCreate'),
  upStringrId?: string(name='UpStringrId', description='upStringrId'),
  authInvalidTime?: string(name='AuthInvalidTime', description='authInvalidTime'),
  authNumber?: string(name='AuthNumber', description='authNumber'),
  authLevel?: int32(name='AuthLevel', description='authLevel'),
  status?: int32(name='Status', description='status'),
}

model PushCertDataResponseBody = {
  message?: string(name='Message', description='message'),
  data?: boolean(name='Data', description='data'),
  code?: string(name='Code', description='code'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model PushCertDataResponse = {
  headers: map[string]string(name='headers'),
  body: PushCertDataResponseBody(name='body'),
}

async function pushCertDataWithOptions(request: PushCertDataRequest, runtime: Util.RuntimeOptions): PushCertDataResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('PushCertData', '2021-03-24', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function pushCertData(request: PushCertDataRequest): PushCertDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return pushCertDataWithOptions(request, runtime);
}

model QueryBaseDictRequest {
  type?: string(name='Type', description='param0'),
  code?: string(name='Code', description='param1'),
  pageSize?: int32(name='PageSize', description='param2'),
  pageNum?: int32(name='PageNum', description='param3'),
}

model QueryBaseDictResponseBody = {
  errorMsg?: string(name='ErrorMsg', description='errorMsg'),
  data?: {
    pageNum?: int32(name='PageNum'),
    pageSize?: int32(name='PageSize'),
    rows?: [ 
      {
        name?: string(name='Name'),
        value?: string(name='Value'),
      }
    ](name='Rows'),
    total?: long(name='Total'),
  }(name='Data', description='data'),
  errorCode?: string(name='ErrorCode', description='errorCode'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model QueryBaseDictResponse = {
  headers: map[string]string(name='headers'),
  body: QueryBaseDictResponseBody(name='body'),
}

async function queryBaseDictWithOptions(request: QueryBaseDictRequest, runtime: Util.RuntimeOptions): QueryBaseDictResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = query,
  };
  return doRPCRequest('QueryBaseDict', '2021-03-24', 'HTTPS', 'GET', 'AK', 'json', req, runtime);
}

async function queryBaseDict(request: QueryBaseDictRequest): QueryBaseDictResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryBaseDictWithOptions(request, runtime);
}

model GetPartnerInfoByDingOrgIdRequest {
  dingOrgId?: string(name='DingOrgId', description='dingOrgId'),
}

model GetPartnerInfoByDingOrgIdResponseBody = {
  errorMsg?: string(name='ErrorMsg', description='errorMsg'),
  data?: {
    id?: string(name='Id', description='id'),
    pid?: string(name='Pid'),
    companyName?: string(name='CompanyName'),
  }(name='Data', description='data'),
  errorCode?: string(name='ErrorCode', description='errorCode'),
  success?: boolean(name='Success', description='success'),
  exception?: map[string]any(name='Exception', description='exception'),
  requestId?: string(name='RequestId'),
}

model GetPartnerInfoByDingOrgIdResponse = {
  headers: map[string]string(name='headers'),
  body: GetPartnerInfoByDingOrgIdResponseBody(name='body'),
}

async function getPartnerInfoByDingOrgIdWithOptions(request: GetPartnerInfoByDingOrgIdRequest, runtime: Util.RuntimeOptions): GetPartnerInfoByDingOrgIdResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = query,
  };
  return doRPCRequest('GetPartnerInfoByDingOrgId', '2021-03-24', 'HTTPS', 'GET', 'AK', 'json', req, runtime);
}

async function getPartnerInfoByDingOrgId(request: GetPartnerInfoByDingOrgIdRequest): GetPartnerInfoByDingOrgIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPartnerInfoByDingOrgIdWithOptions(request, runtime);
}

