import { createRoute } from "../../modules/api-utils/createRoute";
import { apiResponse } from "../../modules/api-utils/apiResponse";
import { ContentfulStatusCode } from "hono/utils/http-status";
import { ValueType } from "../../modules/credentials/credentialTypeDefs";
import { authMiddleware } from "../middleware/authorization";

/* GET /v1/credential/valuetypes */
export default createRoute(
  "get",
  ["/valuetypes"],

  async (c) => {
    const valueTypes = Object.values(ValueType);

    const response = apiResponse.successful(
      "Value Types Fetched Successfully!",
      valueTypes,
    );
    return c.json(response, response.status as ContentfulStatusCode);
  },
  authMiddleware(),
);
