// Copyright 2021 gRPC authors.
//
// 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";

package filter_fuzzer;

message Empty {}

message AuthContext {}

message AuthorizationEngine {
    oneof engine {
        string always_allow = 1;
        string always_deny = 2;
    }
}

message AuthorizationPolicyProvider {
    AuthorizationEngine allow_engine = 1;
    AuthorizationEngine deny_engine = 2;
}

message ChannelArg {
    string key = 1;
    oneof value {
        bytes str = 2;
        int64 i = 3;
        Empty resource_quota = 4;
        Empty transport = 5;
        Empty channel_security_connector = 6;
        AuthContext auth_context = 7;
        AuthorizationPolicyProvider authorization_policy_provider = 8;
    }
}

message Metadatum {
    bytes key = 1;
    bytes value = 2;
}

message Metadata {
    repeated Metadatum metadata = 1;
}

message FinishCheckCallHost {
    uint32 qry = 1;
    uint32 status = 2;
    string message = 3;
}

message GlobalObjectAction {
    oneof type {
        uint32 set_resource_quota = 1;
        FinishCheckCallHost finish_check_call_host = 2;
    }
}

message TransportOneWayStats {
    uint64 framing_bytes = 1;
    uint64 data_bytes = 2;
    uint64 header_bytes = 3;
}

message FinalInfo {
    uint32 status = 1;
    string error_string = 2;
    uint64 latency_us = 3;
    TransportOneWayStats incoming = 4;
    TransportOneWayStats outgoing = 5;
}

message Action {
    uint32 call = 1;
    oneof type {
        Empty cancel = 9;
        Metadata create_call = 10;
        Metadata receive_initial_metadata = 11;
        Metadata receive_trailing_metadata = 12;
        GlobalObjectAction global_object_action = 13;
        uint64 advance_time_microseconds = 14;
        FinalInfo set_final_info = 15;
    }
}

message Msg {
    string filter = 1;
    int32 channel_stack_type = 3;
    string stack_name = 4;
    repeated ChannelArg channel_args = 2;
    repeated Action actions = 100;
}
