<?php

declare(strict_types=1);

namespace App\Framework\Filesystem\Exceptions;

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

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

        parent::__construct(
            message: "Konnte Metadaten für Datei '{$path}' nicht lesen",
            context: $context,
            errorCode: FilesystemErrorCode::FILE_METADATA_FAILED,
            previous: $previous
        );
    }
}
