package data
{
	import mx.collections.XMLListCollection;
	
	public class Server
	{
		public var layers:XMLListCollection;
		public var featureTypes:XMLListCollection;
		public var featureTypesEmptyItem:XMLListCollection;
		public var capabilities:XMLListCollection;
		
		private var featureTypeAttributes:Object;
		private var layerFeatureTypeAttributes:Object;
		
		public var layerFeatureTypes:Object;
		
		public var user:String;
		public var password:String;
		
		public function Server() {
			capabilities = new XMLListCollection();
			layers = new XMLListCollection();			
			featureTypes = new XMLListCollection();
			featureTypesEmptyItem = new XMLListCollection();
			
			featureTypeAttributes = new Object();
			layerFeatureTypeAttributes = new Object();
			layerFeatureTypes = new Object();
			
			user = "";
			password = "";
		}
		
		public function getFeatureTypeAttributes(featureTypeName:QName, forceLoad:Boolean = false):XMLListCollection {
			var retval:XMLListCollection = featureTypeAttributes[featureTypeName.toString()];
			if(retval == null) {
				featureTypeAttributes[featureTypeName.toString()] = new XMLListCollection();
				retval = featureTypeAttributes[featureTypeName.toString()];
			}
			return retval;	
		}
		
		public function getLayerFeatureTypeAttributes(layerName:String):XMLListCollection {
			var retval:XMLListCollection = layerFeatureTypeAttributes[layerName];
			if(retval == null) {
				layerFeatureTypeAttributes[layerName] = new XMLListCollection();
				retval = layerFeatureTypeAttributes[layerName];
			}
			return retval;
		}
	}
}