/**
    File        : Main.h
    Description : main entry point for Savings plugin
    Author      : Raymond Marsh
    Created     : 08/01/2009
    Copyright 2009, 2010 Raymond Marsh

    This program is distributed under the terms of the GNU General Public License.
    To view a copy of the license see the file 'copying.txt'

    This file is part of the Ace Personal Finance Assistant Suite.

    Ace Personal Finance Assistant is free software: you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free Software Foundation, either
    version 3 of the License, or (at your option) any later version.

    Ace Personal Finance Assistant is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with Ace Personal Finance Assistant.
    If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef MAIN_H_INCLUDED
#define MAIN_H_INCLUDED

#include <wx/wx.h>
#include <wx/datectrl.h>
#include <wx/valgen.h>
#include <wx/statline.h>
#include "version.h"
#include "../AcePFA/IPlugin.h"
#include "../AcePFA/Base.h"

#ifdef MY_DLL_EXPORTS
  #define DLL_IMPORT_EXPORT __declspec(dllexport)
#else
  #define DLL_IMPORT_EXPORT __declspec(dllimport)
#endif

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

DLL_IMPORT_EXPORT bool RegisterPlugin(IPlugin **ppPluginInterface);
DLL_IMPORT_EXPORT bool UnregisterPlugin(IPlugin **ppPluginInterface);

class DLL_IMPORT_EXPORT CSavings : public CAccountTypePluginBase
{
    public:
    CSavings();
    ~CSavings();

    void InitializePlugin(IPluginHost* pHost);
    void ShutdownPlugin();
    wxString GetPluginName()          { return m_PluginName; }
    PLUGIN_TYPE GetPluginType()       { return PT_ACCOUNTTYPE; }
    int GetPluginWeight()             { return m_PluginWeight; }
    wxString GetWxVersionString()     { return wxVERSION_STRING; }
    wxString GetPluginVersionString() { return AutoVersion::FULLVERSION_STRING; }
    int GetHeaderToDisplay(std::vector<std::pair<wxString, int> >& Header);
    int GetItemsToDisplay(const STransaction& Transaction, wxArrayString& List, std::vector<int>& Pos);
    int GetTransactionViewer(wxString Title,
                             STransaction& Transaction,
                             bool IsNewTransaction,
                             bool CanEditTransaction);

    private:
    // event handlers
    void OnTransactionViewerButtonOK(wxCommandEvent &event);
    void OnTransactionViewerButtonCancel(wxCommandEvent &event);
    void OnTransactionViewerCategorySelection(wxCommandEvent &event);

    // child controls
    wxDatePickerCtrl*  m_pDateCtrl;
    wxComboBox*        m_pCategoryCtrl;
    wxTextCtrl*        m_pPayeeCtrl;
    wxComboBox*        m_pSubCategoryCtrl;
    wxTextCtrl*        m_pAmountCtrl;
    wxTextCtrl*        m_pCommentCtrl;
    wxTextCtrl*        m_pCheckNumCtrl;
    wxComboBox*        m_pTransferCtrl;

    // private data
    IPluginHost*       m_pHost;
    CDataBase*         m_pData;
    wxString           m_PluginName;
    int                m_PluginWeight;
    wxDialog*          m_pTransactionViewer;
    STransaction*      m_pTransaction;
    wxString           m_Amount;
    wxString           m_CheckNumber;
    wxArrayString      m_CategoryChoices;
    wxArrayString      m_SubCategoryChoices;
};

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // MAIN_H_INCLUDED
