syntax = "proto3";
package Criteo.Glup;
option java_package = "com.criteo.glup";

import "tests/integration/schema_registry/data/proto/metadata_proto.proto";
import "tests/integration/schema_registry/data/proto/common_proto.proto";

message ClickCas {
  option (contains_nullable_fields) = true;

  option (glup).producers = {
    kafka: true
  };

  option (glup).kafka = {
    topic: "glup_click_cas"
  };

  option (glup).dataset = {
    id: "click_cas"
    java_class: "com.criteo.glup.ClickCasProto$ClickCas"
    kind: TIMESERIES
    partition_scheme: PLATFORM_HOURLY
    owner: "enginejoins"
    retention_days: 390
    // Switch time: 2018-03-20-11 timestamp: 1521543600
    format {
      path: "/glup/datasets/click_cas/data/full/JSON_PAIL"
      file_format: JSON_PAIL
      priority: 100
      label: "FEDERATED_JSON_PAIL"
    }
    format {
      path: "/glup/datasets/click_cas/data/full/PROTOBUF_PARQUET"
      file_format: PROTOBUF_PARQUET
      priority: 50
      label: "FEDERATED_PROTOBUF_PARQUET"
    }
  };

  option (glup).hdfs = {
    import: {
      owner: "enginejoins"
      name: "click_cas"
      partitioning: PLATFORM_HOURLY

      generator {
        kafka2hdfs {
          topic: "glup_click_cas"
          output_dataset_id: "click_cas"
          output_format_label: "FEDERATED_JSON_PAIL"
        }
        to { env: PROD dc: PA4 }
      }

      // Transcoding to Parquet to prepare the migration
      generator {
        transcoding {
          input_dataset_id: "click_cas" input_dataset_label: "FEDERATED_JSON_PAIL"
          output_dataset_id: "click_cas" output_dataset_label: "FEDERATED_PROTOBUF_PARQUET"
        }
        to: { env: PROD    dc: PA4 }
      }

      view: {
        hive: { partitioning: PLATFORM_HOURLY }
      }
    }
  };

  Origin glup_origin = 1;
  Partition partition = 2;
  string uid = 5;
  // Schema field
  // (...)
  map<int32, bool> set_fields = 50010; // nullable tracking special field
  repeated ControlMessage.Watermark control_message = 2097151 [ (json).name = "__metadata" ]; // standard glup field

  reserved 70 to 73, 75;
  reserved "obsolete", "obsolete2";
}
