import { api } from "@/lib/api"
import type { Resume } from "@/types/api"

export const resumeService = {
    getAll: async (): Promise<Resume[]> => {
        const response = await api.get<Resume[]>("/v1/admin/resumes")
        return response.data
    },

    getById: async (id: string): Promise<Resume> => {
        const response = await api.get<Resume>(`/v1/admin/resumes/${id}`)
        return response.data
    },

    create: async (data: Partial<Resume>): Promise<Resume> => {
        const response = await api.post<Resume>("/v1/admin/resumes", data)
        return response.data
    },

    update: async (id: string, data: Partial<Resume>): Promise<Resume> => {
        const response = await api.put<Resume>(`/v1/admin/resumes/${id}`, data)
        return response.data
    },

    delete: async (id: string): Promise<void> => {
        await api.delete(`/v1/admin/resumes/${id}`)
    }
}
