<?php

namespace App\Exceptions;

use Exception;

class NotFoundException extends Exception
{
    protected $resource;

    public function __construct(string $resource = 'Resource', string $message = null, int $code = 0, \Throwable $previous = null)
    {
        $this->resource = $resource;
        $message = $message ?: "{$resource} not found";
        parent::__construct($message, $code, $previous);
    }

    public function getResource(): string
    {
        return $this->resource;
    }
}
