import request from '../utils/request'

export interface SystemConfig {
  key: string
  value: string
  description?: string
  id?: number
}

export interface SystemConfigUpdate {
  key: string
  value: string
  description?: string
}

export const getPublicConfigs = () => {
  return request<SystemConfig[]>({
    url: '/system/config/public',
    method: 'get'
  })
}

export const getAllConfigs = () => {
  return request<SystemConfig[]>({
    url: '/system/config/',
    method: 'get'
  })
}

export const updateConfig = (data: SystemConfigUpdate) => {
  return request<SystemConfig>({
    url: '/system/config/',
    method: 'post',
    data
  })
}

