import { GetterRepository } from "./GetterRepository"; import { IEta, IOrderedStop, IRoute } from "../entities/entities"; interface ApiBasedRepositoryCache { etasForShuttleId: { [shuttleId: string]: IEta[], }, etasForStopId: { [stopId: string]: IEta[], }, // To speed things up, implement caches for other data later } export class ApiBasedRepository implements GetterRepository { private cache: ApiBasedRepositoryCache; constructor(initialCache: ApiBasedRepositoryCache | undefined = undefined) { if (initialCache) { this.cache = initialCache; } else { this.cache = { etasForShuttleId: {}, etasForStopId: {}, } } } public async getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise { return null; } public async getEtasForShuttleId(shuttleId: string): Promise<[]> { return []; } public async getEtasForStopId(stopId: string): Promise<[]> { return []; } // TODO: migrate rest of logic over to this class public async getOrderedStopByRouteAndStopId(routeId: string, stopId: string): Promise<| null> { return null; } public async getOrderedStopsByRouteId(routeId: string): Promise<[]> { return Promise.resolve([]); } public async getOrderedStopsByStopId(stopId: string): Promise<[]> { return Promise.resolve([]); } public async getRouteById(routeId: string): Promise<| null> { return Promise.resolve(null); } public async getRoutesBySystemId(systemId: string): Promise<[]> { return Promise.resolve([]); } public async getShuttleById(shuttleId: string): Promise<| null> { return Promise.resolve(null); } public async getShuttlesByRouteId(routeId: string): Promise<[]> { return Promise.resolve([]); } public async getShuttlesBySystemId(systemId: string): Promise<[]> { return Promise.resolve([]); } public async getStopById(stopId: string): Promise<| null> { return null; } public async getStopsBySystemId(systemId: string): Promise<[]> { return []; } public async getSystemById(systemId: string): Promise<| null> { return null; } public async getSystems(): Promise<[]> { return Promise.resolve([]); } }