///////////////////////////////////////////////////////////
// File:			pg_lu_table.h
//
// Author:			Stefan Liersch
// Contact:			stefan.liersch@googlemail.com,
//					stefan.liersch@ufz.de
//
// Date:			2007-08-10
// last modified:	2007-08-15
//
//---------------------------------------------------------
// DESCRIPTION
//---------------------------------------------------------
// 
// 
//
//---------------------------------------------------------
// ToDo
//---------------------------------------------------------
// 
//
///////////////////////////////////////////////////////////

//---------------------------------------------------------------------

#ifndef HEADER_INCLUDED__PG_LU_TABLE_H
#define HEADER_INCLUDED__PG_LU_TABLE_H

//---------------------------------------------------------------------

#include "wx/arrstr.h"

//---------------------------------------------------------------------

class CLU_Table4Col
{
public:
	CLU_Table4Col(void);
	CLU_Table4Col(const char *LUT_Name, int *ID, int nIDs);
	~CLU_Table4Col(void);

	bool			LoadSelected(const char *LUT_Name, int*ID, int nIDs);
	
	wxString		Get_LUT_Name()			{ return(m_LUTName); }
	// column (field) names
	wxString		Get_PK_ColName()		{ return(m_pk_col_name); }
	wxString		Get_Station_ColName()	{ return(m_Station_col_name); }
	wxString		Get_Date_ColName()		{ return(m_date_col_name); }
	wxString		Get_Value_ColName()		{ return(m_val_col_name); }

	int				Get_nrows()				{ return(m_nrows); }
	// returns the station ID linking the SimpleFeature feature to the LookUp Table
	int				Get_TSStationID(int i);
	// returns the name of the time series table
	wxString		Get_TSStationName(unsigned int i);
	// returns the name of the date column in corresponding time series table
	wxString		Get_TSDateName(unsigned int i);
	// returns the name of the value column in corresponding time series table
	wxString		Get_TSValueName(unsigned int i);	


private:

	wxString		m_LUTName;
	const int		m_nCols;
	// column (field) names
	wxString		m_pk_col_name;			// Station ID
	wxString		m_Station_col_name;		// Station Name
	wxString		m_date_col_name;		// date column name
	wxString		m_val_col_name;			// value column name

	// table values
	int				m_nrows;
	int				*m_TSStationID;
	wxArrayString	m_TSStationName;
	wxArrayString	m_TSDateName;
	wxArrayString	m_TSValueName;
	
	//int				m_pk_col_number;
	//int				m_val_col_number;
	//double			m_NoData;

	// private functions
	bool			_Init_ColNames(const char *LUT_Name);
	wxString		_CreateSQLSelect(const char *LUT_Name, int *ID, int nIDs);
	bool			_GetTableData(wxString SQL);

};

#endif /* #ifndef HEADER_INCLUDED__PG_LU_TABLE_H */