<?php

declare(strict_types=1);

namespace App\Framework\Filesystem\Exceptions;

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

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

        parent::__construct(
            message: "Fehler beim Kopieren von '$source' nach '$destination'.",
            context: $context,
            errorCode: FilesystemErrorCode::FILE_COPY_FAILED,
            previous: $previous
        );
    }
}
