#ifndef ATTACK_WIDGET_H
#define ATTACK_WIDGET_H

#include <qwidget.h>
#include <qobject.h>
#include "ui_AttackWidget.h"
#include <QString.h>
#include <qstandarditemmodel.h>
#include <vector>

/// Auxiliary attack structure.
/**
* Auxiliary attack structure. 
* Contains informations about attackable ship. 
* This structure is used by AttackWidget to display ships we can attack.
*/
struct AttackRecord
{
	QString playerName;
	QString fortressName;
	unsigned long id;

	AttackRecord(void);
};


/// AttackWidget provides functionality to work with  AttackRecord.
/**
*	AttackWidget allows insert, remove, display and select AttackRecord items.
*/
class AttackWidget: public QWidget
{
	Q_OBJECT

private:
	unsigned int rowCount;

	void insertRecord( const AttackRecord &record );

public:
	static const int TARGET_PLAYER_COLUMN = 0;
	static const int TARGET_SHIP_COLUMN = 1;
	static const int TARGET_ID_COLUMN = 2;

	Ui_AttackWidget ui_;
	AttackWidget( QWidget *parent = NULL );

private slots:
	void recordSelectionSlot( const QModelIndex & );
	
public slots:
	void insertRecord( const std::vector< AttackRecord > &records );	/**< inserts record to table */
	void clearRecords( void );	/**< removes all records from table */
	void hideSlot( void );	/**< makes the widget invisible */
	void showSlot( void );	/**< makes the widget visible */

signals:
	void recordSelectionSignal( const AttackRecord &record  );	/**< emits selected record */
	void targetSelectionSignal( unsigned long targetShipId );	/**< emits selected targetShipId */
	void hideSignal(void);	/**< this signal is emitted when hideSlot() is called */
	void showSignal(void);	/**< this signal is emitted when showSlot() is called */
};


#endif
