import type { GlobalConfig } from "payload";

export const Home: GlobalConfig = {
  slug: "home",
  access: { read: () => true },
  admin: { group: "Site" },
  fields: [
    {
      name: "hero",
      type: "group",
      fields: [
        { name: "eyebrow", type: "text", defaultValue: "01 // THE MANIFESTO" },
        { name: "headline", type: "text" },
        { name: "subheadline", type: "textarea" },
        {
          name: "primaryCta",
          type: "group",
          fields: [
            { name: "label", type: "text" },
            { name: "href", type: "text" },
          ],
        },
        {
          name: "secondaryCta",
          type: "group",
          fields: [
            { name: "label", type: "text" },
            { name: "href", type: "text" },
          ],
        },
        { name: "heroImage", type: "upload", relationTo: "media" },
      ],
    },
    {
      name: "principles",
      type: "array",
      fields: [
        { name: "code", type: "text" },
        { name: "title", type: "text", required: true },
        { name: "body", type: "textarea" },
        {
          name: "accent",
          type: "select",
          defaultValue: "primary",
          options: [
            { label: "Primary", value: "primary" },
            { label: "Secondary", value: "secondary" },
            { label: "Tertiary", value: "tertiary" },
          ],
        },
      ],
    },
    {
      name: "featuredProjects",
      type: "array",
      fields: [
        { name: "project", type: "relationship", relationTo: "projects" },
      ],
    },
    {
      name: "closingCta",
      type: "group",
      fields: [
        { name: "eyebrow", type: "text" },
        { name: "headline", type: "text" },
        { name: "body", type: "textarea" },
        {
          name: "cta",
          type: "group",
          fields: [
            { name: "label", type: "text" },
            { name: "href", type: "text" },
          ],
        },
      ],
    },
  ],
};
