syntax = "proto3";

option csharp_namespace = "AElf.Kernel";

import "common.proto";
import "resource.proto";

message SideChainBlockInfo{
    uint64 Height = 1;
    Hash BlockHeaderHash = 2;
    Hash TransactionMKRoot = 3;
    Hash ChainId = 4;
}

message ParentChainBlockInfo{
    ParentChainBlockRootInfo Root = 1;

    // Indexed block height from side chain and merkle path for this side chain block
    map<uint64, MerklePath> IndexedBlockInfo = 2;
}

message ParentChainBlockRootInfo
{
    uint64 Height = 1;
    // Merkle tree root of side chain block headers
    Hash SideChainBlockHeadersRoot = 2;

    // Merkle tree root of side chain block transaction roots
    Hash SideChainTransactionsRoot = 3;
    Hash ChainId = 4;
}

message MerklePath{
    repeated Hash Path = 1;
}

enum SideChainStatus
{
    Apply = 0;
    Review = 1;
    Active = 2;
    Terminated = 3;
}

message SideChainInfo{
    uint64 IndexingPrice = 1;
    uint64 LockedTokenAmount = 2;
    repeated ResourceTypeBalancePair ResourceBalances = 3;
    bytes ContractCode = 4;
    Address Proposer = 5;
    SideChainStatus SideChainStatus = 6;
    Hash ChainId = 7;
}