MOBILISIS-Calculator/library/include/mobilisis/tariff_daily_ticket.h

68 lines
2.6 KiB
C
Raw Normal View History

2023-12-12 11:53:22 +01:00
#ifndef TARIFF_DAILY_TICKET_H_INCLUDED
#define TARIFF_DAILY_TICKET_H_INCLUDED
#include <QString>
#include <QDateTime>
2023-12-15 13:28:19 +01:00
#include <QDebug>
2024-01-30 10:17:56 +01:00
#include <QVector>
2023-12-15 13:28:19 +01:00
#include <QDebugStateSaver>
2023-12-12 11:53:22 +01:00
2023-12-15 13:28:19 +01:00
#include "tariff_customer.h"
#include "tariff_time_range.h"
#include "tariff_timebase.h"
struct ATBDailyTicket {
ATBDailyTicket() = default;
2023-12-12 11:53:22 +01:00
int daily_ticket_payment_option_id;
2024-01-30 10:17:56 +01:00
int daily_ticket_id;
int daily_ticket_price_id;
2023-12-12 11:53:22 +01:00
2024-01-30 10:17:56 +01:00
int daily_ticket_tb_id;
2023-12-15 13:28:19 +01:00
// time base setting for ticket:
// absolute: using time stamps
// relative: use offsets from
// some reference time point,
// typically "start time".
2024-01-30 10:17:56 +01:00
QVector<int> daily_ticket_clearance_customer_ids;
2023-12-15 13:28:19 +01:00
// who is allowed to buy the ticket:
// list of customer types
2024-01-30 10:17:56 +01:00
QTime daily_ticket_from_min; // absolute time base
QTime daily_ticket_to_max;
int daily_ticket_from_offset_min; // relative time base
int daily_ticket_to_offset_max;
void reset() {
daily_ticket_payment_option_id = 0;
daily_ticket_id = 0;
daily_ticket_price_id = 0;
daily_ticket_tb_id = 0;
daily_ticket_clearance_customer_ids.clear();
daily_ticket_from_min = QTime();
daily_ticket_to_max = QTime();
daily_ticket_from_offset_min = 0;
daily_ticket_to_offset_max = 0;
}
2023-12-15 13:28:19 +01:00
friend QDebug operator<<(QDebug debug, ATBDailyTicket const &ticket) {
QDebugStateSaver saver(debug);
debug.nospace()
2024-01-30 10:17:56 +01:00
<< "DAILY TICKET " << "\n"
<< " daily_ticket_id: " << ticket.daily_ticket_id << "\n"
<< " daily_ticket_payment_option_id: " << ticket.daily_ticket_payment_option_id << "\n"
<< " daily_ticket_tbase_id: " << ticket.daily_ticket_tb_id << "\n"
<< " daily_ticket_price_id: " << ticket.daily_ticket_price_id << "\n"
<< "daily_ticket_clearance_customer_ids: " << ticket.daily_ticket_clearance_customer_ids << "\n"
<< " daily_ticket_from_min: " << ticket.daily_ticket_from_min.toString(Qt::ISODate) << "\n"
<< " daily_ticket_to_min: " << ticket.daily_ticket_to_max.toString(Qt::ISODate) << "\n";
2023-12-12 11:53:22 +01:00
2023-12-15 13:28:19 +01:00
return debug;
}
2023-12-12 11:53:22 +01:00
};
#endif // TARIFF_DAILY_TICKET_H_INCLUDED