#ifndef _DB_MYSQL_SQL_EXPORT_WRAPPER_H_
#define _DB_MYSQL_SQL_EXPORT_WRAPPER_H_

#include "db_mysql_sql_export.h"
#include "GrtTemplates.h"
#include "SigCSlot.h"
#include "db_mysql_validation_page_wrapper.h"

namespace MySQL {
namespace GUI {
namespace Workbench {
namespace Plugins {
namespace DbMySQL {

using namespace System;
using namespace System::Runtime::InteropServices;
using namespace System::Collections::Generic;
using namespace MySQL::Grt;

public ref class DbMySQLSQLExport : public DbMySQLValidationPage
{
//public:
//  typedef DelegateSlot0<int, int> Validation_finished_cb;
//  typedef DelegateSlot1<int, int, int, int> Validation_step_finished_cb;

private:

  //Validation_finished_cb^ _validation_finished_cb;
  //Validation_step_finished_cb^ _validation_step_finished_cb;
  //::DbMySQLSQLExport *_inner;

public:

  DbMySQLSQLExport(MySQL::Grt::GrtManager ^grt_manager) 
    : DbMySQLValidationPage(new ::DbMySQLSQLExport(grt_manager->get_unmanaged_object()))
  {}

  ::DbMySQLSQLExport *get_unmanaged_object()
  { return static_cast<::DbMySQLSQLExport *>(_inner); }

  MySQL::Grt::GrtManager^ get_grt_manager() 
  { return gcnew MySQL::Grt::GrtManager(get_unmanaged_object()->get_grt_manager()); }
  
  MySQL::Grt::GrtValue^ get_catalog()
  { return gcnew MySQL::Grt::GrtValue(get_unmanaged_object()->get_catalog()); }

  void set_option(String^ name, bool value)
  { get_unmanaged_object()->set_option(NativeToCppString(name), value); }

  void set_option(String^ name, String^ value)
  { get_unmanaged_object()->set_option(NativeToCppString(name), NativeToCppString(value)); }

  void start_export()
  { get_unmanaged_object()->start_export(); }

  //void run_validation()
  //{ _inner->run_validation(); }

  //void validation_finished_cb(Validation_finished_cb::ManagedDelegate ^deleg)
  //{
  //  _validation_finished_cb= gcnew Validation_finished_cb(deleg);
  //  _inner->validation_finished_cb(_validation_finished_cb->get_slot());
  //}

  //void validation_step_finished_cb(Validation_step_finished_cb::ManagedDelegate ^deleg)
  //{
  //  _validation_step_finished_cb= gcnew Validation_step_finished_cb(deleg);
  //  _inner->validation_step_finished_cb(_validation_step_finished_cb->get_slot());
  //}

  //GrtMessageList^ get_messages_list()
  //{
  //  return gcnew MySQL::Grt::GrtMessageList(_inner->get_messages_list());
  //}

  void setup_grt_string_list_models_from_catalog([Out] MySQL::Grt::GrtStringListModel^ %users_model, 
                                                 [Out] MySQL::Grt::GrtStringListModel^ %users_exc_model,
                                                 [Out] MySQL::Grt::GrtStringListModel^ %tables_model, 
                                                 [Out] MySQL::Grt::GrtStringListModel^ %tables_exc_model,
                                                 [Out] MySQL::Grt::GrtStringListModel^ %views_model, 
                                                 [Out] MySQL::Grt::GrtStringListModel^ %views_exc_model,
                                                 [Out] MySQL::Grt::GrtStringListModel^ %routines_model,
                                                 [Out] MySQL::Grt::GrtStringListModel^ %routines_exc_model,
                                                 [Out] MySQL::Grt::GrtStringListModel^ %triggers_model,
                                                 [Out] MySQL::Grt::GrtStringListModel^ %triggers_exc_model)
  {
    ::bec::GrtStringListModel *inner_users_model= NULL;
    ::bec::GrtStringListModel *inner_users_exc_model= NULL;
    ::bec::GrtStringListModel *inner_tables_model= NULL;
    ::bec::GrtStringListModel *inner_tables_exc_model= NULL;
    ::bec::GrtStringListModel *inner_views_model= NULL;
    ::bec::GrtStringListModel *inner_views_exc_model= NULL;
    ::bec::GrtStringListModel *inner_routines_model= NULL;
    ::bec::GrtStringListModel *inner_routines_exc_model= NULL;
    ::bec::GrtStringListModel *inner_triggers_model= NULL;
    ::bec::GrtStringListModel *inner_triggers_exc_model= NULL;

    get_unmanaged_object()->setup_grt_string_list_models_from_catalog(
      &inner_users_model,
      &inner_users_exc_model,
      &inner_tables_model,
      &inner_tables_exc_model,
      &inner_views_model,
      &inner_views_exc_model,
      &inner_routines_model,
      &inner_routines_exc_model,
      &inner_triggers_model,
      &inner_triggers_exc_model
      );

    users_model= gcnew MySQL::Grt::GrtStringListModel(inner_users_model);
    users_exc_model= gcnew MySQL::Grt::GrtStringListModel(inner_users_exc_model);
    tables_model= gcnew MySQL::Grt::GrtStringListModel(inner_tables_model);
    tables_exc_model= gcnew MySQL::Grt::GrtStringListModel(inner_tables_exc_model);
    views_model= gcnew MySQL::Grt::GrtStringListModel(inner_views_model);
    views_exc_model= gcnew MySQL::Grt::GrtStringListModel(inner_views_exc_model);
    routines_model= gcnew MySQL::Grt::GrtStringListModel(inner_routines_model);
    routines_exc_model= gcnew MySQL::Grt::GrtStringListModel(inner_routines_exc_model);
    triggers_model= gcnew MySQL::Grt::GrtStringListModel(inner_triggers_model);
    triggers_exc_model= gcnew MySQL::Grt::GrtStringListModel(inner_triggers_exc_model);
  }
};

} // namespace MySQL
} // namespace GUI
} // namespace Workbench
} // namespace DbMySQL
} // namespace Plugins

#endif // _DB_MYSQL_SQL_EXPORT_WRAPPER_H_