From cbaac44f9628aff428b54412ba689c0a3f610bdf Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 24 Apr 2024 22:11:22 +0100 Subject: [PATCH] Update VSTP Types --- pkg/upstreamApi/cif.go | 15 --------- pkg/upstreamApi/vstp.go | 73 ++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/pkg/upstreamApi/cif.go b/pkg/upstreamApi/cif.go index 389809c..bc3c723 100644 --- a/pkg/upstreamApi/cif.go +++ b/pkg/upstreamApi/cif.go @@ -55,21 +55,6 @@ type JsonScheduleV1 struct { ScheduleSegment CifScheduleSegment `json:"schedule_segment"` } -// VSTP Version of the JsonScheduleV1 type -type JsonScheduleV1vstp struct { - TransactionType string `json:"transaction_type"` - CifBankHolidayRunning string `json:"CIF_bank_holiday_running"` - CifStpIndicator string `json:"CIF_stp_indicator"` - CifTrainUid string `json:"CIF_train_uid"` - ApplicableTimetable string `json:"applicable_timetable"` - AtocCode string `json:"atoc_code"` - NewScheduleSegment ScheduleNewScheduleSegment `json:"new_schedule_segment"` - ScheduleDaysRun string `json:"schedule_days_runs"` - ScheduleStartDate string `json:"schedule_start_date"` - ScheduleEndDate string `json:"schedule_end_date"` - ScheduleSegment []CifScheduleSegment `json:"schedule_segment"` -} - // Part of the JsonScheduleV1 type type ScheduleNewScheduleSegment struct { TractionClass string `json:"traction_class"` diff --git a/pkg/upstreamApi/vstp.go b/pkg/upstreamApi/vstp.go index 18d0cfe..54b3d2d 100644 --- a/pkg/upstreamApi/vstp.go +++ b/pkg/upstreamApi/vstp.go @@ -6,41 +6,60 @@ type MsgData struct { } type VstpMsg struct { - CIFMsg JsonScheduleV1vstp `json:"schedule,omitempty"` + CIFMsg VSTPSchedule `json:"schedule,omitempty"` } -// Redundant Types: -type Schedule struct { - TransactionType string `json:"transaction_type,omitempty"` - ScheduleStartDate string `json:"schedule_start_date,omitempty"` - ScheduleEndDate string `json:"schedule_end_date,omitempty"` - ScheduleDaysRun string `json:"schedule_days_runs,omitempty"` - CIFTrainUID string `json:"CIF_train_uid,omitempty"` - CIFSTPIndicator string `json:"CIF_stp_indicator,omitempty"` - ScheduleSegment []ScheduleSegment `json:"schedule_segment,omitempty"` +// VSTP Version of the JsonScheduleV1 type +type VSTPSchedule struct { + TransactionType string `json:"transaction_type"` + CifBankHolidayRunning string `json:"CIF_bank_holiday_running"` + CifStpIndicator string `json:"CIF_stp_indicator"` + CifTrainUid string `json:"CIF_train_uid"` + ApplicableTimetable string `json:"applicable_timetable"` + ScheduleDaysRun string `json:"schedule_days_runs"` + ScheduleStartDate string `json:"schedule_start_date"` + ScheduleEndDate string `json:"schedule_end_date"` + ScheduleSegment []VSTPScheduleSegment `json:"schedule_segment"` } -type ScheduleSegment struct { - SignallingID string `json:"signalling_id,omitempty"` - ATOCCode string `json:"atoc_code,omitempty"` - CIFTrainCategory string `json:"CIF_train_category,omitempty"` - CIFHeadcode string `json:"CIF_headcode,omitempty"` - CIFPowerType string `json:"CIF_power_type,omitempty"` - CIFSpeed string `json:"CIF_speed,omitempty"` - ScheduleLocation []ScheduleLocation `json:"schedule_location,omitempty"` +// Part of the VSTPSchedule type +type VSTPScheduleSegment struct { + SignallingId string `json:"signalling_id"` + CifTrainCategory string `json:"CIF_train_category"` + CifHeadcode string `json:"CIF_headcode"` + CifCourseIndicator int64 `json:"CIF_course_indicator"` + CifTrainServiceCode string `json:"CIF_train_service_code"` + CifBusinessSector string `json:"CIF_business_sector"` + CifPowerType string `json:"CIF_power_type"` + CifTimingLoad string `json:"CIF_timing_load"` + CifSpeed string `json:"CIF_speed"` + CifOperatingCharacteristics string `json:"CIF_operating_characteristics"` + CifTrainClass string `json:"CIF_train_class"` + CifSleepers string `json:"CIF_sleepers"` + CifReservations string `json:"CIF_reservations"` + CifConnectionIndicator string `json:"CIF_connection_indicator"` + CifCateringCode string `json:"CIF_catering_code"` + CifServiceBranding string `json:"CIF_service_branding"` + ScheduleLocation []CifScheduleLocation `json:"schedule_location"` } -type ScheduleLocation struct { - ScheduledArrivalTime string `json:"scheduled_arrival_time,omitempty"` - ScheduledDepartureTime string `json:"scheduled_departure_time,omitempty"` - ScheduledPassTime string `json:"scheduled_pass_time,omitempty"` - PublicArrivalTime string `json:"public_arrival_time,omitempty"` - PublicDepartureTime string `json:"public_departure_time,omitempty"` - CIFPlatform string `json:"CIF_platform,omitempty"` - CIFLine string `json:"CIF_line,omitempty"` - Tiploc LocationTiploc `json:"location,omitempty"` +// Part of the VSTPScheduleSegment type +type VSTPScheduleLocation struct { + Arrival string `json:"scheduled_arrival_time"` + PublicArrival string `json:"public_arrival_time"` + Departure string `json:"scheduled_departure_time"` + PublicDeparture string `json:"public_departure_time"` + Pass string `json:"scheduled_pass_time"` + Path string `json:"CIF_path"` + Platform string `json:"CIF_platform"` + Line string `json:"CIF_line"` + EngineeringAllowance string `json:"CIF_engineering_allowance"` + PathingAllowance string `json:"CIF_pathing_allowance"` + PerformanceAllowance string `json:"CIF_performance_allowance"` + Location LocationTiploc `json:"location"` } +// Part of the VSTPScheduleLocaiton type type LocationTiploc struct { Tiploc struct { TiplocId string `json:"tiploc_id,omitempty"`