import type { PluginFastifyInstance } from "types"
import get from "./route.composition.get"
import getAll from "./route.composition.getAll"
import hardDelete from "./route.composition.hardDelete"
import patch from "./route.composition.patch"
import post from "./route.composition.post"
import postBulk from "./route.composition.post.bulk"
import remove from "./route.composition.remove"
import restore from "./route.composition.restore"

const registerRoutes = async (fastify: PluginFastifyInstance) => {
  await fastify.get("/composition/all", getAll(fastify))
  await fastify.get("/composition/:_id", get(fastify))
  await fastify.patch("/composition/:_id", patch(fastify))
  await fastify.patch("/composition/:_id/restore", restore(fastify))
  await fastify.post("/composition", post(fastify))
  await fastify.post("/composition/bulk", postBulk(fastify))
  await fastify.delete("/composition/:_id", remove(fastify))
  await fastify.delete("/composition/:_id/hard", hardDelete(fastify))
}

export default registerRoutes
