import { formatSupplierLine1, formatSupplierLine2 } from'@/lib/format/supplier'

interface Props {
 supplier: {
 supplier_name?: string | null
 supplier_number?: string | null
 city?: string | null
 country?: string | null
 } | null | undefined
 size?:'sm'|'md'
}

export function SupplierDisplay({ supplier, size ='md'}: Props) {
 if (!supplier) return <span className="text-muted-foreground">—</span>
 const line2 = formatSupplierLine2(supplier)
 return (
 <div>
 <div className={size ==='sm'?'text-sm font-semibold text-foreground':'text-base font-semibold text-foreground'}>
 {formatSupplierLine1(supplier)}
 </div>
 {line2 && (
 <div className={size ==='sm'?'text-xs text-muted-foreground':'text-sm text-muted-foreground'}>
 {line2}
 </div>
 )}
 </div>
 )
}
