import formatSlug from "@/utils/payload/formatSlug";
import type { CollectionConfig } from "payload";

export const BlogTags: CollectionConfig = {
  slug: "blogTags",
  labels: { plural: "Tags", singular: "Tag" },
  fields: [
    {
      name: "name",
      type: "text",
      required: true,
    },
    {
      name: "slug",
      type: "text",
      admin: {
        position: "sidebar",
      },
      hooks: {
        beforeValidate: [formatSlug("name")],
      },
    },
    {
      name: "description",
      type: "textarea",
    },
  ],
  admin: {
    hideAPIURL: true,
    group: "Blogs",
  },
};
