<?php

namespace App\Exceptions;

use Exception;

class AuthorizationException extends Exception
{
    protected $requiredPermission;

    public function __construct(string $message = 'Unauthorized access', string $requiredPermission = null, int $code = 0, \Throwable $previous = null)
    {
        $this->requiredPermission = $requiredPermission;
        parent::__construct($message, $code, $previous);
    }

    public function getRequiredPermission(): ?string
    {
        return $this->requiredPermission;
    }
}
