// Copyright the Hyperledger Fabric contributors. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";

option java_package = "org.hyperledger.fabric.protos.peer";
option go_package = "github.com/hyperledger/fabric-protos-go/peer";

package protos;

// ChaincodeQueryResponse returns information about each chaincode that pertains
// to a query in lscc.go, such as GetChaincodes (returns all chaincodes
// instantiated on a channel), and GetInstalledChaincodes (returns all chaincodes
// installed on a peer)
message ChaincodeQueryResponse {
    repeated ChaincodeInfo chaincodes = 1;
}

// ChaincodeInfo contains general information about an installed/instantiated
// chaincode
message ChaincodeInfo {
    string name = 1;
    string version = 2;
    // the path as specified by the install/instantiate transaction
    string path = 3;
    // the chaincode function upon instantiation and its arguments. This will be
    // blank if the query is returning information about installed chaincodes.
    string input = 4;
    // the name of the ESCC for this chaincode. This will be
    // blank if the query is returning information about installed chaincodes.
    string escc = 5;
    // the name of the VSCC for this chaincode. This will be
    // blank if the query is returning information about installed chaincodes.
    string vscc = 6;
    // the chaincode unique id.
    // computed as: H(
    //                H(name || version) ||
    //                H(CodePackage)
    //              )
    bytes id = 7;
}

// ChannelQueryResponse returns information about each channel that pertains
// to a query in lscc.go, such as GetChannels (returns all channels for a
// given peer)
message ChannelQueryResponse {
    repeated ChannelInfo channels = 1;
}

// ChannelInfo contains general information about channels
message ChannelInfo {
    string channel_id = 1;
}

// JoinBySnapshotStatus contains information about whether or a JoinBySnapshot operation
// is in progress and the related bootstrap dir if it is running.
message JoinBySnapshotStatus {
    bool in_progress = 1;
    string bootstrapping_snapshot_dir = 2;
}
