traintrape-moi/client/utils/features/train/trainSlice.ts

108 lines
1.9 KiB
TypeScript
Raw Normal View History

2024-12-11 16:26:36 +00:00
import { createSlice } from '@reduxjs/toolkit'
export interface InterrailLeg {
infoJson?: string
info?: InterrailLegInfo
sortOrder: number
}
export interface InterrailTravel {
date: string
infoJson?: string
info?: InterrailTravelInfo
from: string
to: string
type: number
legs: InterrailLeg[]
}
export interface InterrailJourneyData {
travels: InterrailTravel[]
}
export interface InterrailJourney {
data: InterrailJourneyData
}
export interface InterrailTime {
hours: number
minutes: number
offset: number
}
export interface InterrailDate {
day: number
month: number
year: number
}
export interface InterrailTravelInfo {
arrivalTime: InterrailTime
date: InterrailDate
departureTime: InterrailTime
haconVersion: number
dataSource: number
}
export interface InterrailStopExtraInfo {
departureTime: InterrailTime
index: number
}
export interface InterrailStopCoordinates {
latitude: number
longitude: number
}
export interface InterrailStopStation {
coordinates: InterrailStopCoordinates
country: string
name: string
stationId: number
}
export interface InterrailLegInfo {
attributeCodes: string[]
attributes: object
duration: InterrailTime
directionStation: string
endTime: InterrailTime
isSeparateTicket: boolean
operationDays: string
operator: object
dataSource: number
startTime: InterrailTime
stopExtraInfo: InterrailStopExtraInfo[]
trainName: string
trainStopStations: InterrailStopStation[]
trainType: number
}
export interface TrainTrip {
id: string
distance: number,
from: string,
to: string,
departureTime: Date,
arrivalTime: Date,
}
export interface TrainsState {
trains: TrainTrip[]
}
const initialState: TrainsState = {
trains: []
}
export const trainSlice = createSlice({
name: 'train',
initialState: initialState,
reducers: {
},
})
export const { } = trainSlice.actions
export default trainSlice.reducer