#ifndef CALCULATE_PARKING_TICKETS_TARIFF_H_INCLUDED
#define CALCULATE_PARKING_TICKETS_TARIFF_H_INCLUDED

#include "calculate_parking_tickets_global.h"
#include "calculate_parking_tickets_tariff_step.h"
#include <QDateTime>
#include <QVector>
#include <QSet>
#include <QPair>
#include <QList>

#define FAHRZEUG_AUSWAHL_PKW            (uint64_t)(0x0000000000000001)
#define FAHRZEUG_AUSWAHL_BUS            (uint64_t)(0x0000000000000002)
#define FAHRZEUG_AUSWAHL_LKW            (uint64_t)(0x0000000000000004)
#define VERANSTALTUNG_AUSWAHL_SPORT     (uint64_t)(0x0000000000000008)
#define VERANSTALTUNG_AUSWAHL_KULTUR    (uint64_t)(0x0000000000000010)

struct parking_tariff_t {
    explicit parking_tariff_t()
        : day_tariff_start(0)
        , day_tariff_end(0)
        , night_tariff_start(0)
        , night_tariff_end(0) {
    }

    static parking_tariff_t *parseTariff(const char *confFile);

    /// \brief Express computational units in cent.
    ///
    /// The internal computations do not use the unit "cent" \n
    /// directly. Rather virtual integer value <b>unit_definition</b> is used, expressing \n
    /// how many cents correspond to <b>unit_definition</b> units.
    uint32_t unit_definition;

    /// \brief Scale units to cent.
    ///
    double unit_scale_factor;

    /// \brief VAT (Mehrwertsteuer) in percent.
    ///
    double vat;

    QSet<QDate> holidays;

    ///
    /// \brief m_tariffSteps
    ///
    TariffStep m_tariffSteps[3][7][MIN_PER_DAY];

    ///
    /// \brief day_tariff_start
    ///
    minute_t day_tariff_start;

    ///
    /// \brief day_tariff_end
    ///
    minute_t day_tariff_end;

    ///
    /// \brief night_tariff_start
    ///
    minute_t night_tariff_start;

    ///
    /// \brief night_tariff_end
    ///
    minute_t night_tariff_end;

    ///
    /// \brief waiting_period
    /// @note Also called "Karenzzeit". Allowed values: [0, 3]
    minute_t waiting_period;

    ///
    /// \brief free_of_charge
    ///
    minute_t free_of_charge_day_tariff;

    ///
    /// \brief free_of_charge_night_tariff
    ///
    minute_t free_of_charge_night_tariff;

    ///
    /// \brief max_parking_price_units
    ///
    uint32_t max_parking_price_units;

    ///
    /// \brief max_price_for_24_hours
    ///
    uint32_t max_price_for_24_hours;    // 24h limit (default -1)

    ///
    /// \brief tariff_version
    ///
    char tariff_version[64];

    ///
    /// \brief tariff_features
    ///
    uint64_t tariff_features;

    ///
    /// \brief _tariff_features
    ///
    uint64_t _tariff_features[64];

    ///
    /// \brief parking_time_min
    ///
    minute_t parking_time_min;

    ///
    /// \brief parking_time_max
    ///
    minute_t parking_time_max;

    ///
    /// \brief basic_tariff
    ///
    bool basic_tariff;

    ///
    /// \brief max_price_24h_after_arrival
    ///
    uint32_t max_price_24h_after_arrival;

    ///
    /// \brief max_price_at_midnight
    ///
    uint32_t max_price_at_midnight;
};

#endif // CALCULATE_PARKING_TICKETS_TARIFF_H_INCLUDED
