#ifndef MINING_WIDGET_H
#define MINING_WIDGET_H

#include <QtGui>
#include "ui_miningWidget.h"
#include "softProj\clientServer\structs.h"
#include "softProj\helpers.h"
#include "softProj\Main\INotifyUpdate.h"
#include "softProj\Main\unmountDialog.h"

///Manages all supported mining machines.
class MiningWidget : public NotifyWidget {
	Q_OBJECT

private:
	Ui::MiningWidget ui_;
	quarry_status state_;
	id_t fortressId_;
signals:
	void changeQuarkGluonPlasmaQuarryStateSignal(id_t fortressId, bool isQuarrying);
	void changeHeavyWaterQuarryStateSignal(id_t fortressId, bool isQuarrying);
	void changeZirconiumCrystalQuarryStateSignal(id_t fortressId, bool isQuarrying);
	void changeIlmeniteQuarryStateSignal(id_t fortressId, bool isQuarrying);

	/** Signals that user wants to unmount items
	@param patternName Name of pattern for device to unmount
	@param maxWorking Maximum number of working items to unmount
	@param maxDamaged Maximum number of damaged items to unmount
	*/
	void unmountSignal(const std::string & patternName, unsigned long long maxWorking, unsigned long long maxDamaged);

	/** Signals that widget wants to show dialog */
	void showDialogSignal();

	/** Signals that widget wants to hide dialog */
	void hideDialogSignal();
private slots:
	void changeQuarkGluonPlasmaQuarryStateSlot(bool isQuarrying);
	
	void changeHeavyWaterQuarryStateSlot(bool isQuarrying);

	void changeZirconiumCrystalQuarryStateSlot(bool isQuarrying);

	void changeIlmeniteQuarryStateSlot(bool isQuarrying);

	/** Slot informing that user clicked button for unmounting magnetical collectors of plasma */
	void magneticalCollectorsOfPlasmaUnmountButtonClickedSlot(bool checked);

	/** Slot informing that user clicked button for unmounting submarine mining machine */
	void submarineMiningMachineUnmountButtonClickedSlot(bool checked);

	/** Slot informing that user clicked button for unmounting submersible filtration tank */
	void sumbersibleFiltrationTankUnmountButtonClickedSlot(bool checked);

	/** Slot informing that user clicked button for unmounting underground drilling machine */
	void undergroundDrillingMachineUnmountButtonClickedSlot(bool checked);
public:
	MiningWidget(QWidget * parent);
	~MiningWidget();

	void setState(id_t fortressId, quarry_status & state); /**< Sets mining machines state. */

	void notifyUpdate();
};

#endif