<?php

namespace Formatrica\Submission\Exception;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class Submission_Exception extends \RuntimeException
{
    private int $status;
    private array $errors;

    /**
     * @param array<string, mixed> $errors
     */
    public function __construct(string $message, int $status = 400, array $errors = [])
    {
        parent::__construct($message, $status);

        $this->status = $status;
        $this->errors = $errors;
    }

    public function status(): int
    {
        return $this->status;
    }

    /**
     * @return array<string, mixed>
     */
    public function errors(): array
    {
        return $this->errors;
    }
}
