//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
// RCS-ID:      $Id: $
// Copyright (C) 2002 - 2009, The pgAdmin Development Team
// This software is released under the Artistic Licence
//
// pgExtTable.h Greenplum External Table
//
//////////////////////////////////////////////////////////////////////////

#ifndef PGEXTTABLE_H
#define PGEXTTABLE_H

#include "pgSchema.h"

class pgCollection;

class pgExtTableFactory : public pgSchemaObjFactory
{
public:
    pgExtTableFactory();
    virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent);
    virtual pgObject *CreateObjects(pgCollection *obj, ctlTree *browser, const wxString &restr=wxEmptyString);
};
extern pgExtTableFactory extTableFactory;


class pgExtTable : public pgSchemaObject
{
public:
    pgExtTable(pgSchema *newSchema, const wxString& newName = wxT(""));
    ~pgExtTable();

    void ShowTreeDetail(ctlTree *browser, frmMain *form=0, ctlListView *properties=0, ctlSQLBox *sqlPane=0);
    bool CanDropCascaded() { return !GetSystemObject() && pgSchemaObject::CanDrop(); }

    bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
    bool CanView() { return true; }
    bool WantDummyChild() { return false; }

    wxMenu *GetNewMenu();
    wxString GetSql(ctlTree *browser);
    wxString GetSelectSql(ctlTree *browser);
    pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);

    bool HasStats() { return false; }
    bool HasDepends() { return true; }
    bool HasReferences() { return true; }

    void ShowHint(frmMain *form, bool force);
    bool GetCanHint() { return true; };

    bool IsUpToDate();
    //wxString GetFormattedDefinition();

private:
    wxString GetCols(ctlTree *browser, size_t indent, wxString &QMs, bool withQM);
};

#endif