import { revalidateTag } from 'next/cache'
import { type GlobalConfig } from 'payload'

export const Footer: GlobalConfig = {
  slug: 'footer',
  fields: [
    {
      name: 'tiktok',
      type: 'text',
      label: 'TikTok',
      required: false,
    },
    {
      name: 'instagram',
      type: 'text',
      label: 'Instagram',
      required: false,
    },
    {
      name: 'facebook',
      type: 'text',
      label: 'Facebook',
      required: false,
    },
    {
      name: 'telegram',
      type: 'text',
      label: 'Telegram',
      required: false,
    },
    {
      name: 'whatsapp',
      type: 'text',
      label: 'WhatsApp',
      required: false,
    },
    {
      name: 'youtube',
      type: 'text',
      label: 'YouTube',
      required: false,
    },
  ],
  hooks: {
    afterChange: [
      () => {
        revalidateTag('global_footer')
      },
    ],
  },
}
