import { api } from './http-client' export interface AppConfigItem { id: string; key: string; value: string; description: string | null; environment: string; updatedAt: string } export interface FeatureFlagItem { id: string; name: string; enabled: boolean; description: string | null; rolloutPct: number; whitelist?: string | null } export interface ChangeLogItem { id: string; entityType: string; entityId: string; field: string; oldValue: string | null; newValue: string | null; changedBy: string | null; createdAt: string } export function getConfig(): Promise<{ configs: AppConfigItem[]; flags: FeatureFlagItem[] }> { return api.get('/admin-api/config') } export function setConfig(key: string, value: string): Promise { return api.post('/admin-api/config', { key, value }) } export function updateConfig(key: string, value: string): Promise { return api.patch(`/admin-api/config/${key}`, { value }) } export function deleteConfig(key: string): Promise { return api.delete(`/admin-api/config/${key}`) } export function toggleFlag(name: string, enabled: boolean): Promise { return api.post(`/admin-api/config/flags/${name}`, { enabled }) } export function setFlagWhitelist(name: string, whitelist: string): Promise { return api.post(`/admin-api/config/flags/${name}`, { whitelist }) } export function getChangeLog(): Promise { return api.get('/admin-api/config/changelog') }