#pragma once

#include "PJNSmtp.h"

class CPJNSMTPAppDlg : public CDialog
{
public:
//Constructors / Destructors
  CPJNSMTPAppDlg(CWnd* pParent = nullptr);

//Member variables
  enum { IDD = IDD_MAIN_DIALOG };
  CEdit m_wndBody;
  CString m_sBCC;
  CString m_sBody;
  CString m_sCC;
  CString m_sFile;
  CString m_sSubject;
  CString m_sTo;
  BOOL m_bDNSLookup;
  CString m_sAddress;
  CString m_sHost;
  CString m_sName;
  int m_nPort;
  CPJNSMTPConnection::AuthenticationMethod m_Auth;
  CString m_sUsername;
  CString m_sPassword;
  BOOL m_bAutoDial;
  CString m_sBoundIP;
  CString m_sEncodingFriendly;
  CString m_sEncodingCharset;
  CPJNSMTPAddress::ENCODING m_AddressHeaderEncoding;
  BOOL m_bMime;
  BOOL m_bHTML;
  CPJNSMTPMessage::PRIORITY m_Priority;
  CPJNSMTPConnection::ConnectionType m_ConnectionType;
  CPJNSMTPConnection::SSLProtocol m_SSLProtocol;
  CPJNSMTPConnection m_Connection;
  BOOL m_bDSN;
  BOOL m_bDSNSuccess;
  BOOL m_bDSNFailure;
  BOOL m_bDSNDelay;
  BOOL m_bDSNHeaders;
  BOOL m_bMDN;
  BOOL m_bInitialClientResponse;
  BOOL m_bDoEHLO;
  BOOL m_bUsePunyCode;

protected:
//Member variables
  HICON m_hIcon;

//Methods
  void DoDataExchange(CDataExchange* pDX) override;
  static UINT _SendingWorkerThread(LPVOID lpParam);
  std::unique_ptr<CPJNSMTPMessage> CreateMessage();
  void SendFromDisk(bool bUI);
  void SendFromMemory(bool bUI);
  BOOL OnInitDialog() override;

//Message handlers
  afx_msg void OnPaint();
  afx_msg HCURSOR OnQueryDragIcon() noexcept;
  afx_msg void OnConfiguration();
  afx_msg void OnSend();
  afx_msg void OnBrowseFile();
  afx_msg void OnDestroy();
  afx_msg void OnSendFromDisk();
  afx_msg void OnSendFromDiskWithUI();
  afx_msg void OnSendFromMemory();
  afx_msg void OnSendFromMemoryWithUI();
  afx_msg void OnSaveToDisk();

  DECLARE_MESSAGE_MAP()
};
