<?php

namespace App\Exceptions;

use Openguru\OpenCartFramework\Validator\ErrorBag;
use RuntimeException;
use Throwable;

class OrderValidationFailedException extends RuntimeException
{
    private ErrorBag $errorBag;

    public function __construct(
        ErrorBag $errorBag,
        string $message = 'Validation failed',
        int $code = 422,
        Throwable $previous = null
    ) {
        $this->errorBag = $errorBag;

        parent::__construct($message, $code, $previous);
    }

    public function getErrorBag(): ErrorBag
    {
        return $this->errorBag;
    }
}
