import { api } from './client'

export interface SkillRequires {
  tools: string[]
  mcp_scopes: string[]
}

export interface PromptSkill {
  name: string
  version: string
  description: string
  prompt: string
  requires: SkillRequires
  examples: string[]
  enabled: boolean
}

export const skillsApi = {
  list: () => api.get<{ skills: PromptSkill[] }>('/skills'),
  add: (body: Partial<PromptSkill> & { name: string }) =>
    api.post<{ ok: boolean; skill: PromptSkill }>('/skills', body),
  update: (name: string, body: Partial<PromptSkill>) =>
    api.put<{ ok: boolean; skill: PromptSkill }>(`/skills/${name}`, body),
  remove: (name: string) => api.delete<{ ok: boolean }>(`/skills/${name}`),
}
