import request from '@/utils/request'
import type {
  SceneSlotBundle,
  SceneSlotBundleWithDetails,
  SceneSlotBundleCreateRequest,
  SceneSlotBundleUpdateRequest,
} from '@/types/scene-slot-bundle'

export const sceneSlotBundleApi = {
  list: (status?: string) =>
    request<SceneSlotBundle[]>({
      method: 'GET',
      url: '/admin/scene-slot-bundles',
      params: status ? { status } : {},
    }),

  get: (id: string) =>
    request<SceneSlotBundleWithDetails>({
      method: 'GET',
      url: `/admin/scene-slot-bundles/${id}`,
    }),

  getBySceneKey: (sceneKey: string) =>
    request<SceneSlotBundle>({
      method: 'GET',
      url: `/admin/scene-slot-bundles/by-scene/${sceneKey}`,
    }),

  create: (data: SceneSlotBundleCreateRequest) =>
    request<SceneSlotBundle>({
      method: 'POST',
      url: '/admin/scene-slot-bundles',
      data,
    }),

  update: (id: string, data: SceneSlotBundleUpdateRequest) =>
    request<SceneSlotBundle>({
      method: 'PUT',
      url: `/admin/scene-slot-bundles/${id}`,
      data,
    }),

  delete: (id: string) =>
    request<void>({
      method: 'DELETE',
      url: `/admin/scene-slot-bundles/${id}`,
    }),
}
