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

83 lines
3.0 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>
#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;
int daily_ticket_unit_id;
double daily_ticket_price;
2023-12-15 13:28:19 +01:00
ATBTimeBase::TimeBaseType daily_ticket_tbase_type;
// time base setting for ticket:
// absolute: using time stamps
// relative: use offsets from
// some reference time point,
// typically "start time".
ATBCustomer::CustomerType daily_ticket_clearance_customer_type;
// who is allowed to buy the ticket:
// list of customer types
int daily_ticket_weekday_range; // [mon-sun]
int daily_ticket_special_day_range;
friend QDebug operator<<(QDebug debug, ATBDailyTicket const &ticket) {
QDebugStateSaver saver(debug);
debug.nospace()
<< " daily_ticket_payment_option_id: " << ticket.daily_ticket_payment_option_id << "\n"
<< " daily_ticket_unit_id: " << ticket.daily_ticket_unit_id << "\n"
<< " daily_ticket_price: " << ticket.daily_ticket_price << "\n";
switch(ticket.daily_ticket_tbase_type) {
case ATBTimeBase::TimeBaseType::ABSOLUTE:
debug.nospace()
<< " daily_ticket_tbase_type: " << "TimeBaseType::ABSOLUTE" << "\n";
break;
case ATBTimeBase::TimeBaseType::RELATIVE:
debug.nospace()
<< " daily_ticket_tbase_type: " << "TimeBaseType::RELATIVE" << "\n";
break;
}
2023-12-12 11:53:22 +01:00
2023-12-15 13:28:19 +01:00
switch(ticket.daily_ticket_clearance_customer_type) {
case ATBCustomer::CustomerType::ADULT:
debug.nospace()
<< "daily_ticket_clearance_customer_type: " << "CustomerType::ADULT" << "\n";
break;
case ATBCustomer::CustomerType::CHILD:
debug.nospace()
<< "daily_ticket_clearance_customer_type: " << "CustomerType::CHILD" << "\n";
break;
case ATBCustomer::CustomerType::TEEN:
debug.nospace()
<< "daily_ticket_clearance_customer_type: " << "CustomerType::TEEN" << "\n";
break;
default:
debug.nospace()
<< "daily_ticket_clearance_customer_type: " << "CustomerType::???" << "\n";
break;
}
2023-12-12 11:53:22 +01:00
2023-12-15 13:28:19 +01:00
debug.nospace()
<< " daily_ticket_weekday_range: " << ticket.daily_ticket_weekday_range << "\n"
<< " daily_ticket_special_day_range: " << ticket.daily_ticket_special_day_range << "\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