import type { Block } from 'payload'

export const AboutProfileBlock: Block = {
  slug: 'aboutProfile',
  labels: { singular: 'About Profile', plural: 'About Profiles' },
  fields: [
    {
      name: 'imagePosition',
      type: 'select',
      label: 'Image position',
      defaultValue: 'left',
      options: [
        { label: 'Left', value: 'left' },
        { label: 'Right', value: 'right' },
      ],
    },
    { name: 'image', type: 'upload', relationTo: 'media', label: 'Image' },
    { name: 'heading', type: 'text', label: 'Heading' },
    { name: 'subheading', type: 'text', label: 'Subheading' },
    { name: 'body', type: 'textarea', label: 'Body text' },
    {
      name: 'primaryButton',
      type: 'group',
      label: 'Primary button (Download CV)',
      fields: [
        { name: 'label', type: 'text', label: 'Label', defaultValue: 'Download CV' },
        { name: 'file', type: 'upload', relationTo: 'media', label: 'Upload CV File' },
      ],
    },
    {
      name: 'secondaryButton',
      type: 'group',
      label: 'Secondary button (Custom)',
      fields: [
        { name: 'label', type: 'text', label: 'Label' },
        { name: 'url', type: 'text', label: 'URL' },
        { name: 'newTab', type: 'checkbox', label: 'Open in new tab', defaultValue: true },
      ],
    },
  ],
}
