#ifndef WAREHOUSE_DEVICE_WIDGET_H
#define WAREHOUSE_DEVICE_WIDGET_H

#include <QtGui>
#include "ui_warehouseDeviceWidget.h"
#include "softProj\clientServer\structs.h"
#include "softProj\settings.h"
#include "softProj\helpers.h"

///Manages and displays Warehouse issues.
class WarehouseDeviceWidget : public QWidget {
	Q_OBJECT

private:
	Ui::WarehouseDeviceWidget ui_;

	QString capacityUnit_;
	QString allCapacityUnit_;
public:
	WarehouseDeviceWidget(QWidget * parent) : QWidget(parent) {
		ui_.setupUi(this);	
	}

	void setName(const std::wstring & name) {
		ui_.nameButton->setText(QString::fromUtf16(name.c_str()));
	} /**< Set title name of the warehouse. */

	void setIcon(const std::string & path) {
		setButtonIconFromResources(ui_.nameButton, path, 20);
	} /**< Set icon picture of the warehouse. */

	void setCapacity(unsigned long long value) {
		ui_.capacityValue->setText(Settings::instance().formatNumber(value) + capacityUnit_);
	} /**< Set capacity of the warehouse. */

	void setAllCapacity(unsigned long long value) {
		ui_.allCapacityValue->setText(Settings::instance().formatNumber(value) + allCapacityUnit_);
	} //TODO, FIXME, COMMENTME

	void setCapacityUnit(const std::string & unit) {
		this->capacityUnit_ = " " + QString::fromUtf8(unit.c_str());
	} /**< Sets capacity units of the warehouse. */

	void setAllCapacityUnit(const std::string & unit) {
		this->allCapacityUnit_ = " " + QString::fromUtf8(unit.c_str());
	}	//TODO, FIXME, COMMENTME

	void setDamageStatus(unsigned long long working, unsigned long long damaged) {
		ui_.damageSlider->setWorkingAndDamaged(working, damaged);
	} /**< Sets damage status of the warehouse. */

	void setCapacityLabel(const std::wstring & text) {
		ui_.capacityLabel->setText(QString::fromUtf16(text.c_str()));
	}
};

#endif