// Lookup helpers for the cleaner-form field kinds — used by the field row + add-field menu.

function kindLabel(k) {
  return {
    property: 'Property picker',
    date: 'Date',
    text: 'Short text',
    longtext: 'Long text',
    number: 'Number',
    money: 'Dollar amount',
    yesno: 'Yes / No',
    photo: 'Photo upload',
    select: 'Dropdown',
    checklist: 'Multi-select checklist',
  }[k] || k;
}

function FieldKindIcon({ kind }) {
  const s = { width: 14, height: 14 };
  const common = { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.6, strokeLinecap: 'round', strokeLinejoin: 'round', ...s };
  if (kind === 'property') return <svg {...common}><path d="M3 10l9-7 9 7v10a2 2 0 01-2 2h-5v-7h-4v7H5a2 2 0 01-2-2V10z"/></svg>;
  if (kind === 'date') return <svg {...common}><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 9h18M8 3v4M16 3v4"/></svg>;
  if (kind === 'text') return <svg {...common}><path d="M4 6h16M4 12h10M4 18h16"/></svg>;
  if (kind === 'longtext') return <svg {...common}><path d="M4 6h16M4 10h16M4 14h16M4 18h10"/></svg>;
  if (kind === 'number') return <svg {...common}><path d="M6 4v16M14 4v16M3 9h17M3 15h17"/></svg>;
  if (kind === 'money') return <svg {...common}><path d="M12 3v18M16 7c0-1.7-1.8-3-4-3s-4 1.3-4 3 1.8 3 4 3 4 1.3 4 3-1.8 3-4 3-4-1.3-4-3"/></svg>;
  if (kind === 'yesno') return <svg {...common}><path d="M9 12l2 2 4-4"/><circle cx="12" cy="12" r="9"/></svg>;
  if (kind === 'photo') return <svg {...common}><path d="M4 8h3l2-3h6l2 3h3a1 1 0 011 1v10a1 1 0 01-1 1H4a1 1 0 01-1-1V9a1 1 0 011-1z"/><circle cx="12" cy="13" r="4"/></svg>;
  if (kind === 'select') return <svg {...common}><path d="M6 9l6 6 6-6"/></svg>;
  if (kind === 'checklist') return <svg {...common}><path d="M3 6l2 2 4-4M3 12l2 2 4-4M3 18l2 2 4-4M13 6h8M13 12h8M13 18h8"/></svg>;
  return null;
}

Object.assign(window, { kindLabel, FieldKindIcon });
