syntax = "proto3";
package voucher.config;

option go_package = "voucher/cpn/conf;conf";

import "google/protobuf/duration.proto";

message Bootstrap {
  Server server = 1;
  Logs logs = 2;
  Data data = 3;
  RocketMQ rocketMQ = 4;
  Wechat wechat = 5;
  Cmb cmb = 6;
  WechatNotifyMQ wechatNotifyMQ = 7;
  Alarm alarm = 8;
  Cron cron = 9;
  RdsMQ rdsMQ = 10;
  AliYunSms aliYunSms = 11;
  Tripartite tripartite = 12;
  repeated WechatSubject wechatSubject = 13;
}

message Server {
  message HTTP {
    string network = 1;
    string addr = 2;
    google.protobuf.Duration timeout = 3;
    bool isOpenSwagger = 4;
    bool isResponseReqHeaders = 5;
  }
  HTTP http = 1;
}

message Data {
  message Database {
    string driver = 1;
    string source = 2;
    int32 maxIdle = 3;
    int32 maxOpen = 4;
    google.protobuf.Duration maxLifetime = 5;
    bool isDebug = 6;
  }
  message Redis {
    string network = 1;
    string addr = 2;
    google.protobuf.Duration readTimeout = 3;
    google.protobuf.Duration writeTimeout = 4;
    string password = 5;
    int32 poolSize = 6;
    int32 minIdleConns = 7;
    google.protobuf.Duration connMaxIdleTime = 8;
    uint32 db = 9;
  }
  Database db = 1;
  Redis redis = 2;
}


message RocketMQ {
  string addr = 1;
  string accessKey = 2;
  string secretKey = 3;
  string secretToken = 4;
  map<string, EventMap> eventMap = 5;
}

message EventMap {
  string group = 1;
  string topic = 2;
  int32 perCoroutineCnt = 3;
  bool isOpenConsumer = 4;
}

message Wechat {
  string mchID = 1;
  string mchCertificateSerialNumber = 2;
  string wechatPayPublicKeyID = 3;
  string name = 4;
}

message Cmb {
  string mid = 1;
  string aid = 2;
  string sm2Prk = 3;
  string sm2Puk = 4;
  string cmbSm2Pik = 5;
  string cmbSm2Puk = 6;
  string keyAlias = 7;
  string cmbKeyAlias = 8;
  string orgNo = 9;
  string notifyUrl = 10;
  string multiNotifyUrl = 13;
  int64 noticeStartDays = 11;
  int64 noticeEndDays = 12;
}

message WechatNotifyMQ {
  string accessKeyId = 1;
  string accessKeySecret = 2;
  string endPoint = 3;
  string regionId = 4;
  string instanceId = 5;
  string topic = 6;
  string tag = 7;
  string groupId = 8;
  string registerTagUrl = 10;
  bool isOpenConsumer = 11;
}

message Alarm {
  string webhookURL = 1;
  string secret = 2;
  bool atAll = 3;
  repeated string atMobiles = 4;
  repeated string warningMobiles = 5;
}

message Cron {
  message CommandMap {
    bool isOpen = 1;
    string command = 2;
  }
  bool isOpen = 1;
  map<string, CommandMap> commandMap = 2;
}

message RdsMQ {
  message Queue {
    string name = 1;
    bool isOpen = 2;
    uint32 retryNum = 3;
    uint32 numWorkers = 4;
    google.protobuf.Duration waitTime = 5;
  }
  Queue wechatQuery = 1;
  Queue wechatTimeSliceQuery = 2;
  Queue wechatRetry = 3;
  Queue retryNotify = 4;
  Queue orderNotifyRetry = 5;
  Queue usedNotify = 6;
}

message AliYunSms {
  string accessKeyId = 1;
  string accessKeySecret = 2;
  string endpoint = 3;
  string signName = 4;
  string templateWarning = 5;
}

message Tripartite {
  message QiXing {
    string appKey = 1;
  }
  QiXing qiXing = 1;
}

message Logs {
  string business = 1;
  string access = 2;
}

message WechatSubject {
  string mchID = 1;
  string name = 4;
  string mchCertificateSerialNumber = 2;
  string wechatPayPublicKeyID = 3;
  string mchApiV3Key = 6;
}