import type { Field } from 'payload'

export const blockMetaFields: Field[] = [
  {
    name: 'meta',
    type: 'group',
    label: 'Block Settings',
    fields: [
      {
        name: 'backgroundImage',
        type: 'upload',
        relationTo: 'media',
        admin: {
          description: 'Optional background image for the block section.',
        },
      },
      {
        name: 'anchorId',
        type: 'text',
        label: 'Anchor ID',
        admin: { description: 'Used for #hash navigation (e.g. send-request).' },
      },
      {
        name: 'className',
        type: 'text',
        label: 'CSS Classes',
        admin: { description: 'Optional classes applied to this block wrapper.' },
      },
      {
        name: 'dataAttributes',
        type: 'array',
        label: 'Data Attributes',
        admin: { description: 'Key/value pairs rendered as data-* attributes.' },
        fields: [
          { name: 'key', type: 'text', required: true },
          { name: 'value', type: 'text' },
        ],
      },
      {
        name: 'tracking',
        type: 'group',
        label: 'Tracking',
        fields: [
          { name: 'eventName', type: 'text', label: 'Event name (e.g. cta_click)' },
          { name: 'eventPayload', type: 'json', label: 'Event payload (optional)' },
        ],
      },
    ],
  },
]
