import Router from "koa-router";
import { getForums } from "src/systems/forums";

const router = new Router();

router.get("/", async (ctx) => {
  const {
    query: { language },
  } = ctx;

  ctx.body = await getForums(language as string);
  ctx.status = 200;
});

router.get("/:forumGroup", async (ctx) => {
  const {
    params: { forumGroup },
    query: { language },
  } = ctx;

  ctx.body = await getForums(language as string, forumGroup);
  ctx.status = 200;
});

export default router;
