package de.dass_it.vanhelsing.gui;

import java.util.*;

import de.dass_it.vanhelsing.gui.ValidationItem.*;



public class Validation {
	private HashMap<String, ValidationItem> properties;
	
	public Validation(){
		buildValidation();
	}
	
	public String getRenderer(String s){
 		return properties.get(s).getRenderer();
	}
	
	public String getDataType(String s){
		return properties.get(s).getDataType();
	}
	
	public boolean getNecessary(String s){
		return properties.get(s).getNecessary();
	}
	
	public void buildValidation(){
		String type2 = "de.dass_it.vanhelsing.gui.items.ClientItem";
		//Name, Typ, ?Referenz, ?Muss/Default, ?Defaultwert
			
		   /*name, store_name, 0, ITEM_REQUIRED, 0},
		   adress, store_str, 0, ITEM_REQUIRED, 0},
		   fdport, store_pint32, 0, ITEM_DEFAULT, 9102},
		   password, store_password, 0, ITEM_REQUIRED, 0},
		   catalog, store_res, R_CATALOG, ITEM_REQUIRED, 0}, */
		   ValidationItem vi = new ValidationItem();
		   properties = new HashMap<String, ValidationItem>();
		   //name
		   vi.setDataType("string");
		   vi.setNecessary(true);
		   vi.setRenderer("inputText");
		   properties.put(type2+":"+"name", vi);
		   //adress
		   vi = new ValidationItem();
		   vi.setDataType("string");
		   vi.setNecessary(true);
		   vi.setRenderer("inputText");
		   properties.put(type2+":"+"adress", vi);
		   //fdport
		   vi = new ValidationItem();
		   vi.setDataType("int");
		   vi.setNecessary(true);
		   vi.setRenderer("inputText");
		   vi.setDefaultValue("9102");
		   properties.put(type2+":"+"fdport", vi);
		   //password
		   vi = new ValidationItem();
		   vi.setDataType("string");
		   vi.setNecessary(true);
		   vi.setRenderer("inputText");
		   properties.put(type2+":"+"password", vi);
		   //catalog
		   vi = new ValidationItem();
		   vi.setDataType("string");
		   vi.setNecessary(true);
		   vi.setRenderer("selectOneMenu");
		   properties.put(type2+":"+"catalog", vi);
	}
}
