import { request } from '@/api';

type SettingFormParams = {
  key: string
  value: string
  description: string
}

type SettingListResponse = SettingFormParams & {
  id: number
}

/**
 * 获取设置列表
 * @returns Promise<MenuListResponse> 设置列表数据
 */
export async function getSettingApi(): Promise<SettingListResponse[]> {
  return request.get<SettingListResponse[]>('/setting/getList')
}

/**
 * 添加设置
 * @param params
 * @returns Promise<void>
 */
export async function createSettingApi(params: SettingFormParams): Promise<void> {
  return request.post<void>('/setting/add', params)
}

/**
 * 编辑设置
 * @param params 菜单表单参数（含id）
 * @returns Promise<void>
 */
export async function editSettingApi(params: SettingFormParams): Promise<void> {
  return request.post<void>('/setting/edit', params)
}

