import type { Block } from 'payload'
//import CustomLabel from '@/components/admin/CustomLabel';


const CallToActionBlock: Block = {
  slug: 'cta',
  imageURL: '/admin/blocks/cta-sections.png',
  labels: {
    singular: 'Call to Action',
    plural: 'Call to Actions',
  },

  admin: {
    disableBlockName: true,
    components: {
      Label: '@/payload/fields/CustomBlockLabel',
    },
  },
  fields: [
    {
      name: 'naslov',
      type: 'textarea',
      required: true,
    },
    {
      name: 'message',
      type: 'textarea',
      required: true,
    },
    {
      name: 'image',
      type: 'upload',
      relationTo: 'media',
    },
    {
      name: 'buttons',
      type: 'array',
      fields: [
        {
          name: 'label',
          type: 'text',
          required: true,
        },
        {
          name: 'url',
          type: 'text',
          required: true,
        },
        {
          name: 'style',
          type: 'select',
          options: ['primary', 'secondary'],
          defaultValue: 'primary',
        },
      ],
    },
    {
      name: 'type',
      type: 'select',
      admin: {
        position: 'sidebar',
      },
      options: [
        {
          label: 'Big',
          value: 'big',
        },
        {
          label: 'Small',
          value: 'small',
        },
        {
          label: 'News',
          value: 'news',
        },
      ],
      defaultValue: 'big',
      required: true,
    },
  ],
}

export default CallToActionBlock;