import type { Field } from 'payload' import { formularUploadContent } from '@/spa/formularUploadContent' const text = (name: string, label: string, defaultValue?: string): Field => ({ name, type: 'text', label, defaultValue, }) const textarea = (name: string, label: string, defaultValue?: string): Field => ({ name, type: 'textarea', label, defaultValue, }) const sectionAdmin = (description: string) => ({ description, initCollapsed: true, }) export const formularUploadFields: Field[] = [ { name: 'formUpload', label: 'Form upload page content', type: 'group', admin: { description: 'Edit the Formular hochladen page copy in frontend order. Upload interaction remains handled by the SPA component.', }, fields: [ { name: 'hero', label: '01 · Hero', type: 'group', admin: sectionAdmin('Top eyebrow, heading, intro copy, and stat row.'), fields: [ text('eyebrow', 'Eyebrow', formularUploadContent.hero.eyebrow), textarea('heading', 'Heading', formularUploadContent.hero.heading), textarea('description', 'Description', formularUploadContent.hero.description), { name: 'stats', label: 'Stats', type: 'array', dbName: 'upload_stats', defaultValue: formularUploadContent.hero.stats, fields: [text('num', 'Value'), text('label', 'Label')], }, ], }, { name: 'breadcrumb', label: '02 · Breadcrumb', type: 'group', admin: sectionAdmin('Small route label below the hero.'), fields: [text('label', 'Label', formularUploadContent.breadcrumb.label)], }, { name: 'requirements', label: '03 · Requirements', type: 'group', admin: sectionAdmin('Requirement cards above the upload area.'), fields: [ text('eyebrow', 'Eyebrow', formularUploadContent.requirements.eyebrow), textarea('heading', 'Heading', formularUploadContent.requirements.heading), { name: 'cards', label: 'Cards', type: 'array', dbName: 'upload_req_cards', defaultValue: formularUploadContent.requirements.cards, fields: [ { name: 'icon', label: 'Icon', type: 'select', defaultValue: 'fileText', options: [ { label: 'File text', value: 'fileText' }, { label: 'Clock', value: 'clock' }, { label: 'Shield', value: 'shield' }, ], }, text('title', 'Title'), textarea('items', 'Items, one per line'), ], }, ], }, { name: 'upload', label: '04 · Upload area', type: 'group', admin: sectionAdmin('Dropzone labels, accepted format chips, note card, submit labels, and privacy note.'), fields: [ text('eyebrow', 'Eyebrow', formularUploadContent.upload.eyebrow), textarea('heading', 'Heading', formularUploadContent.upload.heading), text('dropTitle', 'Dropzone title', formularUploadContent.upload.dropTitle), text('dropDescription', 'Dropzone description', formularUploadContent.upload.dropDescription), textarea('acceptedFormats', 'Accepted format chips, one per line', formularUploadContent.upload.acceptedFormats), text('fileRemoveLabel', 'Remove-file aria label', formularUploadContent.upload.fileRemoveLabel), text('noteTitle', 'Note title', formularUploadContent.upload.noteTitle), textarea('note', 'Note', formularUploadContent.upload.note), text('selectedSubmitPrefix', 'Selected submit singular word', formularUploadContent.upload.selectedSubmitPrefix), text('selectedSubmitPluralSuffix', 'Selected submit plural suffix', formularUploadContent.upload.selectedSubmitPluralSuffix), text('selectedSubmitAction', 'Selected submit action', formularUploadContent.upload.selectedSubmitAction), text('emptySubmitLabel', 'Empty submit label', formularUploadContent.upload.emptySubmitLabel), textarea('privacyNote', 'Privacy note', formularUploadContent.upload.privacyNote), ], }, { name: 'success', label: '05 · Success state', type: 'group', admin: sectionAdmin('Confirmation copy shown after simulated upload completion.'), fields: [ text('heading', 'Heading', formularUploadContent.success.heading), textarea('description', 'Description', formularUploadContent.success.description), text('linkLabel', 'Link label', formularUploadContent.success.linkLabel), text('linkUrl', 'Link URL', formularUploadContent.success.linkUrl), ], }, { name: 'cta', label: '06 · Bottom CTA', type: 'group', admin: sectionAdmin('Bottom question prompt and navigation links.'), fields: [ text('eyebrow', 'Prompt', formularUploadContent.cta.eyebrow), text('contactLabel', 'Contact link label', formularUploadContent.cta.contactLabel), text('contactUrl', 'Contact link URL', formularUploadContent.cta.contactUrl), text('buttonLabel', 'Button label', formularUploadContent.cta.buttonLabel), text('buttonUrl', 'Button URL', formularUploadContent.cta.buttonUrl), ], }, ], }, ]