import { NetworkType, StrengthOption, Question } from '../types'; import { apiClient } from './apiClient'; export interface SystemDefaults { NETWORK_TYPES: NetworkType[]; STRENGTH_OPTIONS: StrengthOption[]; QUESTIONS: Question[]; NOTICE_TEMPLATE: string; } export const defaultsService = { // Get system defaults from backend API async getDefaults(): Promise { try { return await apiClient.get('/ops/defaults'); } catch (e) { console.error('Failed to fetch defaults from backend', e); return { NETWORK_TYPES: [], STRENGTH_OPTIONS: [], QUESTIONS: [], NOTICE_TEMPLATE: '', }; } }, // Save new system defaults to backend API async saveDefaults(updatedDefaults: SystemDefaults): Promise { try { await apiClient.put('/ops/defaults', updatedDefaults); } catch (e) { console.error('Failed to save defaults to backend', e); throw e; } }, // Reset system defaults to factory static settings on backend API async resetDefaults(): Promise { try { return await apiClient.post('/ops/defaults/reset'); } catch (e) { console.error('Failed to reset defaults on backend', e); throw e; } } };