//=-- DailySummaryPlugin.h - Provides a summary of the days hits -------------=
//
//  PLUGIN DESCRIPTION:
//    The DailySummaryPlugin keeps track of the number of errors, the number
//    of hits to a web site, the percentage of hits on the server to this site
//    and a number of other generally userful stats.
//
//  PLUGIN AUTHOR:
//    Chris Lattner, Author of Magicstats  (sabre@magic.hurrah.com)
//
//  PLUGIN HOMEPAGE:
//     http://magic.hurrah.com/~sabre/MagicStats/
//
//  PLUGIN VERSION / COMPATIBILITY:
//     DailySummaryPlugin v1.0 / MagicStats 2.0+
//
//=---------------------------------------------------------------------------=
//  This file is copyright (c) 1997-1998 Chris Lattner
//=---------------------------------------------------------------------------=

#ifndef DAILYSUMMARYPLUGIN_H
#define DAILYSUMMARYPLUGIN_H

#include "PagePlugin.h"
#include "Options.h"
#include "AccessFormatPlugin.h"
#include "VarTable.h"

class DailySummaryPlugin : public PluginTemplate<PagePlugin,DailySummaryPlugin> {
public:
  inline static unsigned int GetCurrentVersion() {
    return 100;                       // Version 1.00
  }

  inline static const char *GetPluginName() {
    return "DailySummary";
  }

  DailySummaryPlugin(int &CE);
  void LoadSettings(Table<CSString,VTExp*> *List);
  void ProcessAccess(AccessFormatPlugin &);
  void OutputHTML(ostream &, Table<CSString,VTExp*> &);
  void ResetState();
  void SaveState(Serialize &);
  void LoadState(Serialize &);

  void GetFullName(VarTable &Params, String &FullName, int UpdateFreq);

private :

  // State.
  int FirstAccess;
  int NumHits, NumErrors, NumSectionHits, NumServerHits;
  int BytesTransfered;
  Date FirstDate, LastDate;
  FilterHandle SectionFilter;

  // Private Functions
  ostream &PrintFileSize(ostream &O, int Bytes);
};

#endif
