#pragma once
#include "pv/PvApp.h"
#include "pv/PvTable.h"
#include "pv/PvPopWidget.h"


///////////////////////////////////////////////////////////////////////////////////////////////////
// === PageUser ===
class PageUser : public PageTable
{
public:
    PageUser(PARAM* p, EPvCode pvcode);

    virtual void onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result) override;
    virtual void onOperate(int row, int col, std::string oper)  override;
    virtual std::string onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)  override;
    virtual std::string onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)  override;
};

///////////////////////////////////////////////////////////////////////////////////////////////////
// === PageRole ===
class PageRole : public PageTable
{
public:
    PageRole(PARAM* p, EPvCode pvcode);

    virtual void onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result) override;
    virtual void onOperate(int row, int col, std::string oper)  override;
    virtual std::string onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)  override ;
    virtual std::string onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
};

///////////////////////////////////////////////////////////////////////////////////////////////////
// === PagePermission ===
class PagePermission : public PageTable
{
public:
    PagePermission(PARAM* p, EPvCode pvcode);

    virtual void onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result) override;
    virtual void onOperate(int row, int col, std::string oper) override;
    virtual std::string onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
    virtual std::string onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
};

///////////////////////////////////////////////////////////////////////////////////////////////////
// === PageStation ===
class PageStation : public PageTable
{
public:
    PageStation(PARAM* p, EPvCode pvcode);

    virtual void onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result) override;
    virtual void onOperate(int row, int col, std::string oper) override;
    virtual std::string onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
    virtual std::string onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
};

///////////////////////////////////////////////////////////////////////////////////////////////////
// === PageDevice ===
class PageDevice : public PageTable
{
public:
    PageDevice(PARAM* p, EPvCode pvcode);

    virtual void onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result) override;
    virtual void onOperate(int row, int col, std::string oper) override;
    virtual std::string onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
    virtual std::string onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
};

///////////////////////////////////////////////////////////////////////////////////////////////////
// === PagePolicy ===
class PanelPolicyPeak;
class PanelPolicyRequire;
class PanelPolicySelf;
class PagePolicy : public PageTable
{
public:
    PagePolicy(PARAM* p, EPvCode pvcode);
    void setPanel(int policyTypeId, std::string attrVal);
    std::string getPanelAttr(int policyTypeId);

    virtual void onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result) override;
    virtual void onOperate(int row, int col, std::string oper) override;
    virtual std::string onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
    virtual std::string onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;

    std::shared_ptr<PanelPolicyPeak> panelPeak {};
    std::shared_ptr<PanelPolicyRequire> panelRequire {};
    std::shared_ptr<PanelPolicySelf> panelSelf {};
};

///////////////////////////////////////////////////////////////////////////////////////////////////
// === PageSyslog ===
class PageSyslog : public PageTable
{
public:
    PageSyslog(PARAM* p, EPvCode pvcode);

    virtual void onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result) override;
    virtual void onOperate(int row, int col, std::string oper) override;
    virtual std::string onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
    virtual std::string onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
};

///////////////////////////////////////////////////////////////////////////////////////////////////
// === PageAlertlog ===
class PageAlertlog : public PageTable
{
public:
    PageAlertlog(PARAM* p, EPvCode pvcode);

    virtual void onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result) override;
    virtual void onOperate(int row, int col, std::string oper) override;
    virtual std::string onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
    virtual std::string onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields) override;
};