Files
station-manager-2.0/src/types/vehicles.types.ts
T

89 lines
1.8 KiB
TypeScript

export type VehicleAPIResponse = IVehicleAPI[];
export type VehicleGroupAPIResponse = IVehicleGroup[];
export interface IVehicleAPI {
id: number;
name: string;
type: string;
cabinName?: string;
restrictions?: IVehicleRestrictions;
vehicleGroupsId: number;
hidden: boolean;
}
export interface ICreateVehicleBody {
name: string;
type: string;
cabinName?: string;
restrictions?: IVehicleRestrictions;
vehicleGroupsId: number;
hidden: boolean;
}
export interface IVehicle {
id: number;
name: string;
type: string;
cabinName?: string;
restrictions?: IVehicleRestrictions;
group: IVehicleGroup;
hidden: boolean;
}
export interface IVehicleRestrictions {
sponsorOnly?: number;
teamOnly?: boolean;
}
export interface IVehicleGroupMassSpeeds {
none: number;
passenger: Record<number, number> | null;
cargo: Record<number, number> | null;
}
export interface IVehicleGroup {
id: number;
name: string;
speed: number;
speedLoaded: number | null;
speedLoco: number | null;
length: number;
weight: number;
cargoTypes: IVehicleCargoType[] | null;
locoProps: IVehicleLocoProps | null;
massSpeeds: IVehicleGroupMassSpeeds | null;
_count: { vehicles: number };
}
export interface IVehicleCargoType {
id: string;
weight: number;
}
export interface IVehicleLocoProps {
coldStart: boolean;
doubleManned: boolean;
}
export interface IVehicleTableRow {
vehicleRef: IVehicle;
// pendingChanges: Partial<IVehicle>;
}
export interface IVehicleGroupTableRow {
vehicleGroupRef: IVehicleGroup;
// pendingChanges: Partial<IVehicleGroup>;
}
export enum VehicleEditRowKey {
NAME = 'name',
TYPE = 'type',
CABIN = 'cabinName',
HIDDEN = 'hidden',
}
export enum VehicleEditRestrictionKey {
SPONSOR_ONLY = 'sponsorOnly',
TEAM_ONLY = 'teamOnly',
}