diff --git a/library/include/mobilisis/weekdays.h b/library/include/mobilisis/weekdays.h index 3911cf5..e5187e9 100644 --- a/library/include/mobilisis/weekdays.h +++ b/library/include/mobilisis/weekdays.h @@ -1,10 +1,57 @@ -#pragma once -#include +#include "tariff_settings.h" +#include "tariff_carryover_settings.h" -class ATBWeekDays -{ -public: - int pdiw_id; - std::string pdiw_label; - int pdiw_index; -}; \ No newline at end of file +#include +#include +#include + +struct ATBWeekDay { + enum WeekDayType {USUAL_WEEKDAY=0, HOLIDAY=1}; + + Qt::DayOfWeek m_id; + QString m_name; + QDate m_date; + WeekDayType m_type; + ATBTariffSettings m_tariffSettings; + ATBTariffCarryOverSettings m_tariffCarryOverSettings; + + explicit ATBWeekDay() + : m_id(Qt::Monday) + , m_name("") + , m_date(QDate()) + , m_type(USUAL_WEEKDAY) + , m_tariffSettings() + , m_tariffCarryOverSettings() {} + + explicit ATBWeekDay(Qt::DayOfWeek id, QString const &name, WeekDayType type, + QDate const &date, + ATBTariffSettings const &tariffSettings, + ATBTariffCarryOverSettings const &tariffCarryOverSettings) + : m_id(id) + , m_name(name) + , m_date(date) + , m_type(type) + , m_tariffSettings(tariffSettings) + , m_tariffCarryOverSettings(tariffCarryOverSettings) {} + + ATBTariffCarryOverSettings &getTariffCarryOverSettings() { return m_tariffCarryOverSettings; } + ATBTariffCarryOverSettings const &getTariffCarryOverSettings() const { return m_tariffCarryOverSettings; } + + ATBTariffSettings &getTariffSettings() { return m_tariffSettings; } + ATBTariffSettings const &getTariffSettings() const { return m_tariffSettings; } + + friend QDebug operator<<(QDebug debug, ATBWeekDay const &wd) { + QDebugStateSaver saver(debug); + + debug.nospace() + << " id: " << (int)wd.m_id << "\n" + << " name: " << wd.m_name << "\n" + << " type: " << (int)wd.m_type << "\n\n" + << " tariff settings: " << "\n" + << wd.m_tariffSettings << "\n" + << "tariff carryover settings: " << "\n" + << wd.m_tariffCarryOverSettings << endl; + + return debug; + } +};