syntax = "proto3";
package artistinfo;
option go_package = "./;artistInfoArtwork";

import "validate.proto";
import public "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto"; //使用 google.protobuf.Empty
// protoc -I . -I ./pb --proto_path=. --go_out=./pb/artistInfoArtwork --go-triple_out=./pb/artistInfoArtwork --validate_out="lang=go:./pb/artistInfoArtwork" ./pb/artistinfoArtwork.proto

service ArtistInfoArtwork {
  //画作相关
  rpc CreateArtworkLockRecord(CreateArtworkLockRecordReq)returns(ArtworkCommonNoParams){} //创建画作锁状态记录
  rpc ArtworkLockAction(ArtworkLockActionRequest)returns(ArtworkCommonNoParams){}  //修改状态锁
  rpc GetArtworkLockRecords(GetArtworkLockRecordsRequest)returns(ArtworkLockList){} //获取画作uid列表
  rpc GetArtworkLockHistoryGroup(GetArtworkLockHistoryRequest)returns(GetArtworkLockHistoryResponse){}//获取化作锁定时间分组记录
  rpc DeleteArtworkRecord(DeleteArtworkRecordRequest)returns(ArtworkCommonNoParams){} //删除画作锁记录
  rpc GetArtworkLockDetail(GetArtworkLockDetailRequest)returns(ArtistLockInfo){}//查询画作锁定详情
  rpc UpdateArtworkAuditStatus(UpdateArtworkAuditStatusRequest)returns(ArtworkCommonNoParams){}//更新画作审批状态
  rpc CheckArtworkBaseInfoEditable(ArtworkUidRequest)returns(CheckArtworkEditableResponse){}//查询画作基本信息是否可编辑
  rpc CheckArtworkSupplementInfoEditable(ArtworkUidRequest)returns(CheckArtworkEditableResponse){}//查询画作补充信息是否可编辑
  rpc GenerateArtworkSupplementInfo(ArtworkUidsRequest)returns(google.protobuf.Empty){}//查询画作补充信息是否可编辑
}

message ArtworkCommonNoParams{}
message ArtworkUidRequest{
  string ArtworkUid =1 [(validate.rules).message.required = true]; //画作uid
}
message ArtworkUidsRequest{
  repeated string ArtworkUids =1 [(validate.rules).message.required = true]; //画作uid列表
}
message CreateArtworkLockRecordReq{
  string artistUid=1 [(validate.rules).message.required = true];//画家uid
  string artworkUid=2 [(validate.rules).message.required = true];//画作uid
  int64  status=3;//画作锁定状态,按业务逻辑不用传
  string lockTime=4;
}

message ArtworkLockActionRequest{
  string artistUid =1 ;//画家uid
  int32 lock =2; //2=锁定 3=解锁
  string lockTime=3;//锁定时间，与sys_user表的latest_lock_time一致。
}
enum ArtworkQueryMode {
  NowPreSaveArtwork = 0; //当前暂存的画作
  NowLockedArtwork  = 1; //当前已锁定的画作
  NowPreSaveAndLocked=2;//当前暂存的和已锁定的画作
  NowAuditFlowOfBase= 3; //当前处于基本数据审核流程中的画作
  NowAuditFlowOfSupplementing = 4; //当前处于数据补充流程中的画作
  AllUnlockArtwork  = 5; //所有已解锁的画作(历史画作)
}
message GetArtworkLockRecordsRequest{
  string artistUid =1 [(validate.rules).message.required = true];//画家uid
  ArtworkQueryMode  queryType =2 ; //查询模式
  int64  AuditStatus =3; //审批状态 可选
}

message ArtistLockInfo{
  string artistUid=1;
  string artworkUid=2;
  int64  status=3;
  string lockTime=4;
  int64  createdAt=5;
  int64  updatedAt=6;
  int64  deletedAt=7;

  //基本信息审批状态
  int32 baseAuditStatus=12;
  string baseAuditMark=13;
  string baseAuditMark2=14;

  //补充信息审批状态
  int32 supplementAuditStatus=15;
  string supplementAuditMark=16;
  string supplementAuditMark2=17;
  // 当前审批流位置
  int32 auditFlowIndex =18;
  //是否用户可编辑
  bool baseEditable =19;
  bool supplementEditable=20;
}

message ArtworkLockList{
  repeated ArtistLockInfo data =1; //画作uid列表
}

message  ArtworkUidList{
  repeated string artworkUids =1 ;
}

message DeleteArtworkRecordRequest{
  repeated string artworkUids =1 ;
}

message GetArtworkLockHistoryRequest{
  string artistUid=1;
}
message GetArtworkLockDetailRequest{
  string artworkUid=1 [(validate.rules).message.required = true];//画作uid;
}
//----
message ArtworkPreviewInfo {
  string artistUuid=1;
  string artworkName=2;
  int32 length=3;
  int32 width=4;
  int32 ruler=5;
  repeated string createdAddress=6;
  string artistPhoto=7;
  string hdPic=8;
  string artworkUid=9;
  string createdDate=10;
  int32 lockStatus=11;

  //基本信息审批状态
  int32 baseAuditStatus=12;
  string baseAuditMark=13;
  string baseAuditMark2=14;

  //补充信息审批状态
  int32 supplementAuditStatus=15;
  string supplementAuditMark=16;
  string supplementAuditMark2=17;
  // 当前审批流位置
  int32 auditFlowIndex =18;

  int64  createdAt=19;
  int64  updatedAt=20;
  int64  deletedAt=21;
}
message GetArtworkLockHistoryResponse{
  repeated ArtworkLockRecord groupList =1;
}
message ArtworkLockRecord{
    string lockGroup =1;
    repeated ArtworkPreviewInfo dataList =2;
}
message UpdateArtworkAuditStatusRequest{
  string artworkUid =1;
  int64  auditStatus=5;
  string auditMark=6;
  string auditMark2=7;
  int64 flowIndex=8;//当前流程 2=基本信息审核 3=补充信息审核
  repeated string artworkUids=9; //画作批处理 与 artworkUid二选一
}
message CheckArtworkEditableResponse{
  bool editable =1;
}
