syntax = "proto3";
package contract;
option go_package = "./;contract";
//$ protoc --proto_path=. --go_out=./api/contract --go-triple_out=./api/contract ./api/contract/contract.proto
service Contract {
    rpc CreateContract (CreateContractRequest) returns (CreateContractRespond) {}
    rpc ContractListMgmt (ContractListMgmtRequest) returns (ContractListMgmtRespond) {}
    rpc ContractList (ContractListRequest) returns (ContractListRespond) {}
    rpc SignContract (SignContractRequest) returns (SignContractRespond) {}

    rpc FinishContract (FinishContractRequest) returns (FinishContractRespond) {}
    rpc GetContract (GetContractRequest) returns (ContractData) {}
    rpc ContractTxList (ContractTxListRequest) returns (ContractTxListRespond) {}
    rpc UpdateContract(UpdateContractRequest) returns (UpdateContractRespond) {}
    rpc UpdateContractTx(UpdateContractTxRequest) returns (UpdateContractTxRespond) {}
}

message Contracts{
   string ContractUid = 1 [json_name = "contract_uid"];
   string ArtistUid = 2 [json_name = "artist_uid"];
   string ArtworkUid = 3 [json_name = "artwork_uid"];
   string ContractId = 4 [json_name = "contract_id"];
   string TransactionId = 5 [json_name = "transaction_id"];
   int32 Type = 6 [json_name = "type"];
   string ViewUrl = 7 [json_name = "view_url"];
   string DownloadUrl = 8 [json_name = "download_url"];
   int32 State = 9 [json_name = "state"];
   int32 Status = 10 [json_name = "status"];
   string LockTime = 11 [json_name = "lock_time"];
   string SignTime = 12 [json_name = "sign_time"];
}

message CreateContractRequest {
   string ArtistUid = 1 [json_name="artist_uid"];
   repeated string ArtworkUid = 2 [json_name="artwork_uid"];
   int32 Type = 3 [json_name="type"];
}

message CreateContractRespond{
   string Msg = 1 [json_name = "msg"];
}

message ContractListMgmtRequest{
   string ArtistUid = 1 [json_name = "artist_uid"];
   int32 Page = 2 [json_name = "page"];
   int32 Num = 3 [json_name = "num"];
}

message ContractListMgmtRespond{
   repeated Contracts Data = 1 [json_name = "data"];
   string Msg = 2 [json_name = "msg"];
}

message ContractListRequest {
   int32 ID = 1 [json_name = "id"];
   int32 PageSize = 2  [json_name="pageSize"];
   int32 Page = 3 [json_name="page"];
   int32 State = 4 [json_name="state"];
 
}

message ContractListRespond {
   repeated Contracts Data = 1 [json_name = "data"];
   string Msg = 2 [json_name = "msg"];
}

message SignContractRequest {
   int32 ID = 1 [json_name = "id"];
   int32 ContractId = 2  [json_name="contractId"];
   string HtmlType = 3 [json_name="htmlType"];
   string EnvType = 4 [json_name= "envType"];
}

message SignContractRespond {
  
}

message FinishContractRequest {
   string TransactionId = 1  [json_name="transactionId"];

}

message FinishContractRespond {
 
}

message ContractData{
   uint64 ID       = 1[json_name="id"];
   int64 UserId = 2[json_name="userId"];
   string CardId = 3[json_name="cardId"];
   string MgmtUserId = 4[json_name="mgmtUserId"];
   string ArtworkId = 5[json_name="artworkId"];
   string ContractId = 6[json_name="contractId"];
   string TransactionId = 7[json_name="transactionId"];
   int64 Type = 8[json_name="type"];
   int64 BatchId = 9[json_name="batchId"];
   string BatchName = 10[json_name="batchName"];
   string ViewUrl = 11[json_name="viewUrl"];
   string DownloadUrl = 12[json_name="downloadUrl"];
   int64 State = 13[json_name="state"];
   string UpdateTime = 14 [json_name="updateTime"];
   string CreateTime = 15[json_name="createTime"];
   string ExpirationTime = 16 [json_name="expirationTime"];
   string SignTime = 17 [json_name="signTime"];
}

message ContractTxListRequest {
   int64 PageSize = 1  [json_name="pageSize"];
   int64 Page = 2 [json_name="page"];
   int64 State = 3 [json_name="state"];
   int64 ID =4 [json_name = "id"];
}

message ContractTxListRespond {
   repeated ContractData Data =1;
}

message GetContractRequest {
   int64 Id = 1  [json_name="id"];
}


message UpdateContractRequest {
   uint64 ID       = 1[json_name="id"];
   int64 UserId = 2[json_name="userId"];
   string CardId = 3[json_name="cardId"];
   string MgmtUserId = 4[json_name="mgmtUserId"];
   string ArtworkId = 5[json_name="artworkId"];
   string ContractId = 6[json_name="contractId"];
   string TransactionId = 7[json_name="transactionId"];
   int64 Type = 8[json_name="type"];
   int64 BatchId = 9[json_name="batchId"];
   string BatchName = 10[json_name="batchName"];
   string ViewUrl = 11[json_name="viewUrl"];
   string DownloadUrl = 12[json_name="downloadUrl"];
   int64 State = 13[json_name="state"];
   string UpdateTime = 14 [json_name="updateTime"];
   string CreateTime = 15[json_name="createTime"];
   string ExpirationTime = 16 [json_name="expirationTime"];
   string SignTime = 17 [json_name="signTime"];
}
message UpdateContractRespond{

}

message UpdateContractTxRequest {
   int64 ID       = 1[json_name="id"];
   string TransactionId = 2[json_name="transactionId"];
}
message UpdateContractTxRespond{

}