// http/problem-builders.ts
import type { ProblemDetails } from './problem-details';

export function validationProblem(params: {
  detail?: string;
  instance?: string;
  errors?: Record<string, string[]>;
}): ProblemDetails {
  return {
    type: 'https://api.myapp.dev/problems/validation',
    title: 'Bad Request',
    status: 400,
    detail: params.detail ?? 'Invalid request data',
    instance: params.instance,
    errors: params.errors,
  };
}

export function unexpectedProblem(params?: {
  instance?: string;
}): ProblemDetails {
  return {
    type: 'https://api.myapp.dev/problems/unexpected',
    title: 'Internal Server Error',
    status: 500,
    detail: 'Internal server error',
    instance: params?.instance,
  };
}
