type IssueLike = {
  path: PropertyKey[];
  message: string;
};

export function zodIssuesToRecord(issues: IssueLike[]): Record<string, string[]> {
  const out: Record<string, string[]> = {};

  for (const issue of issues) {
    const key = issue.path.length ? issue.path.join('.') : 'root';
    out[key] ??= [];
    out[key].push(issue.message);
  }

  return out;
}
