import type { GlobalConfig } from "payload";
import { lexicalEditor } from "@payloadcms/richtext-lexical";

export const About: GlobalConfig = {
  slug: "about",
  access: { read: () => true },
  admin: { group: "Site" },
  fields: [
    {
      name: "intro",
      type: "group",
      fields: [
        { name: "eyebrow", type: "text", defaultValue: "01 // THE ARCHITECT" },
        { name: "headline", type: "text" },
        { name: "subheadline", type: "textarea" },
        { name: "portrait", type: "upload", relationTo: "media" },
      ],
    },
    { name: "bio", type: "richText", editor: lexicalEditor({}) },
    {
      name: "timeline",
      type: "array",
      fields: [
        { name: "year", type: "text", required: true },
        { name: "title", type: "text", required: true },
        { name: "body", type: "textarea" },
        {
          name: "tags",
          type: "array",
          fields: [{ name: "label", type: "text" }],
        },
      ],
    },
    {
      name: "skills",
      type: "array",
      fields: [
        { name: "category", type: "text", required: true },
        {
          name: "items",
          type: "array",
          fields: [{ name: "label", type: "text" }],
        },
      ],
    },
    {
      name: "featuredGear",
      type: "array",
      fields: [{ name: "gear", type: "relationship", relationTo: "gear" }],
    },
  ],
};
