<?php

declare(strict_types=1);

use App\Framework\Cache\Cache;
use App\Framework\Core\ValueObjects\Timestamp;
use App\Framework\Discovery\Storage\DiscoveryCacheManager;
use App\Framework\Discovery\ValueObjects\DiscoveryContext;
use App\Framework\Discovery\ValueObjects\DiscoveryOptions;
use App\Framework\Discovery\ValueObjects\ScanType;
use App\Framework\Filesystem\FileSystemService;

beforeEach(function () {
    $this->mockCache = Mockery::mock(Cache::class);
    $this->mockClock = Mockery::mock(\App\Framework\DateTime\Clock::class);
    $this->realFileSystemService = new FileSystemService(); // Use real service since it's final
    $this->mockClock->shouldReceive('time')->andReturn(Timestamp::fromFloat(microtime(true)))->byDefault();
    $this->mockClock->shouldReceive('now')->andReturn(new \DateTimeImmutable())->byDefault();

    $this->discoveryCacheManager = new DiscoveryCacheManager(
        $this->mockCache,
        $this->mockClock,
        $this->realFileSystemService
    );

    // Create test context
    $this->testContext = new DiscoveryContext(
        paths: ['/test/path'],
        scanType: ScanType::FULL,
        options: new DiscoveryOptions(),
        startTime: $this->mockClock->now()
    );
});

afterEach(function () {
    Mockery::close();
});

describe('Basic Cache Operations', function () {
    it('cache manager can be instantiated', function () {
        expect($this->discoveryCacheManager)->toBeInstanceOf(DiscoveryCacheManager::class);
    });
});
