import type { Block } from 'payload'

export const CTABlock: Block = {
  slug: 'cta-block',
  labels: {
    singular: 'Call-to-Action',
    plural: 'Call-to-Actions',
  },
  fields: [
    {
      name: 'headline',
      type: 'text',
      required: true,
      label: 'Überschrift',
      localized: true,
    },
    {
      name: 'description',
      type: 'textarea',
      label: 'Beschreibung',
      localized: true,
    },
    {
      name: 'buttons',
      type: 'array',
      label: 'Buttons',
      maxRows: 2,
      fields: [
        {
          name: 'text',
          type: 'text',
          required: true,
          label: 'Button-Text',
          localized: true,
        },
        {
          name: 'link',
          type: 'text',
          required: true,
          label: 'Link',
        },
        {
          name: 'style',
          type: 'select',
          defaultValue: 'primary',
          label: 'Stil',
          options: [
            { label: 'Primär', value: 'primary' },
            { label: 'Sekundär', value: 'secondary' },
            { label: 'Outline', value: 'outline' },
          ],
        },
      ],
    },
    {
      name: 'backgroundColor',
      type: 'select',
      defaultValue: 'dark',
      label: 'Hintergrundfarbe',
      options: [
        { label: 'Dunkel', value: 'dark' },
        { label: 'Hell', value: 'light' },
        { label: 'Akzent', value: 'accent' },
      ],
    },
  ],
}
