/**
 * Map Item Requests are requests for polygons, markers, and lines  (potentially overlays.)
 * this file contians the functions for saving creating and deleting those items. 
 * other things like marker dicussions, etc are contained within their own file ie: GeoliveDiscussionRequests
 * 
 * since all the following request follow the same pattern. task name, and identification (map layer item) and 
 * for save requests, the items atributes, they all extend MapItemJsonRequest.
 * 
 * and only really need to specify the task name, and whether to include its attributes. 
 * (AjaxQuery.IdentifyXXX methods are defined in GeoliveRequestIdentificationFactory.js)
 * 
 */


var MapItemJsonRequest=JsonQuery.extend({
	identifyAttributes:false,
	identify:function(mapItem,json)
	{
	AjaxQuery.IdentifyMap(mapItem,json);
	AjaxQuery.IdentifyLayer(mapItem,json);
	AjaxQuery.IdentifyItem(mapItem,json);
	if(this.identifyAttributes)AjaxQuery.ItemAttributes(mapItem,json);
	}
});

var HighlightedIconRequest=JsonQuery.extend({
	task:"highlight_icon",
	identify:function(mapItem,json)
	{
	json.icon=mapItem.getIcon();
	}

});

var MarkerDescriptionRequest=MapItemJsonRequest.extend({
	task:"marker_description"
});

var MarkerSaveRequest=MapItemJsonRequest.extend({
	identifyAttributes:true,
	task:"marker_save"
});

var ItemUsersRequest=MapItemJsonRequest.extend({
	task:"item_users"
});

var PolygonSaveRequest=MapItemJsonRequest.extend({
	identifyAttributes:true,
	task:"polygon_save"
});

var LineSaveRequest=MapItemJsonRequest.extend({
	identifyAttributes:true,
	task:"line_save"
});

var MarkerNewRequest=MapItemJsonRequest.extend({
	identifyAttributes:true,
	task:"marker_new"
});

var PolygonNewRequest=MapItemJsonRequest.extend({
	identifyAttributes:true,
	task:"polygon_new"
});

var LineNewRequest=MapItemJsonRequest.extend({
	identifyAttributes:true,
	task:"line_new"
});

var MarkerDeleteRequest=MapItemJsonRequest.extend({
	task:"marker_delete"
});

var PolygonDeleteRequest=MapItemJsonRequest.extend({
	task:"polygon_delete"
});

var LineDeleteRequest=MapItemJsonRequest.extend({
	task:"line_delete"
});

var MarkerCanEditRequest=MapItemJsonRequest.extend({
	task:"marker_permission"
});

var LineCanEditRequest=MapItemJsonRequest.extend({
	task:"line_permission"
});
var PolygonCanEditRequest=MapItemJsonRequest.extend({
	task:"polygon_permission"
});

var MapItemOwnerDetailsRequest=MapItemJsonRequest.extend({
	task:"item_owner_details"
});


var MapItemLike=MapItemJsonRequest.extend({
	task:"item_like"
});
var MapItemDislike=MapItemJsonRequest.extend({
	task:"item_dislike"
});
var MapItemRate=MapItemJsonRequest.extend({
	task:"item_dislike",
	initialize:function(mapItem, rating, serverClient)
	{
	var me=this;
	me.json.rating=rating;
	me.parent(mapItem,serverClient);
	}
});



