import api, { unwrap } from './request';

export interface SystemConfigResp {
  configKey: string;
  configValue?: string;
  configDesc?: string;
  configGroup?: string;
  valueType?: string;
  isEncrypted?: string;
  isEditable?: string;
  updatedAt?: string;
  updatedBy?: number;
}

export const configApi = {
  list:   (group?: string) =>
    unwrap<SystemConfigResp[]>(api.get('/api/system/config', { params: { group } })),
  update: (key: string, value: string) =>
    unwrap<void>(api.put(`/api/system/config/${key}`, { value })),
};
