/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

syntax = "proto3";
package contractMicroservice;
//import "github.com/mwitkow/go-proto-validators/validator.proto";

option go_package = "./;contractMicroservice";

service ContractMicroservice {
  rpc RegisterPerson (RegisterPersonRequest) returns (RegisterResponse) {} //个人注册
  rpc PersonVerify (PersonVerifyRequest) returns (PersonVerifyResponse) {} //个人身份校验

  rpc RegisterOrg (RegisterOrgRequest) returns (RegisterResponse) {} //主体注册
  rpc CompanyVerify (CompanyVerifyRequest) returns (PersonVerifyResponse) {} //主体身份校验

  rpc FindPersonCertInfo (FindCertInfo) returns (PersonCertInfoResponse) {} //主体身份校验
  rpc FindCompanyCertInfo (FindCertInfo) returns (CompanyCertInfoResponse) {} //主体身份校验

  rpc ApplyCert (ApplyCertRequest) returns (CommonResponse) {} //颁发证书

  rpc AddSignature (AddSignRequest) returns (AddSignResponse) {} //实名证书申请
  rpc CustomSign (CustomSignRequest) returns (CustomSignResponse) {} //自定义印章
  rpc UploadTemplate (UploadTemplateRequest) returns (CommonResponse) {} //上传文本
  rpc UploadDocs (UploadDocsRequest) returns (CommonResponse) {} //上传文本
  rpc GenerateContract (GenerateContractRequest) returns (ViewCommonResponse) {} //模板填充
  rpc ExtSignAuto (ExtSignAutoRequest) returns (ViewCommonResponse) {} //自动签章
  rpc BeforeAuthSign (BeforeAuthSignRequest) returns (JumpCommonResponse) {} //自动签章 授权
  rpc ExtSign (ExtSignRequest) returns (JumpCommonResponse) {} //授权
  rpc ViewContract (ContractRequest) returns (JumpCommonResponse) {} //查看合同
  rpc DownLoadContract (ContractRequest) returns (JumpCommonResponse) {} //查看合同
  rpc ContractFiling (ContractRequest) returns (CommonResponse) {} //合同归档
  rpc GetPdfTemplateKeys (PdfTemplateKeysRequest) returns (PdfTemplateKeysResponse) {} //获取合同模板的key值

  rpc AuthStatus (CustomerIdRequest) returns (AuthStatusResponse) {} //获取合同模板的key值
  rpc CancelExtSignAuto (CancelExtSignAutoRequest) returns (JumpCommonResponse) {} //取消授权签协议接口
}

message CancelExtSignAutoRequest {
  string CustomerId = 1;
  string NotifyUrl = 2;
  string returnUrl = 3;
}

message Person {
  string AreaCode = 1;
  string AuditFailReason = 2;
  string AuditorTime = 3;
  string BackgroundIdCardPath = 4;
  string BankCardNo = 5;
  string Birthday = 6;
  string CertType = 7;
  string ExpiresDate = 8;
  string Fork = 9;
  string GesturesPhotoPath = 10;
  string HeadPhotoPath = 11;
  string IdCard = 12;
  string IsLongTerm = 13;
  double IsPassFourElement = 14;
  double IsPassThreeElement = 15;
  string IssueAuthority = 16;
  string Mobile = 17;
  string PersonName = 18;
  string PhotoUuid = 19;
  string Sex = 20;
  string StartDate = 21;
  string Status = 22;
  string Type = 23;
  string VerifyType = 24;
  string Address = 25;
}

message PersonCertInfoResponse {
  Person Person  = 1 [json_name = "person"];
  string AuthenticationSubmitTime  = 2 [json_name = "authenticationSubmitTime"];
  string PassTime  = 3 [json_name = "passTime"];
  string TransactionNo  = 4 [json_name = "transactionNo"];
  string Type  = 5 [json_name = "type"];
}

message FindCertInfo {
  string VerifiedSerialno  = 2 [json_name = "verifiedSerialno"];
}
message Company{
   string AuditFailReason = 1;
   string AuditorTime = 2;
   string CertificatesType = 3;
   string CompanyEmail = 4;
   string CompanyName = 5;
   string Hasagent = 6;
   string Legal = 7;
   string LegalMobile = 8;
   string LegalName = 9;
   string Organization = 10;
   string OrganizationPath = 11;
   string OrganizationType = 12;
   string RegFormPath = 13;
   string RelatedTransactionNo = 14;
   string Status = 15;
   string VerifyType = 16;
}

message Manager {
  string AreaCode = 1;
  string AuditFailReason = 2;
  string AuditorTime = 3;
  string BackgroundIdCardPath = 4;
  string Birthday = 5;
  string ExpiresDate = 6;
  string Fork = 7;
  string HeadPhotoPath = 8;
  string IdCard = 9;
  string IsLongTerm = 10;
  string IssueAuthority = 11;
  string Mobile = 12;
  string PersonName = 13;
  string PhotoUuid = 14;
  string Sex = 15;
  string StartDate = 16;
  string Status = 17;
  string Type = 18;
  string VerifyType = 19;
  string Address = 20;
}

message CompanyCertInfoResponse {
  Company Company  = 1 [json_name = "Company"];
  Manager Manager  = 2 [json_name = "manager"];
  string AuthenticationSubmitTime  = 3 [json_name = "authenticationSubmitTime"];
  string PassTime  = 4 [json_name = "passTime"];
  string TransactionNo  = 5 [json_name = "transactionNo"];
  string Type  = 6 [json_name = "type"];
}

