import { SkillDetail, SkillItem } from '@/pages/SkillManager/data';
import { request } from '@umijs/max';

export async function querySkillList(params?: {
  type?: string;
  keyword?: string;
  current?: number;
  pageSize?: number;
}) {
  return request<{ data: SkillItem[]; total: number }>('/api/skills', {
    method: 'GET',
    params,
  });
}

export async function getSkillDetail(id: string) {
  return request<{ data: SkillDetail }>(`/api/skills/${id}`, {
    method: 'GET',
  });
}

export async function updateSkillStatus(id: string, isEnabled: boolean) {
  return request(`/api/skills/${id}/status`, {
    method: 'POST',
    data: { isEnabled },
  });
}
