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

export const serviceTitleService = {
    getAll: async (): Promise<ServiceTitle[]> => {
        const response = await api.get<ServiceTitle[]>("/v1/admin/service-titles")
        return response.data
    },

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

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

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

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