import { createRoute } from "../../modules/api-utils/createRoute";
import { apiResponse } from "../../modules/api-utils/apiResponse";
import { ContentfulStatusCode } from "hono/utils/http-status";
import { authMiddleware } from "../middleware/authorization";
import { PERMISSION_NODES } from "../../types/PermissionNodes";

/* /v1/permissions */
export default createRoute(
  "get",
  ["/"],

  async (c) => {
    const response = apiResponse.successful(
      "Permission Nodes Fetched Successfully!",
      PERMISSION_NODES,
    );
    return c.json(response, response.status as ContentfulStatusCode);
  },
  authMiddleware({ permissions: ["role.read"] }),
);
