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


const FeaturedStudyBlock: Block = {
  slug: 'featuredStudy',
  imageURL: '/admin/blocks/cta-sections.png',
  labels: {
    singular: 'Featured Study',
    plural: 'Featured Studies',
  },

  admin: {
    disableBlockName: true,
    components: {
      Label: '@/payload/fields/CustomBlockLabel',
    },
  },
  fields: [
    {
      name: 'study', // To je ključno polje
      label: 'Study to Feature',
      type: 'relationship',
      relationTo: 'studies', // Povežemo s kolekcijo 'studies'
      required: true,
      // Ta filter bo v adminu prikazal samo objavljene študije
      // da ne izberete pomotoma osnutka.
      filterOptions: {
        status: {
          equals: 'published',
        },
      },
    },
    {
      name: 'style',
      type: 'select',
      admin: {
        position: 'sidebar',
      },
      options: [
        {
          label: 'Light BG',
          value: 'light',
        },
        {
          label: 'Dark BG',
          value: 'dark',
        },
      ],
      defaultValue: 'light',
      required: true,
    },
  ],
}

export default FeaturedStudyBlock;