syntax = "proto2";

package midi;

message Note {
  optional int32 start = 1;
  optional int32 end = 2;
  optional int32 pitch = 3;
}

message Event {
  optional int32 time = 1; //REQUIRED
  optional int32 velocity = 2; //REQUIRED
  optional int32 pitch = 3; //REQUIRED
  optional int32 instrument = 4;
  optional int32 track = 5;
  optional int32 qtime = 6;
  optional int32 bar = 7;
  optional bool is_drum = 8;
  optional bool should_prune = 9;
  optional int32 track_type = 10;
}

message Bar {
  repeated int32 events = 1; //REQUIRED
  optional bool is_four_four = 2;
  optional bool has_notes = 3;
  optional int32 time = 4;
  optional float beat_length = 5; //REQUIRED
  optional bool should_prune = 6;
  optional bool is_drum = 7;
}

message Track {
  repeated Bar bars = 1; //REQUIRED
  optional bool is_drum = 2;
  optional int32 min_pitch = 3;
  optional int32 max_pitch = 4;
  optional int32 instrument = 5; //REQUIRED
  optional float av_polyphony = 6;
  optional int32 note_density = 7;
  optional int32 note_density_v2 = 8; //REQUIRED
  optional int32 te_track = 9;
  optional int32 max_polyphony = 10;
  optional int32 type = 11; //REQUIRED
  optional bool should_prune = 12;
  optional int32 order = 13;
  repeated int32 train_types = 14; // to INDICATE POSSIBLE TRACKS FOR TRAINING
}

message ValidTrack {
  repeated int32 tracks = 1;
}

message Piece {
  repeated Track tracks = 1; //REQUIRED
  repeated Event events = 2; //REQUIRED
  optional int32 resolution = 3; //REQUIRED
  optional int32 tempo = 4; //REQUIRED
  optional int32 min_pitch = 5;
  optional int32 max_pitch = 6;
  repeated int32 valid_segments = 7;
  repeated uint32 valid_tracks = 8;
  repeated string msd_cd1 = 9;
  repeated string msd_cd2 = 10;
  repeated string msd_cd2c = 11;
  optional int32 segment_length = 12;
  repeated ValidTrack valid_tracks_v2 = 13;
}


message StatusTrack {
  optional int32 track_id = 1; //REQUIRED
  optional int32 track_type = 2; //REQUIRED
  optional string instrument = 3; //REQUIRED
  optional int32 density = 4; //REQUIRED
  repeated bool selected_bars = 5; //REQUIRED
}

message Status {
  repeated StatusTrack tracks = 1; //REQUIRED
}


message Dataset {
  message Item {
    required uint64 start = 1;
    required uint64 end = 2;
    required uint64 src_size = 3;
  }
  repeated Item train = 1;
  repeated Item valid = 2;
  repeated Item test = 3;
}