export function scheduleError(error: unknown): string {
  if (error instanceof Error) return error.message;
  if (typeof error === 'object' && error !== null) {
    const e = error as { message?: string; errors?: Record<string, string[]>; error?: { message?: string } };
    const details = e.errors ? Object.values(e.errors).flat().join(' ') : '';
    return details || e.message || e.error?.message || 'The schedule could not be saved. Reload and try again.';
  }
  return 'The schedule could not be saved. Reload and try again.';
}
