
#pragma once

#include "WidgetPage.h"
#include <QtWebEngineWidgets/QWebEngineView>

#include <sstream>
#include <iostream>
class LabelParam
{
public:
    std::shared_ptr<QLabel> labBkg_;
    std::shared_ptr<QLabel> labKey_;
    std::shared_ptr<QLabel> labVal_;
    std::shared_ptr<QLabel> labTail_;

    LabelParam(QWidget* parent, std::string k, std::string v, std::string t, int x, int y, int w, int h)
    {
        labBkg_ = QUI::label(parent, x, y, w, h, "", "background-color:rgba(100,100,100,50)");
        labKey_ = QUI::label(parent, x, y, w, h*0.5, k, "color:white;font: bold 16px;");
        labVal_ = QUI::label(parent, x, y+h*0.5, w*float(2.0/3.0), h*0.5, v, "color:rgb(77, 215, 240);font:bold 16px;");
        labTail_ = QUI::label(parent, x+w*float(2.0/3.0)+5, y+h*0.5, w*float(1.0/3.0), h*0.5, t, "color:white;font: bold 12px;");

        labKey_->setAlignment(Qt::AlignCenter);
        labVal_->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
        labTail_->setAlignment(Qt::AlignVCenter);
    }
};


class IconParam
{
public:
    std::shared_ptr<QLabel> lab711_;
    std::shared_ptr<QLabel> lab712_;
    std::shared_ptr<QLabel> lab713_;
    std::shared_ptr<QLabel> lab714_;

    std::string tail;

    IconParam(QWidget* parent, std::string k, std::string v, std::string t, int x, int y, QColor color= QColor(61, 254, 250))
    {
        tail = t;
        std::stringstream ss;
        ss << color.red() << "," << color.green() << "," << color.blue();
        lab711_ = QUI::label(parent, x, y, 5, 50, "", "background-color:rgb(" + ss.str() + ")");
        lab712_ = QUI::label(parent, x + 10, y, 50, 50, "", "background-color:rgba(" + ss.str() + ",50)");
        lab713_ = QUI::label(parent, x + 10 + 60, y, 100, 25, k, "font: normal 16px; color:white");
        lab714_ = QUI::label(parent, x + 10 + 60, y+25, 100, 25, v+tail, "font: normal 16px; color:white");
    }
};

class WidgetPageOverview : public WidgetPage
{
public:
    WidgetPageOverview(QWidget* parent);

    std::shared_ptr<Panel> panel1_;
    std::shared_ptr<QLabel> labBkg_;
    std::shared_ptr<QLabel> labDaysK_;
    std::shared_ptr<QLabel> labDaysV_;
    std::shared_ptr<QLabel> labDaysT_;

    std::shared_ptr<LabelParam> labp1_;
    std::shared_ptr<LabelParam> labp2_;
    std::shared_ptr<LabelParam> labp3_;
    std::shared_ptr<LabelParam> labp4_;
    std::shared_ptr<LabelParam> labp5_;
    std::shared_ptr<LabelParam> labp6_;


    std::shared_ptr<Panel> panel2_;
    std::shared_ptr<LabelParam> labp21_;
    std::shared_ptr<LabelParam> labp22_;
    std::shared_ptr<LabelParam> labp23_;
    std::shared_ptr<ChartBarView> chartbar2_;

    std::shared_ptr<Panel> panel3_;
    std::shared_ptr<LabelParam> labp31_;
    std::shared_ptr<LabelParam> labp32_;
    std::shared_ptr<ChartBarView> chartbar3_;

    std::shared_ptr<Panel> panel4_;
    std::shared_ptr<LabelParam> labp41_;
    std::shared_ptr<LabelParam> labp42_;
    std::shared_ptr<LabelParam> labp43_;
    std::shared_ptr<ChartBarView> chartbar4_;

    std::shared_ptr<Panel> panel5_;
    std::shared_ptr<LabelParam> labp51_;
    std::shared_ptr<LabelParam> labp52_;
    std::shared_ptr<ChartBarView> chartbar5_;

    std::shared_ptr<Panel> panel6_;
    std::shared_ptr<LabelParam> labp61_;
    std::shared_ptr<LabelParam> labp62_;
    std::shared_ptr<LabelParam> labp63_;
    std::shared_ptr<ChartBarView> chartbar6_;

    std::shared_ptr<Panel> panel7_;
    std::shared_ptr<ChartLineView> chartline7_;

    std::shared_ptr<QWebEngineView> wWebView = nullptr;

    std::shared_ptr<IconParam> iconp1_;
    std::shared_ptr<IconParam> iconp2_;
    std::shared_ptr<IconParam> iconp3_;
    std::shared_ptr<IconParam> iconp4_;

};