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

export const siteSettingsService = {
    getAll: async (): Promise<SiteSettings[]> => {
        const response = await api.get<SiteSettings[]>("/v1/admin/site-settings")
        return response.data
    },

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

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

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

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