import { Block } from 'payload'

export const ImageWithTextBlock: Block = {
  slug: 'imageWithText',
  labels: {
    singular: {
      de: 'Bild mit Text',
    },
    plural: {
      de: 'Bilder mit Text',
    },
  },
  fields: [
    {
      name: 'title',
      type: 'text',
      required: false,
      label: {
        de: 'Titel',
      },
    },
    {
      name: 'titleColor',
      type: 'select',
      label: {
        de: 'Titelfarbe',
      },
      options: [
        { label: { de: 'Basis' }, value: 'base' },
        { label: { de: 'Kontrast' }, value: 'contrast' },
      ],
      defaultValue: 'base',
      required: true,
    },
    {
      name: 'backgroundColor',
      type: 'select',
      label: {
        de: 'Hintergrundfarbe',
      },
      options: [
        { label: { de: 'Keine' }, value: 'none' },
        { label: { de: 'Soft' }, value: 'soft' },
        { label: { de: 'Off-White' }, value: 'off-white' },
      ],
      defaultValue: 'none',
      required: true,
    },
    {
      name: 'image',
      type: 'upload',
      relationTo: 'media',
      required: true,
      label: {
        de: 'Bild',
      },
    },
    {
      name: 'imagePosition',
      type: 'select',
      label: {
        de: 'Bildposition',
      },
      options: [
        { label: { de: 'Links' }, value: 'left' },
        { label: { de: 'Rechts' }, value: 'right' },
      ],
      defaultValue: 'left',
      required: true,
    },
    {
      name: 'text',
      type: 'richText',
      required: true,
      label: {
        de: 'Text',
      },
    },
  ],
}
