#ifndef OverbyteIcsSimpleSslCli1H
#define OverbyteIcsSimpleSslCli1H

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

#include "OverbyteIcsWSocket.hpp"
#include "OverbyteIcsWndControl.hpp"
#include "OverbyteIcsSslBase.hpp"
#include "OverbyteIcsTypes.hpp"

#include <memory>

class TForm1 : public TForm
{
__published:
    TSslWSocket *Sock;
    TMemo *Memo1;
    TButton *ButtonConnect;
    TButton *ButtonClose;
    TEdit *EditHost;
    TEdit *EditPort;
    TLabel *Label1;
    TLabel *Label2;
    TEdit *EditUrl;
    TLabel *Label3;
    TLabel *Label4;
    TButton *ButtonURL;
    TSslContext *SslContext1;
    void __fastcall SockSessionConnected(TObject *Sender, WORD ErrCode);
    void __fastcall SockDataAvailable(TObject *Sender, WORD ErrCode);
    void __fastcall SockSslHandshakeDone(TObject *Sender, WORD ErrCode, TX509Base *PeerCert, bool &Disconnect);
    void __fastcall ButtonConnectClick(TObject *Sender);
    void __fastcall ButtonCloseClick(TObject *Sender);
    void __fastcall SockSessionClosed(TObject *Sender, WORD ErrCode);
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall FormDestroy(TObject *Sender);
    void __fastcall ButtonURLClick(TObject *Sender);
    void __fastcall SockDebugDisplay(TObject *Sender, const String Msg);

private:
    std::unique_ptr<TMemoryStream> RecStream;

public:
    __fastcall TForm1(TComponent *Owner);
    __fastcall ~TForm1();
};

extern PACKAGE TForm1 *Form1;

#endif
