import { api } from '@common/services/api';
import type { RescueOpsItem, RescueScenarioItem } from '@interfaces/rescue/RescueInterface';

// ============================================================
// 구조 시나리오 API
// ============================================================

export async function fetchRescueOps(params?: {
  sttsCd?: string;
  acdntTpCd?: string;
  search?: string;
  acdntSn?: number;
}): Promise<RescueOpsItem[]> {
  const response = await api.get<RescueOpsItem[]>('/rescue/ops', { params });
  return response.data;
}

export async function fetchRescueOpsDetail(sn: number): Promise<RescueOpsItem> {
  const response = await api.get<RescueOpsItem>(`/rescue/ops/${sn}`);
  return response.data;
}

export async function fetchRescueScenarios(rescueOpsSn: number): Promise<RescueScenarioItem[]> {
  const response = await api.get<RescueScenarioItem[]>(`/rescue/ops/${rescueOpsSn}/scenarios`);
  return response.data;
}
