import { lexicalEditor } from '@payloadcms/richtext-lexical';
import type { Block } from 'payload';

const FeaturesBlockCentered: Block = {
  slug: 'featuresCentered',
  imageURL: '/admin/blocks/feature-sections.png',
  labels: {
    singular: 'Features Block Centered',
    plural: 'Features Blocks Centered',
  },
  fields: [
    {
      name: 'title',
      type: 'text',
      required: true,
    },
    {
      name: 'description',
      type: 'richText',
      editor: lexicalEditor({}),
    },
    {
      name: 'features',
      type: 'array',
      fields: [
        {
          name: 'title',
          type: 'text',
          required: true,
        },
        {
          name: 'description',
          type: 'textarea',
        },
        {
          name: 'image',
          type: 'upload',
          relationTo: 'media',
        },
        {
          name: 'url',
          type: 'text',
          required: false,
        },

      ],
    },
     {
      name: 'grid',
      type: 'text',
      required: true,
      defaultValue: '3',
    },
    {
      name: 'style',
      type: 'select',
      options: [
        {
          label: 'BG1',
          value: 'bg1',
        },
        {
          label: 'BG2',
          value: 'bg2',
        },
      ],
      defaultValue: 'bg1',
      required: true,
    },
  ],
};

export default FeaturesBlockCentered;