import { apiClient } from '@/infrastructure/api/api-client';
import type { HookScriptDto } from '@/application/dto/agent-config.dto';

export async function getHooks(): Promise<HookScriptDto[]> {
  return apiClient<HookScriptDto[]>('/api/v1/agent-config/hooks');
}

export async function updateHook(hook: HookScriptDto): Promise<void> {
  await apiClient(`/api/v1/agent-config/hooks/${hook.id}`, {
    method: 'PUT',
    body: hook,
  });
}

export async function createHook(hook: Omit<HookScriptDto, 'id'>): Promise<HookScriptDto> {
  return apiClient<HookScriptDto>('/api/v1/agent-config/hooks', {
    method: 'POST',
    body: hook,
  });
}

export async function deleteHook(hookId: string): Promise<void> {
  await apiClient(`/api/v1/agent-config/hooks/${hookId}`, {
    method: 'DELETE',
  });
}
