/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF 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.
 */

/**
 * Genavro format for a particular protocol found in Hadoop MapReduce.
 * Used as a test case/example to show that we can express real-world stuff more
 * succinctly.
 */
@namespace("org.apache.hadoop.mapreduce.jobhistory")
protocol Events {
  record JhCounter {
    string name;
    string displayName;
    long value;
  }

  record JhCounterGroup {
    string name;
    string displayName;
    array<JhCounter> counts;
  }

  record JhCounters {
    string name;
    array<JhCounterGroup> groups;
  }

  record JobFinished {
    string jobid;
    timestamp_ms finishTime;
    decimal(9,2) finishRatio;
    int finishedMaps;
    int finishedReduces;
    int failedMaps;
    int failedReduces;
    JhCounters totalCounters;
    JhCounters mapCounters;
    JhCounters reduceCounters;
  }

  record JobInited {
    string jobid;
    timestamp_ms launchTime;
    int totalMaps;
    int totalReduces;
    string jobStatus;
  }

  record JobSubmitted {
    string jobid;
    string jobName;
    string userName;
    timestamp_ms submitTime;
    string jobConfPath;
  }

  // ... TODO continue
}
