#pragma once

#include "pv/PvApp.h"

class CardDevice;
class Station;

class MaskPageRunning : public PvMask
{
public:
    struct Module {
        std::string name;
        int widget;
        int btn;
        int workspace;

        int labelPower;
        int labelNum;
    };

    MaskPageRunning(PARAM* p);
    int initUI(EPvCode pvcode);
    void initModule(Module& module, std::string name, int x, int y, int w, int h);

    virtual EPvCode onEventButton(int pvid);

    void activeBoxPanel(Module* module);

    void updateWorkspace();

    void onComboxStation(std::string stationName);
    void onComboxWorkMode(std::string modeName);


    struct {
        int comboxStation;
        int comboxWorkMode;
    } ui;

    Module storage;
    Module solar;
    Module charge;
    Module security;

    Module* activeBox {};

    std::vector<std::shared_ptr<CardDevice>> vecCard_;
    std::shared_ptr<Station> activeStation = nullptr;
};