<?php

declare(strict_types=1);

namespace App\ApiClient;

/**
 * 400 / 422 with the api's `{"error":"validation_failed","details":{...}}`
 * envelope. `$details` mirrors the api's per-field error map so the UI
 * can render inline form errors without re-parsing.
 */
final class ApiValidationException extends ApiException
{
    /**
     * @param array<string, string> $details
     */
    public function __construct(
        string $message,
        int $statusCode,
        ?string $apiError,
        public readonly array $details = [],
        ?\Throwable $previous = null,
    ) {
        parent::__construct($message, $statusCode, $apiError, $previous);
    }
}
