<?php

declare(strict_types=1);

namespace App\Exception;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\WithHttpStatus;
use function sprintf;

#[WithHttpStatus(Response::HTTP_UNPROCESSABLE_ENTITY, headers: [
    'x-error-code' => 'point_too_far',
])]
final class PointTooFarException extends \DomainException
{
    public function __construct(float $maximumDistanceKm)
    {
        parent::__construct(sprintf('The submitted point must be within %.2fkm of your location.', $maximumDistanceKm));
    }
}
