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

48 lines
1.4 KiB
C

#ifndef TARIFF_CUSTOMER_H_INCLUDED
#define TARIFF_CUSTOMER_H_INCLUDED
#include <QString>
#include <QDebug>
#include <QDebugStateSaver>
struct ATBCustomer {
enum class CustomerType {ADULT=1000, CHILD, TEEN};
ATBCustomer() = default;
int cust_id;
CustomerType cust_type;
QString cust_label;
friend QDebug operator<<(QDebug debug, ATBCustomer const &customer) {
QDebugStateSaver saver(debug);
debug.nospace() << "CUSTOMER" << "\n";
switch(customer.cust_type) {
case ATBCustomer::CustomerType::ADULT:
debug.nospace()
<< " cust_id: " << customer.cust_id << "\n"
<< " cust_type: " << "CustomerType::ADULT" << "\n"
<< "cust_label: " << customer.cust_label << "\n";
break;
case ATBCustomer::CustomerType::CHILD:
debug.nospace()
<< " cust_id: " << customer.cust_id << "\n"
<< " cust_type: " << "CustomerType::CHILD" << "\n"
<< "cust_label: " << customer.cust_label << "\n";
break;
case ATBCustomer::CustomerType::TEEN:
debug.nospace()
<< " cust_id: " << customer.cust_id << "\n"
<< " cust_type: " << "CustomerType::TEEN" << "\n"
<< "cust_label: " << customer.cust_label << "\n";
break;
}
return debug;
}
};
#endif // TARIFF_CUSTOMER_H_INCLUDED