/*
 * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you 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 = "org.wso2.analytics.mgw.grpc.service";

import "google/protobuf/empty.proto";

message AnalyticsStreamMessage {
    string messageStreamName = 1;
    string meta_clientType = 2;
    string applicationConsumerKey = 3;
    string applicationName = 4;
    string applicationId = 5;
    string applicationOwner = 6;
    string apiContext = 7;
    string apiName = 8;
    string apiVersion = 9;
    string apiResourcePath = 10;
    string apiResourceTemplate = 11;
    string apiMethod = 12;
    string apiCreator = 13;
    string apiCreatorTenantDomain = 14;
    string apiTier = 15;
    string apiHostname = 16;
    string username = 17;
    string userTenantDomain = 18;
    string userIp = 19;
    string userAgent = 20;
    int64 requestTimestamp  = 21;
    bool throttledOut = 22;
    int64 responseTime = 23;
    int64 serviceTime  = 24;
    int64 backendTime = 25;
    bool responseCacheHit = 26;
    int64 responseSize = 27;
    string protocol = 28;
    int32 responseCode = 29;
    string destination = 30;
    int64 securityLatency = 31;
    int64 throttlingLatency = 32;
    int64 requestMedLat = 33;
    int64 responseMedLat = 34;
    int64 backendLatency = 35;
    int64 otherLatency = 36;
    string gatewayType = 37;
    string label = 38;

    string subscriber = 39;
    string throttledOutReason = 40;
    int64 throttledOutTimestamp = 41;
    string hostname = 42;

    string errorCode = 43;
    string errorMessage = 44;
}


service AnalyticsSendService {
    rpc sendAnalytics(stream AnalyticsStreamMessage) returns(google.protobuf.Empty);
}
