package at.procon.eventhub.tachographfilesession.service;

final class DriverCardXmlSamples {

    private DriverCardXmlSamples() {
    }

    static String validDriverCardXml() {
        return """
                <DriverCard>
                  <Identification>
                    <cardIdentification>
                      <cardIssuingMemberState>12</cardIssuingMemberState>
                      <cardNumber>
                        <driverIdentification>123456789012</driverIdentification>
                        <cardReplacementIndex>0</cardReplacementIndex>
                        <cardRenewalIndex>0</cardRenewalIndex>
                      </cardNumber>
                      <cardIssuingAuthorityName>
                        <name>Authority</name>
                      </cardIssuingAuthorityName>
                      <cardIssueDate>2026-04-01T00:00:00Z</cardIssueDate>
                      <cardValidityBegin>2026-04-01T00:00:00Z</cardValidityBegin>
                      <cardExpiryDate>2031-04-01T00:00:00Z</cardExpiryDate>
                    </cardIdentification>
                    <driverCardHolderIdentification>
                      <cardHolderName>
                        <holderSurname><name>Muster</name></holderSurname>
                        <holderFirstNames><name>Max</name></holderFirstNames>
                      </cardHolderName>
                      <cardHolderBirthDate>
                        <year>1985</year>
                        <month>06</month>
                        <day>15</day>
                      </cardHolderBirthDate>
                      <cardHolderPreferredLanguage>de</cardHolderPreferredLanguage>
                    </driverCardHolderIdentification>
                    <signature></signature>
                  </Identification>
                  <DrivingLicenseInfo>
                    <cardDrivingLicenseInformation>
                      <drivingLicenceIssuingAuthority><name>Vienna</name></drivingLicenceIssuingAuthority>
                      <drivingLicenceIssuingNation>12</drivingLicenceIssuingNation>
                      <drivingLicenceNumber>B1234567</drivingLicenceNumber>
                    </cardDrivingLicenseInformation>
                    <signature></signature>
                  </DrivingLicenseInfo>
                  <VehiclesUsed>
                    <cardVehiclesUsed>
                      <vehiclePointerNewestRecord>1</vehiclePointerNewestRecord>
                      <cardVehicleRecords>
                        <vehicleOdometerBegin>1000</vehicleOdometerBegin>
                        <vehicleOdometerEnd>1100</vehicleOdometerEnd>
                        <vehicleFirstUse>2026-04-01T08:00:00Z</vehicleFirstUse>
                        <vehicleLastUse>2026-04-01T11:59:59Z</vehicleLastUse>
                        <vehicleRegistration>
                          <vehicleRegistrationNation>12</vehicleRegistrationNation>
                          <vehicleRegistrationNumber><vehicleRegNumber>W-12345A</vehicleRegNumber></vehicleRegistrationNumber>
                        </vehicleRegistration>
                        <vuDataBlockCounter>0001</vuDataBlockCounter>
                        <vehicleIdentificationNumber>VIN12345678901234</vehicleIdentificationNumber>
                      </cardVehicleRecords>
                      <cardVehicleRecords>
                        <vehicleOdometerBegin>1101</vehicleOdometerBegin>
                        <vehicleOdometerEnd>1200</vehicleOdometerEnd>
                        <vehicleFirstUse>2026-04-01T12:00:00Z</vehicleFirstUse>
                        <vehicleLastUse>2026-04-01T18:00:00Z</vehicleLastUse>
                        <vehicleRegistration>
                          <vehicleRegistrationNation>12</vehicleRegistrationNation>
                          <vehicleRegistrationNumber><vehicleRegNumber>W-54321B</vehicleRegNumber></vehicleRegistrationNumber>
                        </vehicleRegistration>
                        <vuDataBlockCounter>0002</vuDataBlockCounter>
                        <vehicleIdentificationNumber>VIN99999999999999</vehicleIdentificationNumber>
                      </cardVehicleRecords>
                    </cardVehiclesUsed>
                    <signature></signature>
                  </VehiclesUsed>
                  <DriverActivityData>
                    <cardDriverActivity>
                      <activityPointerOldestDayRecord>0</activityPointerOldestDayRecord>
                      <activityPointerNewestRecord>1</activityPointerNewestRecord>
                      <cardActivityDailyRecord>
                        <activityRecordDate>2026-04-01T00:00:00Z</activityRecordDate>
                        <activityDailyPresenceCounter>0001</activityDailyPresenceCounter>
                        <activityDayDistance>200</activityDayDistance>
                        <noOfActivityChanges>3</noOfActivityChanges>
                        <activityChangeInfos>
                          <slot>DRIVER</slot>
                          <drivingStatus>SINGLE</drivingStatus>
                          <cardStatus>INSERTED</cardStatus>
                          <activity>WORK</activity>
                          <timeOfChange>08:00:00Z</timeOfChange>
                        </activityChangeInfos>
                        <activityChangeInfos>
                          <slot>DRIVER</slot>
                          <drivingStatus>SINGLE</drivingStatus>
                          <cardStatus>INSERTED</cardStatus>
                          <activity>DRIVING</activity>
                          <timeOfChange>09:00:00Z</timeOfChange>
                        </activityChangeInfos>
                        <activityChangeInfos>
                          <slot>DRIVER</slot>
                          <drivingStatus>SINGLE</drivingStatus>
                          <cardStatus>INSERTED</cardStatus>
                          <activity>BREAK/REST</activity>
                          <timeOfChange>12:30:00Z</timeOfChange>
                        </activityChangeInfos>
                      </cardActivityDailyRecord>
                    </cardDriverActivity>
                    <signature></signature>
                  </DriverActivityData>
                  <Places>
                    <cardPlaceDailyWorkPeriod>
                      <placeRecords>
                        <entryTime>2026-04-01T08:00:00Z</entryTime>
                        <entryTypeDailyWorkPeriod>0</entryTypeDailyWorkPeriod>
                        <dailyWorkPeriodCountry>12</dailyWorkPeriodCountry>
                        <dailyWorkPeriodRegion>9</dailyWorkPeriodRegion>
                        <vehicleOdometerValue>1000</vehicleOdometerValue>
                        <entryGnssPlaceRecord>
                          <timeStamp>2026-04-01T08:00:00Z</timeStamp>
                          <gnssAccuracy>5</gnssAccuracy>
                          <geoCoordinates>
                            <latitude>48.2082</latitude>
                            <longitude>16.3738</longitude>
                          </geoCoordinates>
                          <authenticationStatus>1</authenticationStatus>
                        </entryGnssPlaceRecord>
                      </placeRecords>
                    </cardPlaceDailyWorkPeriod>
                    <signature></signature>
                  </Places>
                  <SpecificConditions>
                    <specificConditionData>
                      <specificConditionRecord>
                        <entryTime>2026-04-01T10:30:00Z</entryTime>
                        <specificConditionType>3</specificConditionType>
                      </specificConditionRecord>
                    </specificConditionData>
                    <signature></signature>
                  </SpecificConditions>
                  <GnssPlaces>
                    <gnssAccumulatedDriving>
                      <gnssAccumulatedDrivingRecord>
                        <timeStamp>2026-04-01T09:30:00Z</timeStamp>
                        <gnssPlaceRecord>
                          <timeStamp>2026-04-01T09:30:00Z</timeStamp>
                          <gnssAccuracy>4</gnssAccuracy>
                          <geoCoordinates>
                            <latitude>48.2000</latitude>
                            <longitude>16.3600</longitude>
                          </geoCoordinates>
                          <authenticationStatus>1</authenticationStatus>
                        </gnssPlaceRecord>
                        <vehicleOdometerValue>1050</vehicleOdometerValue>
                      </gnssAccumulatedDrivingRecord>
                    </gnssAccumulatedDriving>
                    <signature></signature>
                  </GnssPlaces>
                  <BorderCrossings>
                    <cardBorderCrossings>
                      <cardBorderCrossingRecord>
                        <countryLeft>12</countryLeft>
                        <countryEntered>56</countryEntered>
                        <gnssPlaceAuthRecord>
                          <timeStamp>2026-04-01T12:15:00Z</timeStamp>
                          <gnssAccuracy>4</gnssAccuracy>
                          <geoCoordinates>
                            <latitude>48.3000</latitude>
                            <longitude>16.5000</longitude>
                          </geoCoordinates>
                          <authenticationStatus>0</authenticationStatus>
                        </gnssPlaceAuthRecord>
                        <vehicleOdometerValue>1120</vehicleOdometerValue>
                      </cardBorderCrossingRecord>
                    </cardBorderCrossings>
                    <signature></signature>
                  </BorderCrossings>
                  <LoadUnloadOperations>
                    <cardLoadUnloadOperations>
                      <cardLoadUnloadRecord>
                        <timeStamp>2026-04-01T12:45:00Z</timeStamp>
                        <operationType>2</operationType>
                        <gnssPlaceAuthRecord>
                          <timeStamp>2026-04-01T12:45:00Z</timeStamp>
                          <gnssAccuracy>3</gnssAccuracy>
                          <geoCoordinates>
                            <latitude>48.3100</latitude>
                            <longitude>16.5100</longitude>
                          </geoCoordinates>
                          <authenticationStatus>1</authenticationStatus>
                        </gnssPlaceAuthRecord>
                        <vehicleOdometerValue>1130</vehicleOdometerValue>
                      </cardLoadUnloadRecord>
                    </cardLoadUnloadOperations>
                    <signature></signature>
                  </LoadUnloadOperations>
                </DriverCard>
                """;
    }

    static String validDriverCardXmlWithLocalActivityTimes() {
        return validDriverCardXml()
                .replace("<timeOfChange>08:00:00Z</timeOfChange>", "<timeOfChange>08:00:00</timeOfChange>")
                .replace("<timeOfChange>09:00:00Z</timeOfChange>", "<timeOfChange>09:00:00</timeOfChange>")
                .replace("<timeOfChange>12:30:00Z</timeOfChange>", "<timeOfChange>12:30:00</timeOfChange>");
    }

    static String driverCardXmlWithOpenVehicleUseRecord() {
        return validDriverCardXml()
                .replace("<vehicleLastUse>2026-04-01T18:00:00Z</vehicleLastUse>\n", "");
    }
}
