#ifndef OverbyteIcsSysLogServerDemo1H
#define OverbyteIcsSysLogServerDemo1H

#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>

#include "OverbyteIcsSysLogServer.hpp"
#include "OverbyteIcsIniFiles.hpp"
#include "OverbyteIcsTypes.hpp"

#include <memory>

class TSysLogServerForm : public TForm
{
__published:
    TPanel *ToolsPanel;
    TMemo *DisplayMemo;
    TButton *StartButton;
    TButton *StopButton;
    void __fastcall FormShow(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall StartButtonClick(TObject *Sender);
    void __fastcall StopButtonClick(TObject *Sender);

private:
    String FIniFileName;
    bool FInitialized = false;
    std::unique_ptr<TSysLogServer> FSysLogServer;

    void SetButtons(bool Listening);
    void __fastcall SysLogServer1DataAvailable(TObject *Sender, const AnsiString SrcIP,
                                               const AnsiString SrcPort, const AnsiString RawMessage);

public:
    __fastcall TSysLogServerForm(TComponent *Owner);
    void Display(const String &Msg);
    __property String IniFileName = {read = FIniFileName, write = FIniFileName};
};

extern PACKAGE TSysLogServerForm *SysLogServerForm;

#endif
