import { CollectionConfig } from 'payload'
import { isAdminOrEmployee } from '@/collections/access/admin'

export const Testimony: CollectionConfig = {
  slug: 'testimony',
  labels: {
    singular: {
      de: 'Zeugnis',
    },
    plural: {
      de: 'Zeugnisse',
    },
  },
  fields: [
    {
      name: 'testimony',
      label: {
        de: 'Zeugnis',
      },
      type: 'textarea',
      required: true,
    },
    {
      name: 'name',
      label: {
        de: 'Name',
      },
      type: 'text',
      required: true,
    },
    {
      name: 'occupation',
      label: {
        de: 'Beschäftigung',
      },
      type: 'text',
      required: false,
    },
    {
      name: 'category',
      label: {
        de: 'Kategorie',
      },
      type: 'select',
      options: [
        {
          value: 'EUCHARIST',
          label: 'Eucharistie',
        },
      ],
      required: true,
    },
  ],
  access: {
    read: () => true,
    create: isAdminOrEmployee(),
    update: isAdminOrEmployee(),
    delete: isAdminOrEmployee(),
  },
}
