#ifndef QPAGEDTABLECOLUMN_H
#define QPAGEDTABLECOLUMN_H

#include <QObject>
#include <QHeaderView>

class QPagedTableColumn
{
public:
    QPagedTableColumn() {};

    enum ColumnWidthType {
        PIXEL,
        PERCENT
    };

    int idx;
    QString name;
    QString text;
    QString value;
    double width;

    int widthType = ColumnWidthType::PERCENT;
    int align = Qt::AlignmentFlag::AlignCenter;
    int resizeMode = QHeaderView::ResizeMode::Fixed;

    void setWidthType(QString type) {
        type = type.toUpper();
        if (type == "PIXEL") {
            widthType = ColumnWidthType::PIXEL;
        } else if (type == "PERCENT") {
            widthType = ColumnWidthType::PERCENT;
        }
    }

    void setAlignType(QString type) {
        type = type.toUpper();
        if (type == "LEFT") {
            align = Qt::AlignmentFlag::AlignLeft | Qt::AlignmentFlag::AlignVCenter;
        } else if (type == "CENTER") {
            align = Qt::AlignmentFlag::AlignCenter;
        } else if (type == "RIGHT") {
            align = Qt::AlignmentFlag::AlignRight | Qt::AlignmentFlag::AlignVCenter;
        }
    }

    void setResizeMode(QString type) {
        type = type.toUpper();
        if (type == "STRETCH") {
            resizeMode = QHeaderView::ResizeMode::Stretch;
        } else if (type == "FIXED") {
            resizeMode = QHeaderView::ResizeMode::Fixed;
        } else if (type == "CONTENTS") {
            resizeMode = QHeaderView::ResizeMode::ResizeToContents;
        }
    }

};

#endif // QPAGEDTABLECOLUMN_H
