import { api } from "@/lib/api-client";
import type { LevelMapping, LevelMappingRow } from "@/types";
import type { ApiSuccessResponse } from "@/types";

export const levelMappingService = {
  get: (entityId: number) => api.get<LevelMapping>(`/entity/${entityId}/level-mapping`),

  update: (entityId: number, mappings: LevelMappingRow[]) =>
    api.put<ApiSuccessResponse>(`/entity/${entityId}/level-mapping`, { mappings }),

  resetToDefault: (entityId: number) =>
    api.post<ApiSuccessResponse>(`/entity/${entityId}/level-mapping/reset`),
};
