File indexing completed on 2024-11-24 04:45:10

0001 /*
0002     SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 #ifndef KITINERARY_FCBTICKET_H
0007 #define KITINERARY_FCBTICKET_H
0008 
0009 #include <KItinerary/Uic9183Block>
0010 
0011 #include "asn1/uperelement.h"
0012 
0013 #include <QDateTime>
0014 #include <QList>
0015 #include <QVariant>
0016 
0017 #include <bitset>
0018 
0019 namespace KItinerary {
0020 
0021 class UPERDecoder;
0022 
0023 /** ERA Flexible Content Barcode (FCB)
0024  *  @see ERA TAP TSI TD B.12 ยง11 and the corresponding ASN.1 definition
0025  */
0026 namespace Fcb {
0027 
0028 Q_NAMESPACE
0029 
0030 /** Generic extension data. */
0031 class ExtensionData {
0032     UPER_GADGET
0033     UPER_ELEMENT(QByteArray, extensionId)
0034     UPER_ELEMENT(QByteArray, extensionData)
0035     UPER_GADGET_FINALIZE
0036 };
0037 
0038 enum GeoUnitType {
0039     microDegree = 0,
0040     tenthmilliDegree = 1,
0041     milliDegree = 2,
0042     centiDegree = 3,
0043     deciDegree = 4,
0044 };
0045 UPER_ENUM(GeoUnitType)
0046 
0047 enum GeoCoordinateSystemType {
0048     wgs84 = 0,
0049     grs80 = 1,
0050 };
0051 UPER_ENUM(GeoCoordinateSystemType)
0052 
0053 enum HemisphereLongitudeType {
0054     north = 0,
0055     south = 1,
0056 };
0057 UPER_ENUM(HemisphereLongitudeType)
0058 
0059 enum HemisphereLatitudeType {
0060     east = 0,
0061     west = 1,
0062 };
0063 UPER_ENUM(HemisphereLatitudeType)
0064 
0065 /** Geographic coordinate. */
0066 class GeoCoordinateType {
0067     UPER_GADGET
0068     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::GeoUnitType, geoUnit, milliDegree)
0069     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::GeoCoordinateSystemType, coordinateSystem, wgs84)
0070     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::HemisphereLongitudeType, hemisphereLongitude, north)
0071     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::HemisphereLatitudeType, hemisphereLatitude, east)
0072     UPER_ELEMENT(int, longitude)
0073     UPER_ELEMENT(int, latitude)
0074     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::GeoUnitType, accuracy)
0075     UPER_GADGET_FINALIZE
0076 };
0077 
0078 /** Delta encoding of a geographic coordinate. */
0079 class DeltaCoordinate {
0080     UPER_GADGET
0081     UPER_ELEMENT(int, longitude)
0082     UPER_ELEMENT(int, latitude)
0083     UPER_GADGET_FINALIZE
0084 };
0085 
0086 /** Issuing information. */
0087 class IssuingData {
0088     UPER_EXTENDABLE_GADGET
0089     UPER_ELEMENT_OPTIONAL(int, securityProviderNum)
0090     UPER_ELEMENT_OPTIONAL(QByteArray, securityProviderIA5)
0091     UPER_ELEMENT_OPTIONAL(int, issuerNum)
0092     UPER_ELEMENT_OPTIONAL(QByteArray, issuerIA5)
0093     UPER_ELEMENT(int, issuingYear)
0094     UPER_ELEMENT(int, issuingDay)
0095     UPER_ELEMENT_OPTIONAL(int, issuingTime)
0096     UPER_ELEMENT_OPTIONAL(QString, issuerName)
0097     UPER_ELEMENT(bool, specimen)
0098     UPER_ELEMENT(bool, securePaperTicket)
0099     UPER_ELEMENT(bool, activated)
0100     UPER_ELEMENT_DEFAULT(QByteArray, currency, "EUR")
0101     UPER_ELEMENT_DEFAULT(int, currencyFract, 2)
0102     UPER_ELEMENT_OPTIONAL(QByteArray, issuerPNR)
0103     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0104     UPER_ELEMENT_OPTIONAL(int, issuedOnTrainNum)
0105     UPER_ELEMENT_OPTIONAL(QByteArray, issuedOnTrainIA5)
0106     UPER_ELEMENT_OPTIONAL(int, issuedOnLine)
0107     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::GeoCoordinateType, pointOfSale)
0108     UPER_GADGET_FINALIZE
0109 
0110     Q_PROPERTY(QDateTime issueingDateTime READ issueingDateTime)
0111 public:
0112     QDateTime issueingDateTime() const;
0113 };
0114 
0115 enum GenderType {
0116     unspecified = 0,
0117     female = 1,
0118     male = 2,
0119     other = 3,
0120 };
0121 UPER_EXTENABLE_ENUM(GenderType)
0122 
0123 enum PassengerType {
0124     adult = 0,
0125     senior = 1,
0126     child = 2,
0127     youth = 3,
0128     dog = 4,
0129     bicycle = 5,
0130     freeAddonPassenger = 6,
0131     freeAddonChild = 7,
0132 };
0133 UPER_EXTENABLE_ENUM(PassengerType)
0134 
0135 /** Customer status information. */
0136 class CustomerStatusType {
0137     UPER_GADGET
0138     UPER_ELEMENT_OPTIONAL(int, statusProviderNum)
0139     UPER_ELEMENT_OPTIONAL(QByteArray, statusProviderIA5)
0140     UPER_ELEMENT_OPTIONAL(int, customerStatus)
0141     UPER_ELEMENT_OPTIONAL(QByteArray, customerStatusDescr)
0142     UPER_GADGET_FINALIZE
0143 };
0144 
0145 /** Information about a single traveler. */
0146 class TravelerType {
0147     UPER_EXTENDABLE_GADGET
0148     UPER_ELEMENT_OPTIONAL(QString, firstName)
0149     UPER_ELEMENT_OPTIONAL(QString, secondName)
0150     UPER_ELEMENT_OPTIONAL(QString, lastName)
0151     UPER_ELEMENT_OPTIONAL(QByteArray, idCard)
0152     UPER_ELEMENT_OPTIONAL(QByteArray, passportId)
0153     UPER_ELEMENT_OPTIONAL(QByteArray, title)
0154     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::GenderType, gender)
0155     UPER_ELEMENT_OPTIONAL(QByteArray, customerIdIA5)
0156     UPER_ELEMENT_OPTIONAL(int, customerIdNum)
0157     UPER_ELEMENT_OPTIONAL(int, yearOfBirth)
0158     UPER_ELEMENT_OPTIONAL(int, dayOfBirth)
0159     UPER_ELEMENT(bool, ticketHolder)
0160     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::PassengerType, passengerType)
0161     UPER_ELEMENT_OPTIONAL(bool, passengerWithReducedMobility)
0162     UPER_ELEMENT_OPTIONAL(int, countryOfResidence)
0163     UPER_ELEMENT_OPTIONAL(int, countryOfPassport)
0164     UPER_ELEMENT_OPTIONAL(int, countryOfIdCard)
0165     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::CustomerStatusType>, status)
0166     UPER_GADGET_FINALIZE
0167 };
0168 
0169 /** A set of traverlers. */
0170 class TravelerData {
0171     UPER_EXTENDABLE_GADGET
0172     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TravelerType>, traveler)
0173     UPER_ELEMENT_OPTIONAL(QByteArray, preferredLanguage)
0174     UPER_ELEMENT_OPTIONAL(QString, groupName)
0175     UPER_GADGET_FINALIZE
0176 };
0177 
0178 enum CodeTableType {
0179     stationUIC = 0,
0180     stationUICReservation = 1,
0181     stationERA = 2,
0182     localCarrierStationCodeTable = 3,
0183     proprietaryIssuerStationCodeTable = 4,
0184 };
0185 UPER_ENUM(CodeTableType)
0186 
0187 /** Reference to a specific train journey. */
0188 class TrainLinkType {
0189     UPER_GADGET
0190     UPER_ELEMENT_OPTIONAL(int, trainNum)
0191     UPER_ELEMENT_OPTIONAL(QByteArray, trainIA5)
0192     UPER_ELEMENT(int, travelDate)
0193     UPER_ELEMENT(int, departureTime)
0194     UPER_ELEMENT_OPTIONAL(int, departureUTCOffset)
0195     UPER_ELEMENT_OPTIONAL(int, fromStationNum)
0196     UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
0197     UPER_ELEMENT_OPTIONAL(int, toStationNum)
0198     UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
0199     UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
0200     UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
0201     UPER_GADGET_FINALIZE
0202 
0203 public:
0204     Q_INVOKABLE QDateTime departureDateTime(const QDateTime &issueingDateTime) const;
0205 };
0206 
0207 /** A set of via stations. */
0208 class ViaStationType {
0209     UPER_EXTENDABLE_GADGET
0210     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0211     UPER_ELEMENT_OPTIONAL(int, stationNum)
0212     UPER_ELEMENT_OPTIONAL(QByteArray, stationIA5)
0213     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::ViaStationType>, alternativeRoutes)
0214     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::ViaStationType>, route)
0215     UPER_ELEMENT(bool, border)
0216     UPER_ELEMENT_OPTIONAL(QList<int>, carrierNum)
0217     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, carrierIA5)
0218     UPER_ELEMENT_OPTIONAL(int, seriesId)
0219     UPER_ELEMENT_OPTIONAL(int, routeId)
0220     UPER_GADGET_FINALIZE
0221 };
0222 
0223 /** A tariff zone. */
0224 class ZoneType {
0225     UPER_EXTENDABLE_GADGET
0226     UPER_ELEMENT_OPTIONAL(int, carrierNum)
0227     UPER_ELEMENT_OPTIONAL(QByteArray, carrierIA5)
0228     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0229     UPER_ELEMENT_OPTIONAL(int, entryStationNum)
0230     UPER_ELEMENT_OPTIONAL(QByteArray, entryStationIA5)
0231     UPER_ELEMENT_OPTIONAL(int, terminatingStationNum)
0232     UPER_ELEMENT_OPTIONAL(QByteArray, terminatingStationIA5)
0233     UPER_ELEMENT_OPTIONAL(int, city)
0234     UPER_ELEMENT_OPTIONAL(QList<int>, zoneId)
0235     UPER_ELEMENT_OPTIONAL(QByteArray, binaryZoneId)
0236     UPER_ELEMENT_OPTIONAL(QByteArray, nutsCode)
0237     UPER_GADGET_FINALIZE
0238 };
0239 
0240 /** */
0241 class LineType {
0242     UPER_EXTENDABLE_GADGET
0243     UPER_ELEMENT_OPTIONAL(int, carrierNum)
0244     UPER_ELEMENT_OPTIONAL(QByteArray, carrierIA5)
0245     UPER_ELEMENT_OPTIONAL(QList<int>, lineId)
0246     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0247     UPER_ELEMENT_OPTIONAL(int, entryStationNum)
0248     UPER_ELEMENT_OPTIONAL(QByteArray, entryStationIA5)
0249     UPER_ELEMENT_OPTIONAL(int, terminatingStationNum)
0250     UPER_ELEMENT_OPTIONAL(QByteArray, terminatingStationIA5)
0251     UPER_ELEMENT_OPTIONAL(int, city)
0252     UPER_ELEMENT_OPTIONAL(QByteArray, binaryZoneId)
0253     UPER_GADGET_FINALIZE
0254 };
0255 
0256 /** A geographic polygon. */
0257 class PolygoneType {
0258     UPER_GADGET
0259     UPER_ELEMENT(KItinerary::Fcb::GeoCoordinateType, firstEdge)
0260     UPER_ELEMENT(QList<KItinerary::Fcb::DeltaCoordinate>, edges)
0261     UPER_GADGET_FINALIZE
0262 };
0263 
0264 /** Regional validity information.
0265  *  Can be one of:
0266  *  - TrainLinkType
0267  *  - ViaStationType
0268  *  - ZoneType
0269  *  - LineType
0270  *  - PolygoneType
0271  */
0272 class RegionalValidityType {
0273     UPER_EXTENDABLE_GADGET
0274     UPER_ELEMENT(QVariant, value)
0275     UPER_GADGET_FINALIZE
0276 };
0277 
0278 class ReturnRouteDescriptionType {
0279     UPER_EXTENDABLE_GADGET
0280     UPER_ELEMENT_OPTIONAL(int, fromStationNum)
0281     UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
0282     UPER_ELEMENT_OPTIONAL(int, toStationNum)
0283     UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
0284     UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
0285     UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
0286     UPER_ELEMENT_OPTIONAL(QString, validReturnRegionDesc)
0287     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegionalValidityType>, validReturnRegion)
0288     UPER_GADGET_FINALIZE
0289 };
0290 
0291 enum TravelClassType {
0292     notApplicable = 0,
0293     first = 1,
0294     second = 2,
0295     tourist = 3,
0296     comfort = 4,
0297     premium = 5,
0298     business = 6,
0299     all = 7
0300 };
0301 UPER_EXTENABLE_ENUM(TravelClassType)
0302 
0303 class RouteSectionType {
0304     UPER_GADGET
0305     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0306     UPER_ELEMENT_OPTIONAL(int, fromStationNum)
0307     UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
0308     UPER_ELEMENT_OPTIONAL(int, toStationNum)
0309     UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
0310     UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
0311     UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
0312     UPER_GADGET_FINALIZE
0313 };
0314 
0315 class SeriesDetailType {
0316     UPER_GADGET
0317     UPER_ELEMENT_OPTIONAL(int, supplyingCarrier)
0318     UPER_ELEMENT_OPTIONAL(int, offerIdentification)
0319     UPER_ELEMENT_OPTIONAL(int, series)
0320     UPER_GADGET_FINALIZE
0321 };
0322 
0323 /** Customer card information. */
0324 class CardReferenceType {
0325     UPER_EXTENDABLE_GADGET
0326     UPER_ELEMENT_OPTIONAL(int, cardIssuerNum)
0327     UPER_ELEMENT_OPTIONAL(QByteArray, cardIssuerIA5)
0328     UPER_ELEMENT_OPTIONAL(int, cardIdNum)
0329     UPER_ELEMENT_OPTIONAL(QByteArray, cardIdIA5)
0330     UPER_ELEMENT_OPTIONAL(QString, cardName)
0331     UPER_ELEMENT_OPTIONAL(int, cardType)
0332     UPER_ELEMENT_OPTIONAL(int, leadingCardIdNum)
0333     UPER_ELEMENT_OPTIONAL(QByteArray, leadingCardIdIA5)
0334     UPER_ELEMENT_OPTIONAL(int, trailingCardIdNum)
0335     UPER_ELEMENT_OPTIONAL(QByteArray, trailingCardIdIA5)
0336     UPER_GADGET_FINALIZE
0337 };
0338 
0339 enum ServiceType {
0340     seat = 0,
0341     couchette = 1,
0342     berth = 2,
0343     carcarriage = 3,
0344 };
0345 UPER_ENUM(ServiceType)
0346 
0347 /** Seat information. */
0348 class PlacesType {
0349     UPER_GADGET
0350     UPER_ELEMENT_OPTIONAL(QByteArray, coach)
0351     UPER_ELEMENT_OPTIONAL(QByteArray, placeString)
0352     UPER_ELEMENT_OPTIONAL(QString, placeDescription)
0353     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, placeIA5)
0354     UPER_ELEMENT_OPTIONAL(QList<int>, placeNum)
0355     UPER_GADGET_FINALIZE
0356 };
0357 
0358 enum class CompartmentPositionType {
0359     unspecified = 0, // TODO ambiguous, therefore using enum class for now, but that's not going to work in QML
0360     upperLevel = 1,
0361     lowerLevel = 2,
0362 };
0363 UPER_ENUM(CompartmentPositionType)
0364 
0365 /** Compartment information. */
0366 class CompartmentDetailsType {
0367     UPER_EXTENDABLE_GADGET
0368     UPER_ELEMENT_OPTIONAL(int, coachType)
0369     UPER_ELEMENT_OPTIONAL(int, compartmentType)
0370     UPER_ELEMENT_OPTIONAL(int, specialAllocation)
0371     UPER_ELEMENT_OPTIONAL(QString, coachTypeDescr)
0372     UPER_ELEMENT_OPTIONAL(QString, compartmentTypeDescr)
0373     UPER_ELEMENT_OPTIONAL(QString, specialAllocationDescr)
0374     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CompartmentPositionType, position, CompartmentPositionType::unspecified)
0375     UPER_GADGET_FINALIZE
0376 };
0377 
0378 enum BerthTypeType {
0379     single = 0,
0380     special = 1,
0381     doubleBerth = 2, // "double" in the spec, but that conflicts
0382     t2 = 3,
0383     t3 = 4,
0384     t4 = 5,
0385 };
0386 UPER_ENUM(BerthTypeType)
0387 
0388 enum class CompartmentGenderType {
0389     unspecified = 0, // TODO see CompartmentPositionType
0390     family = 1,
0391     female = 2,
0392     male = 3,
0393     mixed = 4,
0394 };
0395 UPER_EXTENABLE_ENUM(CompartmentGenderType)
0396 
0397 /** Berth information. */
0398 class BerthDetailData {
0399     UPER_EXTENDABLE_GADGET
0400     UPER_ELEMENT(KItinerary::Fcb::BerthTypeType, berthType)
0401     UPER_ELEMENT(int, numberOfBerths)
0402     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CompartmentGenderType, gender, CompartmentGenderType::family)
0403     UPER_GADGET_FINALIZE
0404 };
0405 
0406 /** Tariff information. */
0407 class TariffType {
0408     UPER_EXTENDABLE_GADGET
0409     UPER_ELEMENT_DEFAULT(int, numberOfPassengers, 1)
0410     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::PassengerType, passengerType)
0411     UPER_ELEMENT_OPTIONAL(int, ageBelow)
0412     UPER_ELEMENT_OPTIONAL(int, ageAbove)
0413     UPER_ELEMENT_OPTIONAL(QList<int>, travelerid)
0414     UPER_ELEMENT(bool, restrictedToCountryOfResidence)
0415     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::RouteSectionType, restrictedToRouteSection)
0416     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::SeriesDetailType, seriesDataDetails)
0417     UPER_ELEMENT_OPTIONAL(int, tariffIdNum)
0418     UPER_ELEMENT_OPTIONAL(QByteArray, tariffIdIA5)
0419     UPER_ELEMENT_OPTIONAL(QString, tariffDesc)
0420     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::CardReferenceType>, reductionCard)
0421     UPER_GADGET_FINALIZE
0422 };
0423 
0424 enum PriceTypeType {
0425     noPrice = 0,
0426     reservationFee = 1,
0427     supplement = 2,
0428     travelPrice = 3,
0429 };
0430 UPER_ENUM(PriceTypeType)
0431 
0432 /** VAT information. */
0433 class VatDetailType {
0434     UPER_GADGET
0435     UPER_ELEMENT(int, country)
0436     UPER_ELEMENT(int, percentage)
0437     UPER_ELEMENT_OPTIONAL(int, amount)
0438     UPER_ELEMENT_OPTIONAL(QByteArray, vatId)
0439     UPER_GADGET_FINALIZE
0440 };
0441 
0442 /** Open tickets included into a reservation. */
0443 class IncludedOpenTicketType {
0444     UPER_EXTENDABLE_GADGET
0445     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0446     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0447     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0448     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0449     UPER_ELEMENT_OPTIONAL(int, externalIssuerId)
0450     UPER_ELEMENT_OPTIONAL(int, issuerAutorizationId)
0451     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0452     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegionalValidityType>, validRegion)
0453     UPER_ELEMENT_DEFAULT(int, validFromDay, 0)
0454     UPER_ELEMENT_OPTIONAL(int, validFromTime)
0455     UPER_ELEMENT_OPTIONAL(int, validFromUTCOffset)
0456     UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
0457     UPER_ELEMENT_OPTIONAL(int, validUntilTime)
0458     UPER_ELEMENT_OPTIONAL(int, validUntilUTCOffset)
0459     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::TravelClassType, classCode)
0460     UPER_ELEMENT_OPTIONAL(QByteArray, serviceLevel)
0461     UPER_ELEMENT_OPTIONAL(QList<int>, carrierNum)
0462     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, carrierIA5)
0463     UPER_ELEMENT_OPTIONAL(QList<int>, includedServiceBrands)
0464     UPER_ELEMENT_OPTIONAL(QList<int>, excludedServiceBrands)
0465     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TariffType>, tariffs)
0466     UPER_ELEMENT_OPTIONAL(QString, infoText)
0467     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0468     UPER_GADGET_FINALIZE
0469 };
0470 
0471 /** Luggage information. */
0472 class RegisteredLuggageType {
0473     UPER_EXTENDABLE_GADGET
0474     UPER_ELEMENT_OPTIONAL(QByteArray, registrationId)
0475     UPER_ELEMENT_OPTIONAL(int, maxWeight)
0476     UPER_ELEMENT_OPTIONAL(int, maxSize)
0477     UPER_GADGET_FINALIZE
0478 };
0479 
0480 /** Luggage restriction information. */
0481 class LuggageRestrictionType {
0482     UPER_EXTENDABLE_GADGET
0483     UPER_ELEMENT_DEFAULT(int, maxHandLuggagePieces, 3)
0484     UPER_ELEMENT_DEFAULT(int, maxNonHandLuggagePieces, 1)
0485     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegisteredLuggageType>, registeredLuggage)
0486     UPER_GADGET_FINALIZE
0487 };
0488 
0489 /** Reservation document (IRT, RES). */
0490 class ReservationData {
0491     UPER_EXTENDABLE_GADGET
0492     UPER_ELEMENT_OPTIONAL(int, trainNum)
0493     UPER_ELEMENT_OPTIONAL(QByteArray, trainIA5)
0494     UPER_ELEMENT_DEFAULT(int, departureDate, 0)
0495     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0496     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0497     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0498     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0499     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0500     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0501     UPER_ELEMENT_OPTIONAL(int, serviceBrand)
0502     UPER_ELEMENT_OPTIONAL(QString, serviceBrandAbrUTF8)
0503     UPER_ELEMENT_OPTIONAL(QString, serviceBrandNameUTF8)
0504     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::ServiceType, service, seat)
0505     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUICReservation)
0506     UPER_ELEMENT_OPTIONAL(int, fromStationNum)
0507     UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
0508     UPER_ELEMENT_OPTIONAL(int, toStationNum)
0509     UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
0510     UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
0511     UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
0512     UPER_ELEMENT(int, departureTime)
0513     UPER_ELEMENT_OPTIONAL(int, departureUTCOffset)
0514     UPER_ELEMENT_DEFAULT(int, arrivalDate, 0)
0515     UPER_ELEMENT_OPTIONAL(int, arrivalTime)
0516     UPER_ELEMENT_OPTIONAL(int, arrivalUTCOffset)
0517     UPER_ELEMENT_OPTIONAL(QList<int>, carrierNum)
0518     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, carrierIA5)
0519     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::TravelClassType, classCode, second)
0520     UPER_ELEMENT_OPTIONAL(QByteArray, serviceLevel)
0521     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::PlacesType, places)
0522     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::PlacesType, additionalPlaces)
0523     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::PlacesType, bicyclePlaces)
0524     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::CompartmentDetailsType, compartmentDetails)
0525     UPER_ELEMENT_DEFAULT(int, numberOfOverbooked, 0)
0526     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::BerthDetailData>, berth)
0527     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TariffType>, tariffs) // "tariff" in the official ASN.1 spec, but that inconsistent with the other document types
0528     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::PriceTypeType, priceType, travelPrice)
0529     UPER_ELEMENT_OPTIONAL(int, price)
0530     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::VatDetailType>, vatDetail)
0531     UPER_ELEMENT_DEFAULT(int, typeOfSupplement, 0)
0532     UPER_ELEMENT_DEFAULT(int, numberOfSupplements, 0)
0533     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::LuggageRestrictionType, luggage)
0534     UPER_ELEMENT_OPTIONAL(QString, infoText)
0535     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0536     UPER_GADGET_FINALIZE
0537 
0538 public:
0539     Q_INVOKABLE QDateTime departureDateTime(const QDateTime &issueingDateTime) const;
0540     Q_INVOKABLE QDateTime arrivalDateTime(const QDateTime &issueingDateTime) const;
0541 };
0542 
0543 enum RoofRackType {
0544     norack = 0,
0545     roofRailing = 1,
0546     luggageRack = 2,
0547     skiRack = 3,
0548     boxRack = 4,
0549     rackWithOneBox = 5,
0550     rackWithTwoBoxes = 6,
0551     bicycleRack = 7,
0552     otherRack = 8,
0553 };
0554 UPER_EXTENABLE_ENUM(RoofRackType)
0555 
0556 enum class LoadingDeckType {
0557     unspecified = 0, // TODO see above
0558     upper = 1,
0559     lower = 2,
0560 };
0561 UPER_ENUM(LoadingDeckType)
0562 
0563 /** Car carriage reservation document. */
0564 class CarCarriageReservationData {
0565     UPER_EXTENDABLE_GADGET
0566     UPER_ELEMENT_OPTIONAL(int, trainNum)
0567     UPER_ELEMENT_OPTIONAL(QByteArray, trainIA5)
0568     UPER_ELEMENT_DEFAULT(int, beginLoadingDate, 0)
0569     UPER_ELEMENT_OPTIONAL(int, beginLoadingTime)
0570     UPER_ELEMENT_OPTIONAL(int, endLoadingTime)
0571     UPER_ELEMENT_OPTIONAL(int, loadingUTCOffset)
0572     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0573     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0574     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0575     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0576     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0577     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0578     UPER_ELEMENT_OPTIONAL(int, serviceBrand)
0579     UPER_ELEMENT_OPTIONAL(QString, serviceBrandAbrUTF8)
0580     UPER_ELEMENT_OPTIONAL(QString, serviceBrandNameUTF8)
0581     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUICReservation)
0582     UPER_ELEMENT_OPTIONAL(int, fromStationNum)
0583     UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
0584     UPER_ELEMENT_OPTIONAL(int, toStationNum)
0585     UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
0586     UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
0587     UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
0588     UPER_ELEMENT_OPTIONAL(QByteArray, coach)
0589     UPER_ELEMENT_OPTIONAL(QByteArray, place)
0590     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::CompartmentDetailsType, compartmentDetails)
0591     UPER_ELEMENT_OPTIONAL(QByteArray, numberPlate)
0592     UPER_ELEMENT_OPTIONAL(QByteArray, trailerPlate)
0593     UPER_ELEMENT(int, carCategory)
0594     UPER_ELEMENT_OPTIONAL(int, boatCategory)
0595     UPER_ELEMENT(bool, textileRoof)
0596     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::RoofRackType, roofRackType, norack)
0597     UPER_ELEMENT_OPTIONAL(int, roofRackHeight)
0598     UPER_ELEMENT_OPTIONAL(int, attachedBoats)
0599     UPER_ELEMENT_OPTIONAL(int, attachedBicycles)
0600     UPER_ELEMENT_OPTIONAL(int, attachedSurfboards)
0601     UPER_ELEMENT_OPTIONAL(int, loadingListEntry)
0602     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::LoadingDeckType, loadingDeck, LoadingDeckType::upper)
0603     UPER_ELEMENT_OPTIONAL(QList<int>, carrierNum)
0604     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, carrierIA5)
0605     UPER_ELEMENT(KItinerary::Fcb::TariffType, tariff)
0606     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::PriceTypeType, priceType, travelPrice)
0607     UPER_ELEMENT_OPTIONAL(int, price)
0608     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::VatDetailType>, vatDetail)
0609     UPER_ELEMENT_OPTIONAL(QString, infoText)
0610     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0611     UPER_GADGET_FINALIZE
0612 };
0613 
0614 /** Open ticket document (NRT). */
0615 class OpenTicketData {
0616     UPER_EXTENDABLE_GADGET
0617     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0618     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0619     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0620     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0621     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0622     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0623     UPER_ELEMENT_OPTIONAL(int, extIssuerId)
0624     UPER_ELEMENT_OPTIONAL(int, issuerAutorizationId)
0625     UPER_ELEMENT(bool, returnIncluded)
0626     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0627     UPER_ELEMENT_OPTIONAL(int, fromStationNum)
0628     UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
0629     UPER_ELEMENT_OPTIONAL(int, toStationNum)
0630     UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
0631     UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
0632     UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
0633     UPER_ELEMENT_OPTIONAL(QString, validRegionDesc)
0634     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegionalValidityType>, validRegion)
0635     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ReturnRouteDescriptionType, returnDescription)
0636     UPER_ELEMENT_DEFAULT(int, validFromDay, 0)
0637     UPER_ELEMENT_OPTIONAL(int, validFromTime)
0638     UPER_ELEMENT_OPTIONAL(int, validFromUTCOffset)
0639     UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
0640     UPER_ELEMENT_OPTIONAL(int, validUntilTime)
0641     UPER_ELEMENT_OPTIONAL(int, validUntilUTCOffset)
0642     UPER_ELEMENT_OPTIONAL(QList<int>, activatedDay)
0643     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::TravelClassType, classCode, second)
0644     UPER_ELEMENT_OPTIONAL(QByteArray, serviceLevel)
0645     UPER_ELEMENT_OPTIONAL(QList<int>, carrierNum)
0646     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, carrierIA5)
0647     UPER_ELEMENT_OPTIONAL(QList<int>, includedServiceBrands)
0648     UPER_ELEMENT_OPTIONAL(QList<int>, excludedServiceBrands)
0649     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TariffType>, tariffs)
0650     UPER_ELEMENT_OPTIONAL(int, price)
0651     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::VatDetailType>, vatDetail)
0652     UPER_ELEMENT_OPTIONAL(QString, infoText)
0653     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::IncludedOpenTicketType>, includedAddOns)
0654     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::LuggageRestrictionType, luggage)
0655     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0656     UPER_GADGET_FINALIZE
0657 
0658 public:
0659     Q_INVOKABLE QDateTime validFrom(const QDateTime &issueingDateTime) const;
0660     Q_INVOKABLE QDateTime validUntil(const QDateTime &issueingDateTime) const;
0661 };
0662 
0663 /** Time range. */
0664 class TimeRangeType {
0665     UPER_GADGET
0666     UPER_ELEMENT(int, fromTime)
0667     UPER_ELEMENT(int, untilTime)
0668     UPER_GADGET_FINALIZE
0669 };
0670 
0671 /** Validity time period. */
0672 class ValidityPeriodType {
0673     UPER_GADGET
0674     UPER_ELEMENT_DEFAULT(int, validFromDay, 0)
0675     UPER_ELEMENT_OPTIONAL(int, validFromTime)
0676     UPER_ELEMENT_OPTIONAL(int, validFromUTCOffset)
0677     UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
0678     UPER_ELEMENT_OPTIONAL(int, validUntilTime)
0679     UPER_ELEMENT_OPTIONAL(int, validUntilUTCOffset)
0680     UPER_GADGET_FINALIZE
0681 };
0682 
0683 /** Set of validity time period. */
0684 class ValidityPeriodDetailType {
0685     UPER_GADGET
0686     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::ValidityPeriodDetailType>, validityPeriod)
0687     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TimeRangeType>, excludedTimeRange)
0688     UPER_GADGET_FINALIZE
0689 };
0690 
0691 /** Rail pass document (RPT). */
0692 class PassData {
0693     UPER_EXTENDABLE_GADGET
0694     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0695     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0696     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0697     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0698     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0699     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0700     UPER_ELEMENT_OPTIONAL(int, passType)
0701     UPER_ELEMENT_OPTIONAL(QString, passDescription)
0702     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::TravelClassType, classCode, second)
0703     UPER_ELEMENT_DEFAULT(int, validFromDay, 0)
0704     UPER_ELEMENT_OPTIONAL(int, validFromTime)
0705     UPER_ELEMENT_OPTIONAL(int, validFromUTCOffset)
0706     UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
0707     UPER_ELEMENT_OPTIONAL(int, validUntilTime)
0708     UPER_ELEMENT_OPTIONAL(int, validUntilUTCOffset)
0709     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ValidityPeriodDetailType, validityPeriodDetails)
0710     UPER_ELEMENT_OPTIONAL(int, numberOfValidityDays)
0711     UPER_ELEMENT_OPTIONAL(int, numberOfPossibleTrips)
0712     UPER_ELEMENT_OPTIONAL(int, numberOfDaysOfTravel)
0713     UPER_ELEMENT_OPTIONAL(QList<int>, activatedDay)
0714     UPER_ELEMENT_OPTIONAL(QList<int>, countries)
0715     UPER_ELEMENT_OPTIONAL(QList<int>, includedCarrierNum)
0716     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, includedCarrierIA5)
0717     UPER_ELEMENT_OPTIONAL(QList<int>, excludedCarrierNum)
0718     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, excludedCarrierIA5)
0719     UPER_ELEMENT_OPTIONAL(QList<int>, includedServiceBrands)
0720     UPER_ELEMENT_OPTIONAL(QList<int>, excludedServiceBrands)
0721     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegionalValidityType>, validRegion)
0722     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TariffType>, tariffs)
0723     UPER_ELEMENT_OPTIONAL(int, price)
0724     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::VatDetailType>, vatDetail)
0725     UPER_ELEMENT_OPTIONAL(QString, infoText)
0726     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0727     UPER_GADGET_FINALIZE
0728 
0729 public:
0730     Q_INVOKABLE QDateTime validFrom(const QDateTime &issueingDateTime) const;
0731     Q_INVOKABLE QDateTime validUntil(const QDateTime &issueingDateTime) const;
0732 };
0733 
0734 /** Voucher document. */
0735 class VoucherData {
0736     UPER_EXTENDABLE_GADGET
0737     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0738     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0739     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0740     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0741     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0742     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0743     UPER_ELEMENT(int, validFromYear)
0744     UPER_ELEMENT(int, validFromDay)
0745     UPER_ELEMENT(int, validUntilYear)
0746     UPER_ELEMENT(int, validUntilDay)
0747     UPER_ELEMENT_DEFAULT(int, value, 0)
0748     UPER_ELEMENT_OPTIONAL(int, type)
0749     UPER_ELEMENT_OPTIONAL(QString, infoText)
0750     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0751     UPER_GADGET_FINALIZE
0752 };
0753 
0754 /** Customer card document. */
0755 class CustomerCardData {
0756     UPER_EXTENDABLE_GADGET
0757     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::TravelerType, customer)
0758     UPER_ELEMENT_OPTIONAL(QByteArray, cardIdIA5)
0759     UPER_ELEMENT_OPTIONAL(int, cardIdNum)
0760     UPER_ELEMENT(int, validFromYear)
0761     UPER_ELEMENT_OPTIONAL(int, validFromDay)
0762     UPER_ELEMENT_DEFAULT(int, validUntilYear, 0)
0763     UPER_ELEMENT_OPTIONAL(int, validUntilDay)
0764     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::TravelClassType, classCode)
0765     UPER_ELEMENT_OPTIONAL(int, cardType)
0766     UPER_ELEMENT_OPTIONAL(QString, cardTypeDescr)
0767     UPER_ELEMENT_OPTIONAL(int, customerStatus)
0768     UPER_ELEMENT_OPTIONAL(QByteArray, customerStatusDescr)
0769     UPER_ELEMENT_OPTIONAL(QList<int>, includedServices)
0770     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0771     UPER_GADGET_FINALIZE
0772 };
0773 
0774 /** Countermark document. */
0775 class CountermarkData {
0776     UPER_EXTENDABLE_GADGET
0777     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0778     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0779     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0780     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0781     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0782     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0783     UPER_ELEMENT_OPTIONAL(QByteArray, ticketReferenceIA5)
0784     UPER_ELEMENT_OPTIONAL(int, ticketReferenceNum)
0785     UPER_ELEMENT(int, numberOfCountermark)
0786     UPER_ELEMENT(int, totalOfCountermarks)
0787     UPER_ELEMENT(QString, groupName)
0788     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0789     UPER_ELEMENT_OPTIONAL(int, fromStationNum)
0790     UPER_ELEMENT_OPTIONAL(QByteArray, fromStationIA5)
0791     UPER_ELEMENT_OPTIONAL(int, toStationNum)
0792     UPER_ELEMENT_OPTIONAL(QByteArray, toStationIA5)
0793     UPER_ELEMENT_OPTIONAL(QString, fromStationNameUTF8)
0794     UPER_ELEMENT_OPTIONAL(QString, toStationNameUTF8)
0795     UPER_ELEMENT_OPTIONAL(QString, validRegionDesc)
0796     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegionalValidityType>, validRegion)
0797     UPER_ELEMENT(bool, returnIncluded)
0798     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ReturnRouteDescriptionType, returnDescription)
0799     UPER_ELEMENT_DEFAULT(int, validFromDay, 0)
0800     UPER_ELEMENT_OPTIONAL(int, validFromTime)
0801     UPER_ELEMENT_OPTIONAL(int, validFromUTCOffset)
0802     UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
0803     UPER_ELEMENT_OPTIONAL(int, validUntilTime)
0804     UPER_ELEMENT_OPTIONAL(int, validUntilUTCOffset)
0805     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::TravelClassType, classCode, second)
0806     UPER_ELEMENT_OPTIONAL(QList<int>, carrierNum)
0807     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, carrierIA5)
0808     UPER_ELEMENT_OPTIONAL(QList<int>, includedServiceBrands)
0809     UPER_ELEMENT_OPTIONAL(QList<int>, excludedServiceBrands)
0810     UPER_ELEMENT_OPTIONAL(QString, infoText)
0811     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0812     UPER_GADGET_FINALIZE
0813 };
0814 
0815 /** Parking ground document. */
0816 class ParkingGroundData {
0817     UPER_EXTENDABLE_GADGET
0818     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0819     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0820     UPER_ELEMENT(QByteArray, parkingGroundId)
0821     UPER_ELEMENT(int, fromParkingDate)
0822     UPER_ELEMENT_DEFAULT(int, untilParkingDate, 0)
0823     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0824     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0825     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0826     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0827     UPER_ELEMENT_OPTIONAL(QByteArray, accessCode)
0828     UPER_ELEMENT(QString, location)
0829     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0830     UPER_ELEMENT_OPTIONAL(int, stationNum)
0831     UPER_ELEMENT_OPTIONAL(QString, stationIA5) // yep, actually UTF8String rather than IA5String
0832     UPER_ELEMENT_OPTIONAL(QString, specialInformation)
0833     UPER_ELEMENT_OPTIONAL(QString, entryTrack)
0834     UPER_ELEMENT_OPTIONAL(QByteArray, numberPlate)
0835     UPER_ELEMENT_OPTIONAL(int, price)
0836     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::VatDetailType>, vatDetail)
0837     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0838     UPER_GADGET_FINALIZE
0839 };
0840 
0841 /** FIP ticket document. */
0842 class FIPTicketData {
0843     UPER_EXTENDABLE_GADGET
0844     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0845     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0846     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0847     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0848     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0849     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0850     UPER_ELEMENT_DEFAULT(int, validFromDay, 0)
0851     UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
0852     UPER_ELEMENT_OPTIONAL(QList<int>, activatedDay)
0853     UPER_ELEMENT_OPTIONAL(QList<int>, carrierNum)
0854     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, carrierIA5)
0855     UPER_ELEMENT(int, numberOfTravelDays)
0856     UPER_ELEMENT(bool, includesSupplements)
0857     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::TravelClassType, classCode, second)
0858     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0859     UPER_GADGET_FINALIZE
0860 };
0861 
0862 /** Station passage document. */
0863 class StationPassageData {
0864     UPER_EXTENDABLE_GADGET
0865     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0866     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0867     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0868     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0869     UPER_ELEMENT_OPTIONAL(int, productIdNum)
0870     UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
0871     UPER_ELEMENT_OPTIONAL(QString, productName)
0872     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0873     UPER_ELEMENT_OPTIONAL(QList<int>, stationNum)
0874     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, stationIA5)
0875     UPER_ELEMENT_OPTIONAL(QList<QString>, stationNameUTF8)
0876     UPER_ELEMENT_OPTIONAL(QList<int>, areaCodeNum)
0877     UPER_ELEMENT_OPTIONAL(QList<QByteArray>, areaCodeIA5)
0878     UPER_ELEMENT_OPTIONAL(QList<QString>, areaNameUTF8)
0879     UPER_ELEMENT(int, validFromDay)
0880     UPER_ELEMENT_OPTIONAL(int, validFromTime)
0881     UPER_ELEMENT_OPTIONAL(int, validFromUTCOffset)
0882     UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
0883     UPER_ELEMENT_OPTIONAL(int, validUntilTime)
0884     UPER_ELEMENT_OPTIONAL(int, validUntilUTCOffset)
0885     UPER_ELEMENT_OPTIONAL(int, numberOfDaysValid)
0886     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0887     UPER_GADGET_FINALIZE
0888 };
0889 
0890 enum ConfirmationType {
0891     trainDelayConfirmation = 0,
0892     travelerDelayConfirmation = 1,
0893     trainLinkedTicketDelay = 2,
0894 };
0895 UPER_EXTENABLE_ENUM(ConfirmationType)
0896 
0897 enum TicketType {
0898     openTicket = 0,
0899     pass = 1,
0900     reservation = 2,
0901     carCarriageReservation = 3,
0902 };
0903 UPER_EXTENABLE_ENUM(TicketType)
0904 
0905 enum LinkMode {
0906     issuedTogether = 0,
0907     onlyValidInCombination = 1,
0908 };
0909 UPER_EXTENABLE_ENUM(LinkMode)
0910 
0911 /** */
0912 class TicketLinkType {
0913     UPER_EXTENDABLE_GADGET
0914     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0915     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0916     UPER_ELEMENT_OPTIONAL(QString, issuerName)
0917     UPER_ELEMENT_OPTIONAL(QByteArray, issuerPNR)
0918     UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
0919     UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
0920     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::TicketType, ticketType, openTicket)
0921     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::LinkMode, linkMode, issuedTogether)
0922     UPER_GADGET_FINALIZE
0923 };
0924 
0925 /** Delay confirmation document. */
0926 class DelayConfirmation {
0927     UPER_EXTENDABLE_GADGET
0928     UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
0929     UPER_ELEMENT_OPTIONAL(int, referenceNum)
0930     UPER_ELEMENT_OPTIONAL(int, trainNum)
0931     UPER_ELEMENT_OPTIONAL(QByteArray, trainIA5)
0932     UPER_ELEMENT_OPTIONAL(int, departureYear)
0933     UPER_ELEMENT_OPTIONAL(int, departureDay)
0934     UPER_ELEMENT_OPTIONAL(int, departureTime)
0935     UPER_ELEMENT_OPTIONAL(int, departureUTCOffset)
0936     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::CodeTableType, stationCodeTable, stationUIC)
0937     UPER_ELEMENT_OPTIONAL(int, stationNum)
0938     UPER_ELEMENT_OPTIONAL(QByteArray, stationIA5)
0939     UPER_ELEMENT(int, delay)
0940     UPER_ELEMENT(bool, trainCancelled)
0941     UPER_ELEMENT_DEFAULT(KItinerary::Fcb::ConfirmationType, confirmationType, travelerDelayConfirmation)
0942     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TicketLinkType>, affectedTickets)
0943     UPER_ELEMENT_OPTIONAL(QString, infoText)
0944     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0945     UPER_GADGET_FINALIZE
0946 };
0947 
0948 /** Ticket token. */
0949 class TokenType {
0950     UPER_GADGET
0951     UPER_ELEMENT_OPTIONAL(int, tokenProviderNum)
0952     UPER_ELEMENT_OPTIONAL(QByteArray, tokenProviderIA5)
0953     UPER_ELEMENT_OPTIONAL(QByteArray, tokenSpecification)
0954     UPER_ELEMENT(QByteArray, token)
0955     UPER_GADGET_FINALIZE
0956 };
0957 
0958 /** Variant wrapper for specific document types.
0959  *  Can be one of:
0960  *  - ReservationData
0961  *  - CarCarriageReservationData
0962  *  - OpenTicketData
0963  *  - PassData
0964  *  - VoucherData
0965  *  - CustomerCardData
0966  *  - CountermarkData
0967  *  - ParkingGroundData
0968  *  - FIPTicketData
0969  *  - StationPassageData
0970  *  - ExtensionData
0971  *  - DelayConfirmation
0972  */
0973 class DocumentData {
0974     UPER_EXTENDABLE_GADGET
0975     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::TokenType, token)
0976     UPER_ELEMENT(QVariant, ticket)
0977     UPER_GADGET_FINALIZE
0978 };
0979 
0980 /** Ticket control data. */
0981 class ControlData {
0982     UPER_EXTENDABLE_GADGET
0983     UPER_ELEMENT_OPTIONAL(QList <KItinerary::Fcb::CardReferenceType>, identificationByCardReference)
0984     UPER_ELEMENT(bool, identificationByIdCard)
0985     UPER_ELEMENT(bool, identificationByPassportId)
0986     UPER_ELEMENT_OPTIONAL(int, identificationItem)
0987     UPER_ELEMENT(bool, passportValidationRequired)
0988     UPER_ELEMENT(bool, onlineValidationRequired)
0989     UPER_ELEMENT_OPTIONAL(int, randomDetailedValidationRequired)
0990     UPER_ELEMENT(bool, ageCheckRequired)
0991     UPER_ELEMENT(bool, reductionCardCheckRequired)
0992     UPER_ELEMENT_OPTIONAL(QString, infoText)
0993     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TicketLinkType>, includedTickets)
0994     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
0995     UPER_GADGET_FINALIZE
0996 };
0997 
0998 /** Top-level type for the ERA FCB ticket structure. */
0999 class KITINERARY_EXPORT UicRailTicketData {
1000     UPER_EXTENDABLE_GADGET
1001     UPER_ELEMENT(KItinerary::Fcb::IssuingData, issuingDetail)
1002     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::TravelerData, travelerDetail)
1003     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::DocumentData>, transportDocument)
1004     UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ControlData, controlDetail)
1005     UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::ExtensionData>, extension)
1006     UPER_GADGET_FINALIZE
1007 public:
1008     UicRailTicketData();
1009     UicRailTicketData(const Uic9183Block &block);
1010 
1011     static constexpr const char RecordId[] = "U_FLEX";
1012 
1013     bool isValid() const;
1014 
1015 private:
1016     Uic9183Block m_block;
1017 };
1018 
1019 }
1020 }
1021 
1022 Q_DECLARE_METATYPE(KItinerary::Fcb::ExtensionData)
1023 Q_DECLARE_METATYPE(KItinerary::Fcb::GeoCoordinateType)
1024 Q_DECLARE_METATYPE(KItinerary::Fcb::DeltaCoordinate)
1025 Q_DECLARE_METATYPE(KItinerary::Fcb::IssuingData)
1026 Q_DECLARE_METATYPE(KItinerary::Fcb::TravelerType)
1027 Q_DECLARE_METATYPE(KItinerary::Fcb::CustomerStatusType)
1028 Q_DECLARE_METATYPE(KItinerary::Fcb::TravelerData)
1029 Q_DECLARE_METATYPE(KItinerary::Fcb::TrainLinkType)
1030 Q_DECLARE_METATYPE(KItinerary::Fcb::ViaStationType)
1031 Q_DECLARE_METATYPE(KItinerary::Fcb::ZoneType)
1032 Q_DECLARE_METATYPE(KItinerary::Fcb::LineType)
1033 Q_DECLARE_METATYPE(KItinerary::Fcb::PolygoneType)
1034 Q_DECLARE_METATYPE(KItinerary::Fcb::RegionalValidityType)
1035 Q_DECLARE_METATYPE(KItinerary::Fcb::ReturnRouteDescriptionType)
1036 Q_DECLARE_METATYPE(KItinerary::Fcb::RouteSectionType)
1037 Q_DECLARE_METATYPE(KItinerary::Fcb::SeriesDetailType)
1038 Q_DECLARE_METATYPE(KItinerary::Fcb::PlacesType)
1039 Q_DECLARE_METATYPE(KItinerary::Fcb::CompartmentDetailsType)
1040 Q_DECLARE_METATYPE(KItinerary::Fcb::BerthDetailData)
1041 Q_DECLARE_METATYPE(KItinerary::Fcb::TariffType)
1042 Q_DECLARE_METATYPE(KItinerary::Fcb::VatDetailType)
1043 Q_DECLARE_METATYPE(KItinerary::Fcb::IncludedOpenTicketType)
1044 Q_DECLARE_METATYPE(KItinerary::Fcb::RegisteredLuggageType)
1045 Q_DECLARE_METATYPE(KItinerary::Fcb::LuggageRestrictionType)
1046 Q_DECLARE_METATYPE(KItinerary::Fcb::ReservationData)
1047 Q_DECLARE_METATYPE(KItinerary::Fcb::CarCarriageReservationData)
1048 Q_DECLARE_METATYPE(KItinerary::Fcb::OpenTicketData)
1049 Q_DECLARE_METATYPE(KItinerary::Fcb::TimeRangeType)
1050 Q_DECLARE_METATYPE(KItinerary::Fcb::ValidityPeriodType)
1051 Q_DECLARE_METATYPE(KItinerary::Fcb::ValidityPeriodDetailType)
1052 Q_DECLARE_METATYPE(KItinerary::Fcb::PassData)
1053 Q_DECLARE_METATYPE(KItinerary::Fcb::VoucherData)
1054 Q_DECLARE_METATYPE(KItinerary::Fcb::CustomerCardData)
1055 Q_DECLARE_METATYPE(KItinerary::Fcb::CountermarkData)
1056 Q_DECLARE_METATYPE(KItinerary::Fcb::ParkingGroundData)
1057 Q_DECLARE_METATYPE(KItinerary::Fcb::FIPTicketData)
1058 Q_DECLARE_METATYPE(KItinerary::Fcb::StationPassageData)
1059 Q_DECLARE_METATYPE(KItinerary::Fcb::DelayConfirmation)
1060 Q_DECLARE_METATYPE(KItinerary::Fcb::TokenType)
1061 Q_DECLARE_METATYPE(KItinerary::Fcb::DocumentData)
1062 Q_DECLARE_METATYPE(KItinerary::Fcb::CardReferenceType)
1063 Q_DECLARE_METATYPE(KItinerary::Fcb::TicketLinkType)
1064 Q_DECLARE_METATYPE(KItinerary::Fcb::ControlData)
1065 Q_DECLARE_METATYPE(KItinerary::Fcb::UicRailTicketData)
1066 
1067 #endif // KITINERARY_FCBTICKET_H