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));
		
		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;
	}

}
