// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

syntax = "proto3";

import "lcommon.proto";

package types;
option go_package = "../types";

message AutonomyProposalBoard {
    ProposalBoard propBoard = 1;
    // 投票该提案的规则
    RuleConfig curRule = 2;
    // 投票董事会
    ActiveBoard board = 3;
    // 全体持票人投票结果
    VoteResult voteResult = 4;
    // 状态
    int32  status     = 5;
    string address    = 6;
    int64  height     = 7;
    int32  index      = 8;
    string proposalID = 9;
}

enum BoardUpdate {
    INV = 0;
    //新增
    ADDBoard = 1;
    //剔除
    DELBoard = 2;
    //整体替换
    REPLACEALL = 3;
}

// action
message ProposalBoard {
    // 提案时间
    int32 year  = 1;
    int32 month = 2;
    int32 day   = 3;

    // 是否更新
    bool update = 4;
    // 提案董事会成员
    repeated string boards = 5;

    // 投票相关
    int64 startBlockHeight   = 6; // 提案开始投票高度
    int64 endBlockHeight     = 7; // 提案结束投票高度
    int64 realEndBlockHeight = 8; // 实际提案结束投票高度

    //代替update,并扩展
    BoardUpdate boardUpdate = 9;

}

message RevokeProposalBoard {
    string proposalID = 1;
}

message VoteProposalBoard {
    string   proposalID        = 1;
    bool     approve           = 2;
    //真正投票地址
    repeated string originAddr = 3;
    //代替approve，并增加了弃权选项
    AutonomyVoteOption voteOption      = 4;
}

message TerminateProposalBoard {
    string proposalID = 1;
}

// receipt
message ReceiptProposalBoard {
    AutonomyProposalBoard prev    = 1;
    AutonomyProposalBoard current = 2;
}

message LocalProposalBoard {
    AutonomyProposalBoard propBd = 1;
    repeated string comments     = 2;
}

// query
message ReqQueryProposalBoard {
    int32  status    = 1;
    string addr      = 2;
    int32  count     = 3;
    int32  direction = 4;
    int64  height    = 5;
    int32  index     = 6;
}

message ReplyQueryProposalBoard {
    repeated AutonomyProposalBoard propBoards = 1;
}