message AuthStatusResponse {
  uint64 AuthType  = 1 [json_name = "authType"];
  string ContractId  = 2 [json_name = "contractId"];
  uint64 Status  = 3 [json_name = "status"];
  string TransactionId  = 4 [json_name = "transactionId"];
}

message ApplyCertRequest {
  string CustomerId = 1 [json_name = "customerId"];
  string VerifiedSerialno  = 2 [json_name = "verifiedSerialno"];
}

message ViewCommonResponse {
  string DownloadUrl = 1 [json_name = "downloadUrl"];
  string ViewPdfUrl  = 2 [json_name = "viewPdfUrl"];
}


message PdfTemplateKeysRequest {
  string TemplateId = 1 [json_name = "templateId"];
}

message PdfTemplateKeysResponse {
  repeated string Keys = 1 [json_name = "Keys"];
}

message JumpCommonResponse {
  string JumpUrl = 1 [json_name = "jumpUrl"];
}

message ContractRequest {
  string ContractId = 1 [json_name = "contractId"];
}

message ExtSignRequest {
  string TransactionId = 1 [json_name = "transactionId"];
  string ContractId  = 2 [json_name = "contractId"];
  string CustomerId  = 3 [json_name = "customerId"];
  string ReturnUrl  = 4 [json_name = "returnUrl"];
  string DocTitle  = 5 [json_name = "docTitle"];
  string OpenEnvironment  = 6 [json_name = "openEnvironment"];
  string MobileSignType  = 7 [json_name = "mobileSignType"];
  string SignKeyword  = 8 [json_name = "signKeyword"];
  string Keyx  = 9 [json_name = "keyx"];
  string Keyy  = 10 [json_name = "keyy"];
  string SignatureShowTime  = 11 [json_name = "signatureShowTime"];
  string PcHandSignature  = 12 [json_name = "PcHandSignature"];
}

message BeforeAuthSignRequest {
  string TransactionId = 1 [json_name = "transactionId"];
  string ContractId  = 2 [json_name = "contractId"];
  string CustomerId  = 3 [json_name = "customerId"];
  string ReturnUrl  = 4 [json_name = "returnUrl"];
  string NotifyUrl  = 5 [json_name = "notifyUrl"];
}


message UploadDocsRequest {
  string  ContractId        = 1     [json_name = "customerId"];
  string  DocTitle          = 2     [json_name = "docTitle"];
  string  DocUrl            = 3     [json_name = "docUrl"];
  string  File              = 4     [json_name = "file"];
  //string  doc_type        = 1     [json_name = "customerId"];
}

message CompanyVerifyRequest {
  string  CustomerId        = 1     [json_name = "customerId"];
}

message UploadTemplateResponse {
  string  CustomerId        = 1     [json_name = "customerId"];
}

message PersonVerifyRequest {
    string CustomerId       = 1     [json_name = "customerId"];
    string VerifiedWay      = 2     [json_name = "verifiedWay"];
    string CustomerName     = 3     [json_name = "customerName"];
    string CustomerIdentNo  = 4     [json_name = "customerIdentNo"];
    string Mobile           = 5     [json_name = "mobile"];
    string ReturnUrl        = 6     [json_name = "returnUrl"];
}

message PersonVerifyResponse {
  string TransactionNo =1;
  string Url           =2;
}

message RegisterResponse {
  string CustomerId = 1     [json_name = "customerId"];
}

message CustomerIdRequest {
  string CustomerId = 1     [json_name = "customerId"];
}

message CommonResponse {
}

message RegisterOrgRequest {
  string                  OpenId        = 1     [json_name = "openId"];
}

message RegisterPersonRequest {
  string                 OpenId            = 1     [json_name = "openId"];
}

message AddSignRequest {
  string    CustomerId            = 1     [json_name = "customerId"];
  bytes     ReadImgByte           = 2     [json_name = "readImgByte"];
}

message AddSignResponse {
  string SignatureId  = 1     [json_name = "signatureId"];
}

message CustomSignRequest {
  string CustomerId = 1     [json_name = "customerId"];
  string Content  = 2     [json_name = "content"];
}

message CustomSignResponse {
  string SignatureImgBase64 = 1     [json_name = "signatureImgBase64"];
}


message UploadTemplateRequest {
  string TemplateId = 1     [json_name = "templateId"];
  string DocUrl = 2     [json_name = "docUrl"];
}

message ExtSignAutoRequest {
  string    TransactionId = 1     [json_name = "transactionId"];
  string    ContractId    = 2     [json_name = "contractId"];
  string    CustomerId    = 3     [json_name = "customerId"];
  string    ClientRole    = 4     [json_name = "clientRole"];
  string    DocTitle      = 5     [json_name = "docTitle"];
  string    SignKeyword   = 6     [json_name = "signKeyword"];
  string    SignatureId   = 7     [json_name = "signatureId"];
  string    KeyX   = 9     [json_name = "keyX"];
  string    KeyY   = 10     [json_name = "keyY"];
}

message GenerateContractRequest {
    string TemplateId     = 1 [json_name="templateId"];
    string ContractId     = 2 [json_name="templateId"];
    string ParameterMap   = 3 [json_name="ParameterMap"];
    string DynamicTables = 4 [json_name="dynamicTables"];
}

