// Copyright 2017 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -----------------------------------------------------------------------------

syntax = "proto3";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_event_pb2";

import "events.proto";


message ClientEventsSubscribeRequest {
    repeated EventSubscription subscriptions = 1;
    // The block id (or ids, if trying to walk back a fork) the subscriber last
    // received events on. It can be set to empty if it has not yet received the
    // genesis block.
    repeated string last_known_block_ids = 2;
}

message ClientEventsSubscribeResponse {
    enum Status {
         STATUS_UNSET = 0;
         OK = 1;
         INVALID_FILTER = 2;
         UNKNOWN_BLOCK = 3;
    }
    Status status = 1;
    // Additional information about the response status
    string response_message = 2;
}

message ClientEventsUnsubscribeRequest {}

message ClientEventsUnsubscribeResponse {
    enum Status {
         STATUS_UNSET = 0;
         OK = 1;
         INTERNAL_ERROR = 2;
    }
    Status status = 1;
}

message ClientEventsGetRequest {
    repeated EventSubscription subscriptions = 1;
    repeated string block_ids = 2;
}

message ClientEventsGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        INVALID_FILTER = 3;
        UNKNOWN_BLOCK = 4;
    }
    Status status = 1;
    repeated Event events = 2;

}
