#pragma once #include #include #include #include #include #include #include #include #include "member_type.h" #include "currency.h" #include "duration.h" #include "payment_mtd.h" #include "payment_opt.h" #include "spec_days.h" #include "payment_opt.h" #include "weekdays.h" #include "weekdays_worktime.h" #include "spec_days_worktime.h" #include "member_type.h" #include "period_year.h" #include "payment_rate.h" #include "atb_project.h" #include "tariff_daily_ticket.h" #include "time_range_header.h" #include "tariff_timestep_config.h" #include "tariff_product.h" #include #include using namespace std; using namespace rapidjson; class Calculator; class Configuration { public: using SpecialDaysType = std::multimap; using SpecialDaysWorktimeType = std::multimap; using TimeRangeType = std::multimap; using TariffProductType = std::multimap; ATBProject project; ATBCurrency Currency; ATBDuration duration; multimap Duration; multimap PaymentMethod; multimap PaymentRate; SpecialDaysWorktimeType SpecialDaysWorktime; SpecialDaysType SpecialDays; multimap WeekDays; multimap YearPeriod; multimap WeekDaysWorktime; multimap PaymentOption; multimap DailyTicket; TimeRangeType TimeRange; multimap TimeStepConfig; multimap TimeBase; multimap Customer; TariffProductType TariffProduct; /// /// Parse JSON string /// /// /// Returns operation status bool (OK | FAIL) bool ParseJson(Configuration* cfg, const char* json); ATBPaymentOption &getPaymentOptions(int paymentOptionsIndex=0); ATBPaymentOption const &getPaymentOptions(int paymentOptionsIndex=0) const; QVector &getAllPaymentOptions(); QVector const &getAllPaymentOptions() const; int getPaymentOptionIndex(QDateTime const &dt) const; int getPaymentOptionIndexIfSpecialDay(QDateTime const &dt) const; bool isSpecialDay(QDateTime const &dt) const; int specialDayId(QDateTime const &dt) const; ATBSpecialDays specialDay(QDateTime const &dt) const; bool isDayIncluded(uint64_t businessHours, QDateTime const &dt) const; bool isDayIncludedAsSpecialDay(uint64_t businessHours, QDateTime const &dt) const; bool isDayIncludedAsSpecialDay(uint64_t businessHours, int specialDayId) const; std::optional> getPaymentRateForAllKeys() const; std::optional> getPaymentRateForKey(int key) const; std::optional> getDailyTicketsForAllKeys() const; std::optional> getDailyTicketsForKey(int key) const; std::optional> getTariffProductForAllKeys() const; std::optional> getTariffProductForProductId(int id) const; std::optional> getTariffProductForProductId(PermitType permitType) const; std::optional getCustomerForType(ATBCustomer::CustomerType customerType); std::optional getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek); private: /// /// Identify type of JSON member /// /// /// MemberType IdentifyJsonMember(const char* member_name); QVector currentPaymentOptions; };