<?php

namespace App\Exceptions;

use App\Http\Traits\ApiResponse;
use Exception;
use Illuminate\Http\JsonResponse;
use Throwable;

class ProhibitedAction extends Exception
{
    use ApiResponse;

    public function __construct(public $message = "", int $code = 422, ?Throwable $previous = null)
    {
        parent::__construct($message, $code, $previous);
    }

    /**
     * Render the exception into an HTTP response.
     */
    public function render(): JsonResponse
    {
        return $this->errorResponse($this->message);
    }
}
