import { Block } from 'payload'
import { validateHref } from '@/globals/ValidateHref'

export const NextPrevButtonsBlock: Block = {
  slug: 'nextPrevButtons',
  labels: {
    singular: {
      de: 'Zurück-/Weiter-Buttons',
    },
    plural: {
      de: 'Zurück-/Weiter-Buttons',
    },
  },
  fields: [
    {
      name: 'prev',
      type: 'group',
      label: {
        de: 'Zurück',
      },
      fields: [
        {
          name: 'text',
          type: 'text',
          label: {
            de: 'Text',
          },
        },
        {
          name: 'href',
          type: 'text',
          label: {
            de: 'Zieladresse',
          },
          validate: validateHref,
        },
      ],
    },
    {
      name: 'next',
      type: 'group',
      label: {
        de: 'Weiter',
      },
      fields: [
        {
          name: 'text',
          type: 'text',
          label: {
            de: 'Text',
          },
        },
        {
          name: 'href',
          type: 'text',
          label: {
            de: 'Zieladresse',
          },
          validate: validateHref,
        },
      ],
    },
  ],
}