Mys.Model.Reply = function()
{
	Mys.Model.Reply.superclass.constructor.call(this);
};

Ext.extend(Mys.Model.Reply, Mys.Model,
{
	add : function(itemID, refReplyID, text, limit, callback, scope)
	{
		var query = "model=reply&mode=add&view=json&text=" + text.encode() + "&limit=" + limit;
		
		if(refReplyID)
			query += "&ref_reply_id=" + refReplyID;
		else
			query += "&item_id=" + itemID;
		
		this.ajax.request(query, callback, scope);
	},
	
	getList : function(itemID, start, limit, callback, scope)
	{
		var query = "model=reply&mode=get_list&view=json&item_id=" + itemID + "&start=" + start + "&limit=" + limit;
		
		this.ajax.request(query, callback, scope);
	},
	
	getRecent : function(start, limit, boardType, callback, scope)
	{
		var query = "model=reply&mode=get_recent&start=" + start + "&limit=" + limit;
		
		if(boardType)
		{
			if(boardType instanceof Array)
				query += "&board_type[]=" + boardType.join("&board_type[]=");
			else
				query += "&board_type=" + boardType;
		}
		
		this.ajax.request(query, callback, scope);
	},
	
	del : function(replyID, callback, scope)
	{
		var query = "model=reply&mode=del&view=json&reply_id=" + replyID;
		
		this.ajax.request(query, callback, scope);
	}
});

Global.modelReply = new Mys.Model.Reply;