/**
 * # Network Staking Rewards
 * The information needed to calculate the staking rewards for all nodes in
 * the network.
 *
 * ### Keywords
 * The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
 * "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
 * document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119)
 * and clarified in [RFC8174](https://www.ietf.org/rfc/rfc8174).
 */
syntax = "proto3";

package proto;

// SPDX-License-Identifier: Apache-2.0
option java_package = "com.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.state.token">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "services_timestamp.proto";

/**
 * An Hedera Token Service staking reward entity.
 * This stores values related to the aggregate staking rewards for all nodes in
 * the network. It is calculated at the beginning of each staking period.
 */
message NetworkStakingRewards {

    /**
     * A flag indicating that staking rewards are activated on the network.
     * <p>
     * Among other criteria, this is set to true when the balance of 0.0.800
     * (the account that pays rewards) reaches a minimum required balance.
     */
    bool staking_rewards_activated = 1;

    /**
     * A global snapshot of the `stake_to_reward` value for all nodes at the
     * beginning of the current staking period.
     * <p>
     * The `stake_to_reward` value is the sum of balance and `staked_to_me` for
     * all accounts staked to a node that do not decline staking rewards.<br/>
     * This is needed for calculating rewards for current staking period without
     * considering changes to `stake_to_reward` within the current staking period.<br/>
     * This value SHALL be reset at the beginning of every staking period.
     */
    int64 total_staked_reward_start = 2;

    /**
     * A global snapshot of the `stake` value for all nodes at the beginning of
     * the current staking period.
     * <p>
     * The `stake` value is the sum of balance and `staked_to_me` for all
     * accounts staked to a node, and SHALL NOT consider whether the account
     * has accepted or declined rewards.<br/>
     * This value SHALL be reset at the beginning of every staking period.
     */
    int64 total_staked_start = 3;

    /**
     * The total staking rewards, in tinybars, that may be collected by all
     * accounts staking to all nodes after the end of this staking period.
     * <p>
     * This SHALL be calculated assuming that no account "renounces" its
     * rewards by setting `decline_reward` to true, or is ineligible for some
     * other reason.<br/>
     * If a node is removed, the `pending_rewards` value of that node SHALL be
     * subtracted from this value.
     */
    int64 pending_rewards = 4;

    /**
     * The last time a node reward payment was made. This will be set at the
     * end of a staking period.
     */
    proto.Timestamp last_node_reward_payments_time = 5;
}
