#pragma once

#include <string>
#include "../interface.h"

class CItemClipboard;
extern CItemClipboard*			g_pItemClipboard;

using namespace std;

struct ClipboardBagItem {
	int	itemID;
	int	pos;
};

struct ClipboardBankItem{
	int	itemID;
	int	pos;
};	

struct ClipboardEquipmentItem{
	int	itemID;
	int	pos;
};

struct ClipboardActionItem{
	int	type;
	int	id;
	int	level;
};

struct ClipboardTradeItem{
	int	type;
	int pos;
	int id;
};

struct ClipboardSkillItem{
	int id;
	int level;
};

struct ClipboardShopItem {
	int type;
	int pos;
};

struct ClipboardMacroItem {
	int id;
};

class CItemClipboard : public CInterfaceBase
{
public:
	CItemClipboard(CInterface* object);
	virtual ~CItemClipboard();

	enum ItemType {
		eItem_Type_None			= 0,
		eItem_Type_Bag,
		eItem_Type_Bank,
		eItem_Type_Equipment,
		eItem_Type_Trade,
		eItem_Type_Action,
		eItem_Type_Skill,
		eItem_Type_Shop,
		eItem_Type_Macro,
	};

	virtual	void					RegisterFunc		();
	virtual	void					Update				(float elapsedTime);
	virtual	void					Clear				();
	virtual	bool					IsEmpty				()						{ return m_type == eItem_Type_None; }
	virtual	void					SetName				(const char* name);
	virtual	void					SetFile				(const char* file);
	virtual	void					PickupBag			(CInterfaceBase* frame, int itemID, int pos);
	virtual	void					PickupBank			(CInterfaceBase* frame, int itemID, int pos);
	virtual	void					PickupEquipment		(CInterfaceBase* frame, int itemID, int pos);
	virtual	void					PickupAction		(CInterfaceBase* frame, int actionType, int id, int level);
	virtual	void					PickupTrade			(CInterfaceBase* frame, int tradeType, int pos, int id);
	virtual void					PickupSkill			(CInterfaceBase* frame, int id, int level);
	virtual	void					PickupShop			(CInterfaceBase* frame, int shopType, int pos);
	virtual	void					PickupMacro			(CInterfaceBase* frame, int id);

	virtual	ItemType				GetType				()						{ return m_type; }
	virtual	const char*				GetName				()						{ return m_name.c_str(); }
	virtual	const char*				GetFile				()						{ return m_file.c_str(); }
	virtual	ClipboardBagItem		GetBagItem			()						{ return m_bag; }
	virtual	ClipboardBankItem		GetBankItem			()						{ return m_bank; }
	virtual	ClipboardEquipmentItem	GetEquipmentItem	()						{ return m_equipment; }
	virtual	ClipboardActionItem		GetActionItem		()						{ return m_action; }
	virtual	ClipboardTradeItem		GetTradeItem		()						{ return m_trade; }
	virtual ClipboardSkillItem		GetSkillItem		()						{ return m_skill; }
	virtual	ClipboardShopItem		GetShopItem			()						{ return m_shop; }
	virtual	ClipboardMacroItem		GetMacroItem		()						{ return m_macro; }

protected:
	ItemType					m_type;							// 來源物件類型	
	string						m_file;							// Icon 圖形資料
	string						m_name;							// 名稱
	CInterfaceBase*				m_frame;						// 來源元件

	union {
		ClipboardBagItem		m_bag;
		ClipboardBankItem		m_bank;
		ClipboardEquipmentItem	m_equipment;
		ClipboardActionItem		m_action;
		ClipboardTradeItem		m_trade;
		ClipboardSkillItem		m_skill;
		ClipboardShopItem		m_shop;
		ClipboardMacroItem		m_macro;
	};
};