import { apiGet, apiPost } from '@/lib/http'
import type {
  AdminAgisoMessagingDefaults,
  AdminAgisoObservedShopItem,
  AdminAgisoShopConfigItem,
} from '@/types/admin'

export function fetchAdminAgisoShopConfigs() {
  return apiGet<{
    filePath: string
    defaults: AdminAgisoMessagingDefaults
    shops: AdminAgisoShopConfigItem[]
    observedShops: AdminAgisoObservedShopItem[]
  }>('/api/v1/admin/platform-config/agiso-shops')
}

export function saveAdminAgisoShopConfigs(payload: {
  defaults: AdminAgisoMessagingDefaults
  shops: Array<Record<string, unknown>>
}) {
  return apiPost<{
    filePath: string
    defaults: AdminAgisoMessagingDefaults
    shops: AdminAgisoShopConfigItem[]
  }>('/api/v1/admin/platform-config/agiso-shops', payload)
}
