<?php

declare(strict_types=1);

namespace App\Framework\Filesystem\Exceptions;

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

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

        parent::__construct(
            message: "Fehler beim Löschen der Datei '$path'.",
            context: $context,
            errorCode: FilesystemErrorCode::FILE_DELETE_FAILED,
            previous: $previous
        );
    }
}
