<commit_before>package siri

import (
	"bytes"
	"text/template"
	"time"

	"github.com/af83/edwig/model"
)

type SIRIEstimatedTimeTableResponse struct {
	Address                   string
	ProducerRef               string
	RequestMessageRef         string
	ResponseMessageIdentifier string

	ResponseTimestamp time.Time

	Status      bool
	ErrorType   string
	ErrorNumber int
	ErrorText   string

	EstimatedJourneyVersionFrames []SIRIEstimatedJourneyVersionFrame
}

type SIRIEstimatedJourneyVersionFrame struct {
	RecordedAtTime time.Time

	EstimatedVehicleJourneys []SIRIEstimatedVehicleJourney
}

type SIRIEstimatedVehicleJourney struct {
	LineRef                string
	DatedVehicleJourneyRef string

	Attributes map[string]string
	References map[string]model.Reference

	EstimatedCalls []SIRIEstimatedCall
}

type SIRIEstimatedCall struct {
	ArrivalStatus   string
	DepartureStatus string
	StopPointRef    string

	Order int

	AimedArrivalTime    time.Time
	ExpectedArrivalTime time.Time
	ActualArrivalTime   time.Time

	AimedDepartureTime    time.Time
	ExpectedDepartureTime time.Time
	ActualDepartureTime   time.Time
}

const estimatedTimeTableResponseTemplate = `<ns8:GetEstimatedTimetableResponse xmlns:ns3="http://www.siri.org.uk/siri"
																	 xmlns:ns4="http://www.ifopt.org.uk/acsb"
																	 xmlns:ns5="http://www.ifopt.org.uk/ifopt"
																	 xmlns:ns6="http://datex2.eu/schema/2_0RC1/2_0"
																	 xmlns:ns7="http://scma/siri"
																	 xmlns:ns8="http://wsdl.siri.org.uk"
																	 xmlns:ns9="http://wsdl.siri.org.uk/siri">
	<ServiceDeliveryInfo>
		<ns3:ResponseTimestamp>{{ .ResponseTimestamp.Format "2006-01-02T15:04:05.000Z07:00" }}</ns3:ResponseTimestamp>
		<ns3:ProducerRef>{{ .ProducerRef }}</ns3:ProducerRef>
		<ns3:Address>{{ .Address }}</ns3:Address>
		<ns3:ResponseMessageIdentifier>{{ .ResponseMessageIdentifier }}</ns3:ResponseMessageIdentifier>
		<ns3:RequestMessageRef>{{ .RequestMessageRef }}</ns3:RequestMessageRef>
	</ServiceDeliveryInfo>
	<Answer>
		<ns3:EstimatedTimetableDelivery version="2.0:FR-IDF-2.4">
			<ns3:ResponseTimestamp>{{ .ResponseTimestamp.Format "2006-01-02T15:04:05.000Z07:00" }}</ns3:ResponseTimestamp>
			<ns3:RequestMessageRef>{{ .RequestMessageRef }}</ns3:RequestMessageRef>
			<ns3:Status>{{ .Status }}</ns3:Status>{{ if not .Status }}
			<ns3:ErrorCondition>{{ if eq .ErrorType "OtherError" }}
				<ns3:OtherError number="{{.ErrorNumber}}">{{ else }}
				<ns3:{{.ErrorType}}><commit_msg>fix ETT template<commit_after>package siri

import (
	"bytes"
	"text/template"
	"time"

	"github.com/af83/edwig/model"
)

type SIRIEstimatedTimeTableResponse struct {
	Address                   string
	ProducerRef               string
	RequestMessageRef         string
	ResponseMessageIdentifier string

	ResponseTimestamp time.Time

	Status      bool
	ErrorType   string
	ErrorNumber int
	ErrorText   string

	EstimatedJourneyVersionFrames []SIRIEstimatedJourneyVersionFrame
}

type SIRIEstimatedJourneyVersionFrame struct {
	RecordedAtTime time.Time

	EstimatedVehicleJourneys []SIRIEstimatedVehicleJourney
}

type SIRIEstimatedVehicleJourney struct {
	LineRef                string
	DatedVehicleJourneyRef string

	Attributes map[string]string
	References map[string]model.Reference

	EstimatedCalls []SIRIEstimatedCall
}

type SIRIEstimatedCall struct {
	ArrivalStatus   string
	DepartureStatus string
	StopPointRef    string

	Order int

	AimedArrivalTime    time.Time
	ExpectedArrivalTime time.Time
	ActualArrivalTime   time.Time

	AimedDepartureTime    time.Time
	ExpectedDepartureTime time.Time
	ActualDepartureTime   time.Time
}

const estimatedTimeTableResponseTemplate = `<ns8:GetEstimatedTimetableResponse xmlns:ns3="http://www.siri.org.uk/siri"
																	 xmlns:ns4="http://www.ifopt.org.uk/acsb"
																	 xmlns:ns5="http://www.ifopt.org.uk/ifopt"
																	 xmlns:ns6="http://datex2.eu/schema/2_0RC1/2_0"
																	 xmlns:ns7="http://scma/siri"
																	 xmlns:ns8="http://wsdl.siri.org.uk"
																	 xmlns:ns9="http://wsdl.siri.org.uk/siri">
	<ServiceDeliveryInfo>
		<ns3:ResponseTimestamp>{{ .ResponseTimestamp.Format "2006-01-02T15:04:05.000Z07:00" }}</ns3:ResponseTimestamp>
		<ns3:ProducerRef>{{ .ProducerRef }}</ns3:ProducerRef>{{ if .Address }}
		<ns3:Address>{{ .Address }}</ns3:Address>{{ end }}
		<ns3:ResponseMessageIdentifier>{{ .ResponseMessageIdentifier }}</ns3:ResponseMessageIdentifier>
		<ns3:RequestMessageRef>{{ .RequestMessageRef }}</ns3:RequestMessageRef>
	</ServiceDeliveryInfo>
	<Answer>
		<ns3:EstimatedTimetableDelivery version="2.0:FR-IDF-2.4">
			<ns3:ResponseTimestamp>{{ .ResponseTimestamp.Format "2006-01-02T15:04:05.000Z07:00" }}</ns3:ResponseTimestamp>
			<ns3:RequestMessageRef>{{ .RequestMessageRef }}</ns3:RequestMessageRef>
			<ns3:Status>{{ .Status }}</ns3:Status>{{ if not .Status }}
			<ns3:ErrorCondition>{{ if eq .ErrorType "OtherError" }}
				<ns3:OtherError number="{{.ErrorNumber}}">{{ else }}
				<ns3:{{.ErrorType}}>
{'fraction_non_alphanumeric': 0.11864406779661017, 'fraction_numerical': 0.032701894317048855, 'mean_word_length': 4.041206030150754, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1064768', 'n_tokens_mistral': 2029, 'n_tokens_neox': 1684, 'n_words': 256}