#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 "tariff_interpolation.h" #include "tariff_prepaid.h" #include "tariff_carryover.h" #include "tariff_prepay.h" #include "tariff_permit_type.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; using ATBPaymentOptionType = std::multimap; using TariffInterpolationType = std::multimap; using TariffPrepaidType = std::multimap; using TariffPrepayOptionType = std::multimap; using TariffCarryOverType = std::multimap; using TariffDurationType = std::multimap; ATBProject project; ATBCurrency Currency; ATBDuration duration; TariffDurationType Duration; multimap PaymentMethod; multimap PaymentRate; SpecialDaysWorktimeType SpecialDaysWorktime; SpecialDaysType SpecialDays; multimap WeekDays; multimap YearPeriod; multimap WeekDaysWorktime; ATBPaymentOptionType PaymentOption; multimap DailyTicket; TimeRangeType TimeRange; multimap TimeStepConfig; multimap TimeBase; multimap Customer; TariffProductType TariffProduct; TariffInterpolationType TariffInterpolations; TariffPrepaidType TariffPrepaidOptions; TariffPrepayOptionType TariffPrepayOptions; TariffCarryOverType TariffCarryOverOptions; /// /// 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> getPaymentOptionsForAllKeys() const; std::optional getPaymentOptionForId(int key) const; std::optional> getPaymentRateForKey(int key) const; std::optional getPaymentOptionForKey(PERMIT_TYPE permitType) const; std::optional getPaymentOptionForKey(int permitType) const; std::optional getPaymentOptionForKey(QString const &permitType) const; std::optional> getDailyTicketsForAllKeys() const; std::optional> getDailyTicketsForKey(int key) const; std::optional getInterpolationType(int type) const; std::optional getInterpolationEnd(QDateTime const &start, int paymentOptionIndex) const; std::optional getPrepaidType(int type) const; std::optional> getTariffProductForAllKeys() const; std::optional> getTariffProductForProductId(int id) const; std::optional> getTariffProductForProductId(PermitType permitType) const; std::optional> getTariffProductForProductTypeName(QString const &permitTypeName) const; std::optional getCustomerForType(ATBCustomer::CustomerType customerType); std::optional getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek); std::optional> getAllWeekDayWorkTimes(); std::optional prepaidStart(QDateTime const &start, int prepaid_option_id); int getPaymentOptionIndex(PERMIT_TYPE permitType); int getPaymentOptionIndex(PERMIT_TYPE permitType) const; private: /// /// Identify type of JSON member /// /// /// MemberType IdentifyJsonMember(const char* member_name); QVector currentPaymentOptions; };