<?php

declare(strict_types=1);

namespace App\Framework\Filesystem\Exceptions;

use App\Framework\Exception\Core\FilesystemErrorCode;
use App\Framework\Exception\ExceptionContext;

final class DirectoryListException extends FilesystemException
{
    public function __construct(
        string $directory,
        int $code = 0,
        ?\Throwable $previous = null
    ) {
        $context = ExceptionContext::forOperation('directory.list', 'Filesystem')
            ->withData(['directory' => $directory]);

        parent::__construct(
            message: "Fehler beim Auslesen des Verzeichnisses '$directory'.",
            context: $context,
            errorCode: FilesystemErrorCode::DIRECTORY_LIST_FAILED,
            previous: $previous
        );
    }
}
