/* Copyright 2016 Google Inc. All Rights Reserved.

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.
==============================================================================*/

// LINT: ALLOW_GROUPS
// Protocol buffer specifications for task configuration.

syntax = "proto2";
option optimize_for = LITE_RUNTIME;

package chrome_lang_id;

// Task input descriptor.
message TaskInput {
  // Name of input resource.
  required string name = 1;

  // Name of stage responsible of creating this resource.
  optional string creator = 2;

  // File format for resource.
  repeated string file_format = 3;

  // Record format for resource.
  repeated string record_format = 4;

  // Is this resource multi-file?
  optional bool multi_file = 5 [default = false];

  // An input can consist of multiple file sets.
  repeated group Part = 6 {
    // File pattern for file set.
    optional string file_pattern = 7;

    // File format for file set.
    optional string file_format = 8;

    // Record format for file set.
    optional string record_format = 9;
  }
}

// Task output descriptor.
message TaskOutput {
  // Name of output resource.
  required string name = 1;

  // File format for output resource.
  optional string file_format = 2;

  // Record format for output resource.
  optional string record_format = 3;

  // Number of shards in output. If it is different from zero this output is
  // sharded. If the number of shards is set to -1 this means that the output is
  // sharded, but the number of shard is unknown. The files are then named
  // 'base-*-of-*'.
  optional int32 shards = 4 [default = 0];

  // Base file name for output resource. If this is not set by the task
  // component it is set to a default value by the workflow engine.
  optional string file_base = 5;

  // Optional extension added to the file name.
  optional string file_extension = 6;
}

// A task specification is used for describing executing parameters.
message TaskSpec {
  // Name of task.
  optional string task_name = 1;

  // Workflow task type.
  optional string task_type = 2;

  // Task parameters.
  repeated group Parameter = 3 {
    required string name = 4;
    optional string value = 5;
  }

  // Task inputs.
  repeated TaskInput input = 6;

  // Task outputs.
  repeated TaskOutput output = 7;
}
