/*
 * hattrick.c: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * Author: Matthias Feistel <hitman_47@users.sourceforge.net>, (C) 2007
 *
 * Copyright: See COPYING file that comes with this distribution
 */


#ifndef SETTINGS_H
#define SETTINGS_H

#include "config.h"
#include "timer.h"
#include <map>
#include <time.h>
#include <string>
#include <list>


char *NewStrDup(const char *string);
char *NewStrNDup(const char *string, int i);


class cEventList
{
	public:
        int Minute;
        std::string EventText;
};


class cTeamData
{
	public:
		long TeamID;
		long MatchID;  // ist gleich NextMatchID
		std::string HomeTeamName;
		long HomeTeamID;
		std::string AwayTeamName;
		long AwayTeamID;
		time_t time_nextMatch;
		long NextMatchID;
		int HomeTeamGoals;
		int AwayTeamGoals;
		int TimePlayed;
	    std::map<int, cEventList> EventContainer;
};


class cSettings {
  private:
    cTimerThread *m_Timer;
    char m_Cookie[4096];  
    char m_Recommendedurl[512];    
    char m_Username[512];
    char m_Securitycode[512];
	bool m_IsFavour_ownteam;    
	bool m_IsDebugmode;    
    bool m_IsTimer;
    std::map<long, cTeamData> m_TeamContainer;
    std::list<std::string> m_FavouriteList;
  private:
    static cSettings *gpo_config;
    cSettings();
  public:
    ~cSettings();
    static cSettings& GetInstance(void);
///Timer
    cTimerThread *SetTimer(cTimerThread *timer);
    cTimerThread *GetTimer(void) { return m_Timer; };
///Cookie
    const char *SetCookie(const char *cookie);
    char *GetCookie(void) { return m_Cookie; };
///Recommendedurl
    const char *SetRecommendedurl(const char *recommendedurl);
    char *GetRecommendedurl(void) { return m_Recommendedurl; };
///Username
    const char *SetUsername(const char *username);
    char *GetUsername(void) { return m_Username; };
///Securitycode
    const char *SetSecuritycode(const char *securitycode);
    char *GetSecuritycode(void) { return m_Securitycode; };
///IsFavour_ownteam
    bool SetIsFavour_ownteam(bool on);
    bool IsFavour_ownteam(void) const { return m_IsFavour_ownteam; };
///IsTimer
    bool SetIsTimer(bool on);
    bool IsTimer(void) const { return m_IsTimer; };
///IsDebugmode
    bool SetIsDebugmode(bool on);
    bool IsDebugmode(void) const { return m_IsDebugmode; };
///TeamContainer
    void SetTeamContainer( std::map<long, cTeamData> TeamContainer );
    std::map<long, cTeamData> GetTeamContainer( );
///FavouriteList
    void SetFavouriteList(  std::list<std::string> FavouriteList );
    std::list<std::string> GetFavouriteList( );
};

#endif // SETTINGS_H


