import { defineModule, defineRoute } from "../../shared/define-module"
import type {
  CollectionCheckQuery,
  CollectionCheckResponse,
  CollectionCreateRequest,
  CollectionCreateResponse,
  CollectionDeleteRequest,
  CollectionDeleteResponse,
} from "./types"

/**
 * Collections module definition - Content collections management
 */
export const collectionsModule = defineModule({
  name: "collections",
  prefix: "/collections",
  routes: {
    // Check if entry is in collection
    get: defineRoute<CollectionCheckQuery, CollectionCheckResponse>("GET", "/"),

    // Add entry to collection
    post: defineRoute<CollectionCreateRequest, CollectionCreateResponse>(
      "POST",
      "/",
    ),

    // Remove entry from collection
    delete: defineRoute<CollectionDeleteRequest, CollectionDeleteResponse>(
      "DELETE",
      "/",
    ),
  },
})

// Export the API type
export type CollectionsAPI = typeof collectionsModule.api

// Re-export types for external consumption
export type * from "./types"
