/*
PiAnoS (Picture Annotation System), A fingerprint examiner training tool
Copyright (C) 2011-2012 University of Lausanne, Switzerland
https://ips-labs.unil.ch/pianos

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see http://www.gnu.org/licenses/.
*/

Pianos4Constants = {

	// BEGIN-JSON-PARSABLE-DATA
	
	quality: {
		ansi_nist: [
			{id: 1, color: '#00ffff', label: 'Definitive Pores'},
			{id: 2, color: '#3366ff', label: 'Definitive Ridge Edges'},
			{id: 3, color: '#01ff02', label: 'Definitive Minutiae'},
			{id: 4, color: '#ffff00', label: 'Debatable Minutiae'},
			{id: 5, color: '#fe0000', label: 'Debatable Ridge Flow'},
			{id: 6, color: '#010101', label: 'Background'},
		],
		standard: [
			{id: 1, color: '#2ca02c', label: 'High'},
			{id: 2, color: '#ff7f0e', label: 'Medium'},
			{id: 3, color: '#d62728', label: 'Low'},
		],
		conversions: {
			an_to_std: {
				1: 1, 2: 1,
				3: 2, 4: 2,
				5: 3, 6: 3,
			},
			std_to_an: {
				1: 1,
				2: 3,
				3: 5,
			}
		},
	},
	
	details: [
		{id: 1, color: '#e377c2', label: 'Crease'},
		{id: 2, color: '#17becf', label: 'Scar'},
		{id: 3, color: '#bcbd22', label: 'Other (incipients, level 3 detail, etc.)'},
	],
	
	conclusions: {
		analysis: {
			suitability_approach: [
				{id: 1, label: '#1 (value for identification)'},
				{id: 2, label: '#2 (value for comparison)'},
			],
			value: [
				{id: 1, label: 'Suitable for identification'},
				{id: 2, label: 'Suitable only for exclusion'},
				{id: 0, label: 'No value'}
			],
			degradation: [
				{id: 1,  label: 'Low contrast with background'},
				{id: 2,  label: 'Substrate noise, texture or pattern'},
				{id: 3,  label: 'Tonal (color) reversal'},
				{id: 4,  label: 'Double tap'},
				{id: 5,  label: 'Superimposed (multiple impressions overlaid)'},
				{id: 6,  label: 'Extreme deposition pressure'},
				{id: 7,  label: 'Slippage (smearing or drag marks)'},
				{id: 8,  label: 'Twisting'},
				{id: 9, label: 'Non-contiguous ridge detail (separated by a break in substrate or a break in the latent)'},
 			],
			details: {
				'Level 1': [
					{id: 100,  label: 'Distinct'},
					{id: 101,  label: 'Indistinct'},
				],
				'Level 2': [
					{id: 200,  label: 'Most distinct'},
					{id: 201,  label: 'Few distinct'},
					{id: 202,  label: 'Most indistinct'},
				],
				'Level 3': [
					{id: 300,  label: 'Abundant'},
					{id: 301,  label: 'Minimal'},
					{id: 302,  label: 'None'},
				],
			},
			general_pattern: [
				{id: 1, label: 'Simple arch', url: 'css/general_patterns/arch_h_2.jpg'},
				{id: 2, label: 'Tented arch', url: 'css/general_patterns/t_arch_h_2.jpg'},
				{id: 3, label: 'Right loop', url: 'css/general_patterns/r_loop_h_1.jpg'},
				{id: 4, label: 'Left loop', url: 'css/general_patterns/l_loop_h_1.jpg'},
				{id: 5, label: 'Whorl', url: 'css/general_patterns/whorl_h_1.jpg'},
			],
		},
		comparison: {
			decision: [
				{id: 0, label: 'Exclusion'},
				{id: 3, label: 'Leaning towards exclusion'},
				{id: 5, label: 'Inconclusive'},
				{id: 7, label: 'Leaning towards identification'},
				{id: 10, label: 'Identification'},
			],
			decision_step1: [
				{id: 1, label: 'Identification'},
				{id: 0, label: 'Exclusion'},
				{id: 2, label: 'Inconclusive'},
			],
			decision_step2: [
				{id: 1, label: 'Leaning towards identification'},
				{id: 2, label: 'Leaning towards exclusion'},
				{id: 0, label: 'Neither'},
			],
			details: {
				'Level 1': [
					{id: 100,  label: 'Yes'},
					{id: 101,  label: 'No'},
				],
				'Level 2': [
					{id: 200,  label: 'Yes'},
					{id: 201,  label: 'No'},
				],
				'Level 3': [
					{id: 300,  label: 'Yes'},
					{id: 301,  label: 'No'},
				],
			},
		},
	},
	
	acev: {
		
		steps: [
			{id: 1, label: 'Analysis'},
			{id: 2, label: 'Comparison'},
			{id: 3, label: 'Evaluation'},
			{id: 4, label: 'Verification'},
		],
		
		progress: [
			{id: 0, label: 'Exercise started'},
			{id: 1, label: 'Analysis started'},
			{id: 2, label: 'Analysis submitted'},
			{id: 3, label: 'Comparison started'},
			{id: 4, label: 'Comparison submitted'},
			{id: 5, label: 'Evaluation started'},
			{id: 6, label: 'Evaluation submitted'},
		],
	},
	
	// END-JSON-PARSABLE-DATA
	
	getConstantById: function(id, array)
	{
		for (var i in array)
		{
			var item = array[i];
			if (item.id == id)
				return item;
		}
		throw 'Could not find the id '+id+' in the list of constants';
	}

};

Pianos4Constants.getItemById = function(array, id)
{
	for (var i in array)
	{
		var item = array[i];
		if (item.id == id)
			return item;
	}
	throw 'Could not find the id '+id+' in the list of constants';
}
