#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: ATBProject project; ATBCurrency Currency; ATBDuration duration; multimap Duration; multimap PaymentMethod; multimap PaymentRate; multimap SpecialDaysWorktime; multimap SpecialDays; multimap WeekDays; multimap YearPeriod; multimap WeekDaysWorktime; multimap PaymentOption; multimap DailyTicket; multimap TimeRange; multimap TimeStepConfig; multimap TimeBase; multimap Customer; multimap 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 getCurrentPaymentOptionIndex(QDateTime const &dt) const; bool isHoliday(QDateTime const &dt) 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; };