// 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;

message AutonomyProposalRule {
    ProposalRule  propRule   = 1;
    RuleConfig    rule       = 2;
    // 全体持票人投票结果
    VoteResult    voteResult = 3;
    // 状态
    int32         status     = 4;
    string        address    = 5;
    int64         height     = 6;
    int32         index      = 7;
}

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

    // 规则可修改项,如果某项不修改则置为-1
    RuleConfig ruleCfg       = 4;
    // 投票相关
    int64 startBlockHeight   = 5; // 提案开始投票高度
    int64 endBlockHeight     = 6; // 提案结束投票高度
    int64 realEndBlockHeight = 7; // 实际提案结束投票高度
}

message RevokeProposalRule {
    string proposalID = 1;
}

message VoteProposalRule {
    string proposalID = 1;
    bool   approve    = 2;
}

message TerminateProposalRule {
    string proposalID = 1;
}

// receipt
message ReceiptProposalRule {
    AutonomyProposalRule prev = 1;
    AutonomyProposalRule current  = 2;
}

message LocalProposalRule {
    AutonomyProposalRule propRule = 1;
    repeated string      comments = 2;
}

// query
message ReqQueryProposalRule {
    //优先根据status查询
    int32  status    = 1;
    int32  count     = 2;
    int32  direction = 3;
    int64  index     = 4;
}

message ReplyQueryProposalRule {
    repeated AutonomyProposalRule propRules = 1;
}