// @flow
export type ConnectionType = {|
	from: string,
	to: string,
	channel: string,
|};

export type NormalBlock = {|
	inputs: string[],
	outputs: string[],
	synchronized_channel: string,
	name: string,
|};

export type DatasetBlock = {|
	outputs: string[],
	name: string,
|};

export type AnalyzerBlock = {|
	inputs: string[],
	synchronized_channel: string,
	name: string,
|};

export type BlockType = NormalBlock | DatasetBlock | AnalyzerBlock;

export type BlockSet = 'analyzers' | 'blocks' | 'datasets';

export type BlockCoords = {|
	x: number,
	y: number,
	height: number,
	width: number,
|};


export type Group = {|
	name: string,
	blocks: string[],
	collapsed: boolean,
|};

export type LocationMapEntry = {|
	block: BlockCoords,
	inputs?: { [string]: BlockCoords },
	outputs?: { [string]: BlockCoords },
|};

export type LocationMap = {|
	[string]: LocationMapEntry,
|};

export type Contents = {|
	description: string,
	datasets: DatasetBlock[],
	blocks: NormalBlock[],
	analyzers: AnalyzerBlock[],
	connections: ConnectionType[],
	representation: {
		blocks: { [string]: BlockCoords },
		channel_colors: { [string]: string },
		connections: { [string]: any[] },
	}
|};
