import { ApiResponse, WeatherApi, WeatherData, SettingsData } from "./types.js"; export class MockWeatherApi implements WeatherApi { private response: ApiResponse; private settingsResponse: ApiResponse; private savedValues: Record | null; constructor(response?: ApiResponse, settingsResponse?: ApiResponse) { this.response = response ?? { data: { zipCode: "", samples: [], tempUnit: "F", coldThreshold: 45, hotThreshold: 80, shippingDistance: -1, shippingDays: -1, }, }; this.settingsResponse = settingsResponse ?? { data: { spec: { fields: [] }, values: {}, }, }; this.savedValues = null; } async getWeatherData(tenantId: string, account: string, orderId: string): Promise> { return this.response; } async getSettings(tenantId: string, account: string): Promise> { return this.settingsResponse; } async saveSettings(tenantId: string, account: string, values: Record): Promise> { this.savedValues = values; return { data: {} }; } setResponse(response: ApiResponse): void { this.response = response; } setSettingsResponse(response: ApiResponse): void { this.settingsResponse = response; } getSavedValues(): Record | null { return this.savedValues; } }