import { lexicalEditorWrapper } from '@/lib/utils/lexical.editor'
import { GlobalConfig } from 'payload'

const PrivacyPolicy: GlobalConfig = {
  slug: 'privacy-policy',
  fields: [
    {
      name: 'tabs',
      type: 'array',
      required: true,
      fields: [
        {
          name: 'tab',
          type: 'group',
          fields: [
            {
              name: 'title',
              type: 'text',
              required: true,
              localized: true,
            },
            {
              type: 'array',
              name: 'fields',
              required: true,
              fields: [
                {
                  name: 'title',
                  type: 'text',
                  required: true,
                  localized: true,
                },
                {
                  name: 'description',
                  type: 'richText',
                  editor: lexicalEditorWrapper,
                  required: true,
                  localized: true,
                },
              ],
            },
          ],
        },
      ],
    },
  ],
  admin: {
    group: 'Pages',
  },
  access: {
    read: () => true,
  },
}

export { PrivacyPolicy }
