#pragma once #include #include "configuration.h" #include "payment_method.h" #include using namespace std; class Calculator { public: /// /// Gets duration in seconds from cost /// /// Pointer to configuration /// Type of vehicle /// Date/time of payment to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) /// /// Returns duration in seconds (data type: double) std::string GetDurationFromCost(Configuration* cfg, uint8_t vehicle_type, char const* start_datetime, double price, bool nextDay = false, bool prepaid = false); /// /// Gets cost from duration in seconds /// /// Pointer to configuration /// Type of vehicle /// Date/time of payment to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) /// Date/time of park end to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) /// Duration of parking in minutes /// Returns cost (data type: double) double GetCostFromDuration(Configuration* cfg, uint8_t vehicle_type, const QDateTime start_datetime, QDateTime & end_datetime, double durationMin, bool nextDay = false, bool prepaid = false); // Introduced for Schoenau, Koenigsee. // For tariff of following structure: only steps, no special days, nonstop. uint32_t GetCostFromDuration(Configuration const* cfg, QDateTime const &start, quint64 durationMinutes, uint8_t paymentMethod = PaymentMethod::Steps); uint32_t GetCostFromDuration(Configuration const* cfg, QDateTime const &start, QDateTime const &end, uint8_t paymentMethod = PaymentMethod::Steps); // Daily ticket QDateTime GetDailyTicketDuration(Configuration* cfg, const QDateTime start_datetime, uint8_t payment_option, bool carry_over); // // helper functions for Schoenau // QList GetTimeSteps(Configuration const *cfg, int paymentMethod); // uint32_t GetPriceForTimeStep(Configuration const *cfg, uint8_t paymentMethod, int timeStep); };