#ifndef __EPGSEARCHRES_H
#define __EPGSEARCHRES_H

#include <vdr/menuitems.h>
#include <vdr/recording.h>
#include "epgsearchext.h"
#include "blacklist.h"

typedef enum
{
    showTitleEpisode,
    showEpisode
} ModeYellowSR;

typedef enum
{
    showAll,
    showNoPayTV,
    showTimerPreview
} ModeBlueSR;

// --- cMenuSearchResultsItem ------------------------------------------------------
class cMenuSearchResultsItem : public cOsdItem {
  char *fileName;
  bool previewTimer;
  bool episodeOnly;
public: 
  int timerMatch;
  const cEvent *event;
  const char *FileName(void) { return fileName; }
  cMenuSearchResultsItem(const cEvent *EventInfo, bool EpisodeOnly = false, bool PreviewTimer = false);
  cMenuSearchResultsItem(cRecording *Recording);
  bool Update(bool Force = false);
};

class cMenuSearchResults : public cOsdMenu {
private:
  cSearchExt* searchExt;
  cBlacklist* blacklist;
  bool BuildList(bool IgnoreRunnig = false);
  bool BuildSearchlist(bool IgnoreRunnig = false);
  bool BuildBlacklist(bool IgnoreRunnig = false);
  bool ScanRecordings(void);
  virtual eOSState ProcessKey(eKeys Key);
  eOSState ShowSummary(void);
  eOSState Record(void);
  void SetHelpKeys(void);
  eOSState Switch(void);
  eOSState Commands(eKeys Key);
  eOSState Play(void);
  cRecording *GetRecording(cMenuSearchResultsItem *Item);
  int GetTab(int Tab);
  bool Update(void);

  static const cEvent *scheduleEventInfo;
  static int currentChannel;
  bool m_bSearchInRecordings;
  ModeYellowSR modeYellow;
  ModeBlueSR modeBlue;
public:
  char *m_pSearchString;
  bool m_bSort;

  cMenuSearchResults(const char *p2, bool bSearchInRecordings=false);
  cMenuSearchResults(cSearchExt*);
  cMenuSearchResults(cBlacklist*);
  ~cMenuSearchResults();
  };

#endif
