import type { SettingsField } from '@/types/settings.types' export interface ChoiceOption { value: string label: string } // Schema options come as { key: label } or as a list. export const toChoices = (field: SettingsField): ChoiceOption[] => { const options = field.options if (Array.isArray(options)) { return options.map((item: any) => typeof item === 'object' && item !== null ? { value: String(item.value ?? item.id ?? ''), label: String(item.label ?? item.value ?? '') } : { value: String(item), label: String(item) } ) } return Object.entries(options ?? {}).map(([value, label]) => ({ value, label: String(label) })) }