/** * Service Configuration Utilities * Provides reusable configuration patterns for all API services */ import { API_ENDPOINTS } from '@/lib/api-config'; /** * Default service configuration * Provides consistent settings across all services */ export const createServiceConfig = (endpoint: string) => ({ basePath: endpoint, enableLogging: import.meta.env.DEV, }); /** * Pre-configured service configs for common endpoints * Eliminates repetitive constructor code */ export const SERVICE_CONFIGS = { ORGANIZATIONS: createServiceConfig(API_ENDPOINTS.ORGANIZATIONS), SITES: createServiceConfig(API_ENDPOINTS.SITES), MATCHING: createServiceConfig(API_ENDPOINTS.MATCHING), ANALYTICS: createServiceConfig(API_ENDPOINTS.ANALYTICS), HERITAGE: createServiceConfig(API_ENDPOINTS.HERITAGE), AI: createServiceConfig(API_ENDPOINTS.AI), PROPOSALS: createServiceConfig(API_ENDPOINTS.PROPOSALS), } as const; /** * Type-safe service config getter */ export const getServiceConfig = (endpoint: keyof typeof SERVICE_CONFIGS) => SERVICE_CONFIGS[endpoint]; /** * Common service options interface */ export interface ServiceOptions { basePath: string; enableLogging?: boolean; defaultTimeout?: number; retries?: number; }