// Copyright © 2014, Battelle National Biodefense Institute (BNBI);
// all rights reserved. Authored by: Brian Ondov, Todd Treangen, and
// Adam Phillippy
//
// See the LICENSE.txt file included with this software for license information.

message Harvest
{
	message Reference
	{
		message Sequence
		{
			optional string tag = 1;
			optional string sequence = 2;
		}
		
		repeated Sequence references = 1;
	}
	
	message TrackList
	{
		message Track
		{
			enum Type
			{
				NONE = 0;
				GENOME = 1;
				CONTIGS = 2;
				SCAFFOLDS = 3;
				READS = 4;
			}
			
			optional string file = 1;
			optional string name = 2;
			optional Type type = 3;
			optional uint32 size = 4;
		}
		
		repeated Track tracks = 1;
		optional uint32 variantReference = 2;
	}
	
	message Tree
	{
		message Node
		{
			repeated Node children = 1;
			optional float branchLength = 2;
			optional uint32 track = 3; // 0-index to 'TrackList.tracks' (leaves only)
			optional float bootstrap = 4;
		}

		optional Node root = 1;
		optional float multiplier = 2;
	}
	
	message Alignment
	{
		message Lcb
		{
			message Region
			{
				optional uint32 track = 1; // 0-index to 'TrackList.tracks'
				optional uint32 position = 2;
				optional uint32 length = 3;
				optional bool reverse = 4;
			}
		
			repeated Region regions = 1;
			optional uint32 sequence = 2;
			optional uint32 position = 3;
			optional string name = 4;
			optional float concordance = 5;
			optional Tree tree = 6;
			optional uint32 length = 7;
		}
		
		repeated Lcb lcbs = 1;
	}
	
	message Variation
	{
		message Filter
		{
			optional uint64 flag = 1; // power of 2; used for 'Variant.filters'
			optional string name = 2;
			optional string description = 3;
		}
		
		message Variant
		{
			optional uint32 sequence = 1; // 0-index to 'Reference.references'
			optional int32 position = 2; // ungapped ref pos; dupl. for ins.
			optional string alleles = 3; // column of multialignment
			optional uint64 filters = 4; // bit field of 'Filter.flag'
			optional uint32 quality = 5;
			optional uint32 reference = 6; // char; if ref is not in alignment (eg VCF)
		}
		
		repeated Filter filters = 1;
		repeated Variant variants = 2;
		optional uint64 default = 3; // bit field of 'Filter.flag'
	}
	
	message AnnotationList
	{
		message Annotation
		{
			message Region
			{
				optional uint32 start = 1; // leftmost ref pos
				optional uint32 end = 2; // rightmost ref pos
				optional bool reverse = 3;
			}
			
			optional uint32 sequence = 1; // 0-index to 'Harvest.references'
			repeated Region regions = 2; 
			optional bool reverse = 3;
			optional string locus = 4;
			optional string name = 5;
			optional string description = 6;
			optional string feature = 7;
		}
		
		repeated Annotation annotations = 1;
	}
	
	optional Reference reference = 1;
	optional TrackList tracks = 2;
	optional Alignment alignment = 3;
	optional Tree tree = 4;
	optional Variation variation = 5;
	optional AnnotationList annotations = 6;
}
