import { getTemplatePath, getTemplateSync } from "@opengis/fastify-table/utils.js";

const arr = getTemplatePath('map') || [];

const list = arr.map(el => {
    const { name = el[0] } = getTemplateSync('map', el[0]);
    return { name, slug: el[0] };
});

export default async function mapList(req, reply) {
    if (!arr.length) {
        return reply.status(200).send([]);
    }

    return reply.status(200).send(list);
}