#ifndef OverbyteIcsNsLookup1H
#define OverbyteIcsNsLookup1H

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

#include "OverbyteIcsDnsQuery.hpp"
#include "OverbyteIcsIniFiles.hpp"
#include "OverbyteIcsTypes.hpp"
#include "OverbyteIcsWndControl.hpp"
#include "OverbyteIcsWSocket.hpp"

class TNsLookupForm : public TForm
{
__published:
    TMemo *DisplayMemo;
    TPanel *Panel1;
    TLabel *Label1;
    TLabel *Label2;
    TLabel *Label3;
    TLabel *Label4;
    TBitBtn *ClearDisplayBitBtn;
    TButton *LookupButton;
    TRadioButton *TcpRadioButton;
    TRadioButton *UdpRadioButton;
    TComboBox *DnsEdit;
    TComboBox *NameEdit;
    TComboBox *DnsQueryType;
    TButton *AllButton;
    TButton *AbortButton;
    TCheckBox *RequestSync;
    TRadioGroup *ServerStratagy;
    TMemo *ServerList;
    TDnsQuery *DnsQuery1;
    TTimer *Timer1;
    void __fastcall FormShow(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall DnsQuery1RequestDone(TObject *Sender, System::Word Error);
    void __fastcall ClearDisplayBitBtnClick(TObject *Sender);
    void __fastcall LookupButtonClick(TObject *Sender);
    void __fastcall AllButtonClick(TObject *Sender);
    void __fastcall Timer1Timer(TObject *Sender);
    void __fastcall AbortButtonClick(TObject *Sender);
    void __fastcall DnsQuery1LogEvent(TObject *Sender, const System::UnicodeString Msg);

private:
    String FIniFileName;
    bool FInitialized = false;
    int FRequestID = 0;

    void Display(const String &Msg);
    void DumpDnsResponse();
    void PrepareQuery();

public:
    __fastcall TNsLookupForm(TComponent *Owner);
    __property String IniFileName = {read = FIniFileName, write = FIniFileName};
};

extern PACKAGE TNsLookupForm *NsLookupForm;

#endif
