import type { Block } from "payload";

export const ProjectDisplayBlock: Block = {
  slug: "projectDisplayBlock",
  interfaceName: "ProjectDisplayBlock",
  fields: [
    {
      type: "row",
      fields: [
        {
          name: "media",
          type: "upload",
          relationTo: "media",
          required: true,
        },
        {
          label: "Project Details",
          type: "group",
          fields: [
            {
              name: "projectName",
              type: "text",
              required: true,
            },
            {
              name: "projectCompany",
              type: "text",
            },
            {
              name: "startDate",
              type: "date",
            },
            {
              name: "endDate",
              type: "date",
              admin: {
                condition: (_, { startDate }) => startDate !== "",
              },
            },
            {
              name: "projectDescription",
              type: "richText",
              required: true,
            },
          ],
        },
      ],
    },
  ],
};
