<?php

declare(strict_types=1);

namespace App\Framework\Filesystem\Exceptions;

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

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

        parent::__construct(
            message: "Ordner '$directory' konnte nicht angelegt werden.",
            context: $context,
            errorCode: FilesystemErrorCode::DIRECTORY_CREATE_FAILED,
            previous: $previous
        );
    }
}
