package com.bayer.edam.migration;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bayer.edam.migration.adam.WriteRecord.Classification;
import com.bayer.edam.migration.adam.WriteRecord.Field;
import com.bayer.edam.migration.adam.WriteRecord.LocalizedValue;

public class Definitions {
	
	public static final Map<String, Classification> classifications;
	public static final Map<String, String> fieldIDs;
	public static final Map<Long, String> mediaTypes;
	
	public static final String defaultLanguage = "c2bd4f9bbb954bcb80c31e924c9c26dc"; //"00000000000000000000000000000000";
	public static final String defaultProjectLead = "21cfce6116484269a351a71300e1fed0";
	public static final String defaultLicenseHolder = "4b82f989fae54a309e17a7470073c36b"; // Bayer Animal Health GmbH
	public static final String defaultAdditionalPermittedUse = "e22aa8a5-c0d9-4e3b-8469-a731010bc1fd"; // N/A
	
	static {
		classifications = new HashMap<String, Classification>();
		
		classifications.put("MediaAssistant-Migration", new Classification("2bd24882-b7d8-4d30-8e6f-a7ef00eb33e7", 1));
		
		classifications.put("Country.Global", new Classification("dff7666b-326b-4e1c-912c-a7b4006c8500", 1)); // /Definitions/Animal Health/Country
		classifications.put("Agencies.Bayer AH", new Classification("8de5ef0e-3c6d-451c-b82b-a7b4006c954c", 1)); // /Definitions/Agencies/Bayer
		classifications.put("Usage.Unrestricted", new Classification("6b95a635-40e9-4782-ad5f-a73100a2bb94", 1));
		classifications.put("Usage.Restricted", new Classification("59cf873fe1be4dd9ae8ba73100a2bd89", 1));
		
		// /Bayer/Animal Health/BusinessUnit
		classifications.put("BusinessUnit.CAP", new Classification("306e050a-dd58-46ad-93a7-a73100a2547f", 1));
		classifications.put("BusinessUnit.FAP", new Classification("9e1dd62a-dd57-4b57-86d4-a73100a25523", 1));
		classifications.put("BusinessUnit.General", new Classification("2e5bc260-ec2b-40c7-bcaa-a73100a255b9", 1));
		
		// /Definitions/Common/Status --> Released oder Archived
		classifications.put("Status.Draft", new Classification("dfee7cb7fffc41cb9ee9a68a00d4f0c3", 1));
		classifications.put("Status.Released", new Classification("279fce5751584837bd3aa68a00d4f204", 1));
		classifications.put("Status.Archived", new Classification("4306204af75442fda297a7b4006b4a87", 1));
		
		// /Bayer/Animal Health/Brands
		classifications.put("Brand.Advantage", new Classification("b3f04996de1644df9d08a6dd00cff70e", 1));
		classifications.put("Brand.Advantix", new Classification("dc758de7d91e44d6a768a6dd00cff7ad", 1));
		classifications.put("Brand.Advocate", new Classification("c7979fc30bb843e486bba6dd00cff835", 1));
		classifications.put("Brand.Baytril", new Classification("9c8a43adf3324ca6adb0a7d000f427f5", 1));
		classifications.put("Brand.Bolfo/Bay-o-Pet", new Classification("922a46fc3f6a44bfb025a7d000f428ac", 1));
		classifications.put("Brand.CVBD", new Classification("fc84b38665a44291a24ba70f00f7aa1f", 1));
		classifications.put("Brand.Drontal", new Classification("ca18ffb9735e4f1691cfa6dd00cffb07", 1));
		classifications.put("Brand.Procox", new Classification("a64abb14f3fc461ab973a6dd00cffb8f", 1));
		classifications.put("Brand.Profender", new Classification("6be697c82ec34354b0c3a6dd00cffc04", 1));
		classifications.put("Brand.Seresto", new Classification("2aea5f8d28294cde8346a6dd00cffc75", 1));
		classifications.put("Brand.Veraflox", new Classification("c2bd6003fa6b4093a50fa6dd00cffd3e", 1));
		
		classifications.put("Brand.miscellaneous", new Classification("bc9d93616c0548f99f7fa6dd00cff69d", 1));
		classifications.put("Brand.Miscellaneous", new Classification("bc9d93616c0548f99f7fa6dd00cff69d", 1));
		
		classifications.put("Brand.Baycox", new Classification("ef3028f6ba8744508035a6dd00cffe45", 1));
		classifications.put("Brand.Bayticol", new Classification("bd1819c976e643bf916ba6dd00cffec4", 1));
		classifications.put("Brand.Baytril", new Classification("1053978a142742ad8033a6dd00cfff42", 1));
		classifications.put("Brand.Bayvarol", new Classification("4f4816c552e04630b575a6dd00cfffcf", 1));
		classifications.put("Brand.Biosecurity", new Classification("ea123567d7174daf8a7ca6dd00d0008a", 1));
		classifications.put("Brand.Catosal", new Classification("55fba5b1c9084c74905ba6dd00d0011c", 1));
		classifications.put("Brand.Ceffect", new Classification("ac7c47b7959b46948697a6dd00d001bb", 1));
		classifications.put("Brand.Dairy Products", new Classification("a54fcbb0dd4741059f95a6dd00d00289", 1));
		classifications.put("Brand.Honey bee care", new Classification("996f2d1656f44368a87ba6dd00d00353", 1));
		classifications.put("Brand.Victrio", new Classification("9d260d0e9e864ab3b3a4a6dd00d005f1", 1));
		classifications.put("Brand.Zelnate", new Classification("b3887552c9554d6991e4a6dd00d006ee", 1));
		classifications.put("Brand.Droncit", new Classification("86251780660d4faf95cda7cb010c40fe", 1));
		
		classifications.put("MediaType.Other", new Classification("7c13e620-7eb0-4c12-9dfb-a7b4008f19b1", 1));
		classifications.put("MediaType.Banner", new Classification("eb786339a5de44679ff6a7b4008f1ee0", 1));
		classifications.put("MediaType.Book", new Classification("25a59832a6f84cb0a477a73100a2a091", 1));
		classifications.put("MediaType.Booth", new Classification("420fe838a6a14aa39850a73100a2851e", 1));
		classifications.put("MediaType.Brochure", new Classification("8c028aaba8404c8cbcf9a73100a29882", 1));
		classifications.put("MediaType.Calendar", new Classification("f6a8045fa2b4455c96b1a73100a298ee", 1));
		classifications.put("MediaType.DirectMail", new Classification("335b4227f05344e0aee2a73100a29d74", 1));
		classifications.put("MediaType.Flyer", new Classification("eb086cb861134039a8f4a73100a29aa2", 1));
		classifications.put("MediaType.Folder", new Classification("3a51645220dc4ba8b109a73100a29eeb", 1));
		classifications.put("MediaType.Illustration", new Classification("5222fed4a54f4098927da6dd00d0151f", 1));
		classifications.put("MediaType.TableGraphInfographic", new Classification("bae7d168eb5341c09c15a73100a2ad46", 1));
		classifications.put("MediaType.Logo", new Classification("aef9f8deb91c4e169042a73100a2a859", 1));
		classifications.put("MediaType.Newsletter", new Classification("3322cf96cb4e408bb2dea73100a29df7", 1));
		classifications.put("MediaType.PointOfSales", new Classification("495c6e740eed4f459d01a73100a29d08", 1));
		classifications.put("MediaType.Poster", new Classification("97af7f7bde344a42b3bca73100a2a127", 1));
		classifications.put("MediaType.Advertisement", new Classification("f7c126120c8345d5b667a73100a2a1b8", 1));
		classifications.put("MediaType.Toolkit", new Classification("463c194bd93b4a6caa63a73100a2a2e4", 1));
		classifications.put("MediaType.unassigned", new Classification("6995d663c07f406c8b45a6dd00cff466", 1));
		classifications.put("MediaType.Video", new Classification("4f9d38b889eb46f58d79a73100a2b55a", 1));
		classifications.put("MediaType.Image", new Classification("58f655cbd4214a72bb2aa73100a2a3dd", 1));
		classifications.put("MediaType.Packshot", new Classification("ba5a96a7d94245e48f14a73100a2a97c", 1));
		
		mediaTypes = new HashMap<Long, String>();
		mediaTypes.put(1L, "MediaType.unassigned");
		mediaTypes.put(2L, "MediaType.Image");
		mediaTypes.put(3L, "MediaType.TableGraphInfographic");
		mediaTypes.put(4L, "MediaType.Logo");
		mediaTypes.put(5L, "MediaType.Illustration");
		mediaTypes.put(6L, "MediaType.Advertisement");
		mediaTypes.put(7L, "MediaType.Brochure");
		mediaTypes.put(8L, "MediaType.Book");
		mediaTypes.put(9L, "MediaType.DirectMail");
		mediaTypes.put(10L, "MediaType.Flyer");
		mediaTypes.put(11L, "MediaType.Newsletter");
		mediaTypes.put(12L, "MediaType.Poster");
		mediaTypes.put(13L, "MediaType.Booth");
		mediaTypes.put(14L, "MediaType.Packshot");
		mediaTypes.put(15L, "MediaType.unassigned");
		mediaTypes.put(16L, "MediaType.Banner");
		mediaTypes.put(17L, "MediaType.Other");
		mediaTypes.put(18L, "MediaType.unassigned");
		mediaTypes.put(19L, "MediaType.Video");
		mediaTypes.put(20L, "MediaType.unassigned");
		mediaTypes.put(21L, "MediaType.Folder");
		mediaTypes.put(22L, "MediaType.unassigned");
		mediaTypes.put(23L, "MediaType.Booth");
		mediaTypes.put(24L, "MediaType.unassigned");
		mediaTypes.put(26L, "MediaType.PointOfSales");
		mediaTypes.put(27L, "MediaType.Calendar");
		mediaTypes.put(28L, "MediaType.unassigned");
		mediaTypes.put(29L, "MediaType.Toolkit");
		mediaTypes.put(30L, "MediaType.unassigned");
		mediaTypes.put(31L, "MediaType.Other");
		mediaTypes.put(32L, "MediaType.Booth");
		mediaTypes.put(34L, "MediaType.Folder");
		
		// Fields
		fieldIDs = new HashMap<String, String>();
		fieldIDs.put("byr_Title", "31f337fa-add6-4e25-a672-a68a00d4ff3b");
		fieldIDs.put("byr_ah_approvalNumber", "69d65b63-613b-49d6-bc11-a731010bbec8");
		fieldIDs.put("byr_ah_description", "f9e40f87-493e-4f17-b129-a6dd00d063b2"); // Additional Information
		fieldIDs.put("byr_ah_projectLead", "5400d446-9d95-4158-ac06-a6dd00d06a12");
		fieldIDs.put("byr_ah_brandCommunicationRepresentative", "5b34f2db-efff-48fd-bc7f-a731010bbda1");
		fieldIDs.put("byr_creationDate", "403fea1c-c154-4e3b-a941-a68a00d4fcc3");
		fieldIDs.put("byr_ah_keywords_tl", "6d582cfaa5b94101ab1fa6fd007e2fcd");
		fieldIDs.put("byr_ah_licenseHolderList", "de3f83cb50e747228bfea731010bc27c");
		fieldIDs.put("byr_ah_licenseAdditionalPermittedUse", "5c9d43a0-bf70-4fb5-8ad4-a731010bc1ef");
		fieldIDs.put("byr_ah_licenseComments", "dd4b899f-10b7-45db-a530-a6dd00d0630a");
	}
	
	public static Field createSingleValueField(String name, String value) {
		String id = fieldIDs.get(name);
		
		if (id == null)
			throw new NullPointerException("Could not find ID for field " + name);
		
		Field newField = new Field(id);
		newField.localizedValues.add(new LocalizedValue(value));
		return newField;
	}
	
	public static Field createMultiValueField(String name, List<String> values) {
		String id = fieldIDs.get(name);
		
		if (id == null)
			throw new NullPointerException("Could not find ID for field " + name);
		
		Field newField = new Field(id);
		newField.localizedValues.add(new LocalizedValue(values));
		return newField;
	}

}
