syntax = "proto3";

option go_package = ".;base";

package base;

enum ErrorCode{
  OK = 0;
  PGErr = 100;
  PmsnError = 110;
  J2MError = 120;
  WebStatusError = 121;
  WebToImStatusError = 122;
  ImToWebtatusError = 123;
  PARAM = 150;
  Token = 200;
  VerifyCode = 201;
  PasswordWrongTooMuch = 202;
}

// metadata 中需要字段 tokefrgen n 用作登录验证
service Api {
  rpc SignUp (SignUpRequest) returns (DefaultReply) {}
  rpc SignIn (SignInRequest) returns (SignInReply)  {}
  // rpc SignInWithPhone (SignInRequest) returns (SignInReply)  {} // 缺少短信验证码接口
  rpc SignOut (DefaultRequest) returns (DefaultReply)  {}
  rpc GenVerifyImage (GenVerifyImageRequest) returns (GenVerifyImageReply)  {}

  // 下拉框接口
  rpc SelectHrSensors (StandardRequest) returns (StandardReply)  {}
  rpc AcrossUserSimpleQuery (StandardRequest) returns (StandardReply)  {}
  rpc VipUserSimpleQuery (StandardRequest) returns (StandardReply)  {}
  rpc TempVipUserSimpleQuery (StandardRequest) returns (StandardReply)  {}
  rpc ShopSimpleQuery (StandardRequest) returns (StandardReply)  {}
  rpc ManageableSimpleQuery (StandardRequest) returns (StandardReply)  {}
  rpc ClassSimpleQuery (StandardRequest) returns (StandardReply)  {}
  rpc ScreenSimpleQuery (StandardRequest) returns (StandardReply)  {}

  // 商家信息管理
  rpc ManageableShopList (ShopListRequest) returns (ShopListReply) {}
  rpc ManageableGetShopInfo (ShopDetailRequest) returns (ShopInfo) {}
  rpc ShopLicenseList (ShopDetailRequest) returns (LicenseList) {}
  rpc ShopLicenseTypeMap (IdList) returns (LicenseTypeMapReply)  {}
  rpc GetShopNavi (GetShopNaviRequest) returns (GetShopNaviReply) {}
  rpc ShopGroupQuery (StandardRequest) returns (StandardReply) {}
  rpc ShopGroupAdd (StandardRequest) returns (StandardReply) {}
  rpc ShopGroupEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopGroupStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopGroupDetailsQuery (StandardRequest) returns (StandardReply) {}
  rpc ShopGroupDetailsAdd (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueQuery (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueAdd (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueEquipQuery (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueEquipAdd (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueEquipEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueEquipStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopVenueEquipStatusDel (StandardRequest) returns (StandardReply) {}
  rpc ShopManagerQuery (StandardRequest) returns (StandardReply) {}
  rpc ShopManagerAdd (StandardRequest) returns (StandardReply) {}
  rpc ShopManagerEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopManagerStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopConfigQuery (StandardRequest) returns (StandardReply) {}
  rpc ShopConfigEdit (StandardRequest) returns (StandardReply) {}
  // 商家会员管理
  rpc ShopVipUserQuery (StandardRequest) returns (StandardReply) {}
  rpc ShopVipUserAdd (StandardRequest) returns (StandardReply) {}
  rpc ShopVipUserEdit (StandardRequest) returns (StandardReply) {}
  rpc ShopVipUserStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc AcrossVipUserQuery (StandardRequest) returns (StandardReply) {}
  rpc AcrossVipUserAdd (StandardRequest) returns (StandardReply) {}
  rpc AcrossVipUserDel (StandardRequest) returns (StandardReply) {}
  rpc VipPhoneQuery (StandardRequest) returns (StandardReply) {}
  rpc VipMainPhoneCheck (StandardRequest) returns (StandardReply) {}
  rpc VipOtherPhoneAdd (StandardRequest) returns (StandardReply) {}
  rpc VipOtherPhoneEdit (StandardRequest) returns (StandardReply) {}
  rpc VipOtherPhoneStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc TempVipUserQuery (StandardRequest) returns (StandardReply) {}
  rpc TempVipUserAdd (StandardRequest) returns (StandardReply) {}
  rpc TempVipUserEdit (StandardRequest) returns (StandardReply) {}
  rpc TempVipUserStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc VipHourEdit (StandardRequest) returns (StandardReply) {}
  rpc VipConsumeListQuery (StandardRequest) returns (StandardReply) {}
  rpc VipConsumeDetailQuery (StandardRequest) returns (StandardReply) {}
  rpc VipClassRelationEdit (StandardRequest) returns (StandardReply) {}
  rpc VipHourChgQuery (StandardRequest) returns (StandardReply) {}
  rpc VipUserClassQuery (StandardRequest) returns (StandardReply) {}
  rpc GetOverlayImgQiNiuToken (GetOverlayImgRequest) returns (QiNiuTokenReply) {}
  rpc GetSimpleQiNiuToken (DefaultRequest) returns (QiNiuTokenReply) {}

  // 商家课程管理
  rpc ClassQuery (StandardRequest) returns (StandardReply) {}
  rpc ClassAdd (StandardRequest) returns (StandardReply) {}
  rpc ClassEdit (StandardRequest) returns (StandardReply) {}
  rpc ClassStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc ClassColorEdit (StandardRequest) returns (StandardReply) {}
  rpc ClassWxVisibleEdit (StandardRequest) returns (StandardReply) {}
  rpc ClassVipEdit (StandardRequest) returns (StandardReply) {}
  rpc SttPlanBasicQuery (StandardRequest) returns (StandardReply) {}
  rpc SttPlanBasicAdd (StandardRequest) returns (StandardReply) {}
  rpc SttPlanBasicEdit (StandardRequest) returns (StandardReply) {}
  rpc SttPlanBasicShopEdit (StandardRequest) returns (StandardReply) {}
  rpc SttPlanBasicStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc SttPlanBasicPublish (StandardRequest) returns (StandardReply) {}
  rpc SttPlanPreview (StandardRequest) returns (StandardReply) {}
  rpc SttPlanCopy (StandardRequest) returns (StandardReply) {}
  rpc SttPlanDetailQuery (StandardRequest) returns (StandardReply) {}
  rpc SttPlanDetailBatchSave (StandardRequest) returns (StandardReply) {}
  rpc STTBasicQuery (StandardRequest) returns (StandardReply) {}
  rpc STTBasicAdd (StandardRequest) returns (StandardReply) {}
  rpc STTBasicEdit (StandardRequest) returns (StandardReply) {}
  rpc STTBasicStatusEdit (StandardRequest) returns (StandardReply) {}
  rpc STTBasicPreview (StandardRequest) returns (StandardReply) {}
  rpc STTBasicCopy (StandardRequest) returns (StandardReply) {}
  rpc STTBasicOfflineEdit (StandardRequest) returns (StandardReply) {}
  rpc STTDetailListQuery (StandardRequest) returns (StandardReply) {}
  rpc STTBasicDetailBatchSave (StandardRequest) returns (StandardReply) {}
  rpc STTDetailAllowDelCheck (StandardRequest) returns (StandardReply) {}

  // 商家上下课管理
  rpc CourseDetailQuery (StandardRequest) returns (StandardReply) {}

  // 商家预约管理
  rpc OrderListQuery (StandardRequest) returns (StandardReply) {}
  rpc OrderAddByManager (StandardRequest) returns (StandardReply) {}
  rpc OrderCancelByManager (StandardRequest) returns (StandardReply) {}
  rpc OrderStatistics (StandardRequest) returns (StandardReply) {}
  rpc ClassOrderQuery (StandardRequest) returns (StandardReply) {}
  rpc VipUserOrderQuery (StandardRequest) returns (StandardReply) {}

  // 心率
  rpc HrSensorsPublicQuery (StandardRequest) returns (StandardReply) {}
  rpc HrSensorsPvtQuery (StandardRequest) returns (StandardReply) {}
  rpc AddHrSensors (StandardRequest) returns (StandardReply) {}
  rpc AddPvtHrSensors (StandardRequest) returns (StandardReply) {}
  rpc EditHrSensors (StandardRequest) returns (StandardReply) {}
  rpc HrSensorsDel (StandardRequest) returns (StandardReply) {}
  rpc PKGroupChg (StandardRequest) returns (StandardReply) {}
  rpc BindHrSensor (StandardRequest) returns (StandardReply) {}
  rpc UnBindHrSensor (StandardRequest) returns (StandardReply) {}

  // 评分管理
  rpc ActionQuery (StandardRequest) returns (StandardReply) {}

  // 用户微信登陆
  rpc GenVerifyImageByWinXin(GenVerifyImageRequest)returns(GenVerifyImageReply){}
  rpc GenPhoneVerifyCode(GenPhoneVerifyCodeRequest)returns(DefaultReply){}
  rpc CheckVerifyCode(CheckVerifyCodeRequest)returns(DefaultReply){}

}
message DefaultRequest{
}
message DefaultReply{}

message StandardRequest{
  int64 shopID = 1;
  string jsonStr = 2;
  string sign = 3;
}

message StandardReply{
  string jsonRst = 1;
  string sign = 2;
}

message SignUpRequest {
  string name = 1;
  string password = 2;
}

message SignInReply {
  string token = 1;
}

message SignInRequest {
  string name = 1;
  string password = 2;
  string codeId = 3;
  string verifyCode = 4;
}

message GenVerifyImageRequest{
  int32 height = 1;
  int32 width = 2;
}

message GenVerifyImageReply{
  string codeId = 1;
  string imageBase64 = 2;
}

message ShopInfo{
  int64 shopId = 1;
  string name = 2;
  int64 sId = 3;
  string addr = 4;
  string phone = 5;
  string contacts = 6;
  WebStatus status = 7;
  string  created_at = 8;
  int64 created_user = 9;
  string updated_at = 10;
  int64 updated_user = 11;
  int64 is_hr = 12;
  int64 is_score = 13;
  string shopUUID = 14;
}

message ShopDetailRequest{
  int64 shopId = 1;
}

message ShopListRequest{
  // 模糊查询
  string name = 1;
  // Status_Null查询全部
  WebStatus status = 2;
  //上级商家Id, -1 时查询全部
  int64 sId = 3;
}

message ShopListReply{
  repeated ShopInfo list = 1;
}

enum WebStatus{
  Ban = 0;
  On = 1;
  Delete = 9;
  All = 99;
}

message GetShopNaviRequest{
  int64 shopId = 1;
  // 最顶层为0
  int64 parentId = 2;
}

message Column{
  string name = 1;
  string url = 2;
  string code = 3;
  // 顺序
  int32 sn = 4;
  WebStatus status = 5;
  bool navShow = 6;
  string id = 7;
}

message GetShopNaviReply{
  repeated Column list = 1;
}

message GetOverlayImgRequest{
  string fileName = 1;
}

message QiNiuTokenReply{
  string token = 1;
}

message License{
  int64 id = 1;
  int64 shopId = 2;
  int64 lcsTypeId = 3;
  string name = 4;
  // nanoSec
  int64 validPeriod = 5;
  // 分
  int64 lcsPrice = 6;
  // nanoSec
  int64 lcsBeginTime = 7;
  // nanoSec
  int64 lcsEndTime = 8;

  int64 feeId = 9;
  WebStatus status = 10;
  string memo = 11;
  // nanoSec
  int64  createdAt = 12;
  int64 createdUser = 13;
  // nanoSec
  int64 updatedAt = 14;
  int64 updatedUser = 15;
}

message LicenseList{
  repeated License list = 1;
}

message IdList{
  repeated int64 idList = 1;
}

message LicenseType{
  int64 typeId = 1;
  string name = 2;
  // 有效期时长，单位毫秒
  int64 validPeriodMs = 3;
  // 单位：分
  int32 price = 4;
  string memo = 5;
  int64 execUser = 6;
  WebStatus status = 7;
}

message LicenseTypeMapReply{
  map<int64, LicenseType> licenseMap = 1;
}

enum VerifyType{
  Undefined = 0;
  SignUp = 1;
  SignIn = 2;
  ChangePassword = 3;
}

message GenPhoneVerifyCodeRequest{
  VerifyType verifyType = 1;
  string code = 2;
  string account = 3;
  string ip = 4;
  string templateCode = 5;
  int64 expireDurationNano = 6;
}

message CheckVerifyCodeRequest{
  VerifyType verifyType = 1;
  string code = 2;
  string account = 3;
}