<?php

declare(strict_types=1);

namespace App\Framework\Database\Cache;

use App\Framework\Core\ValueObjects\Duration;

/**
 * Null implementation of second-level cache (disabled caching)
 */
final class NullSecondLevelCache implements SecondLevelCacheInterface
{
    public function putEntity(string $entityClass, mixed $entityId, object $entity, ?Duration $ttl = null): bool
    {
        return false;
    }

    public function getEntity(string $entityClass, mixed $entityId): ?object
    {
        return null;
    }

    public function hasEntity(string $entityClass, mixed $entityId): bool
    {
        return false;
    }

    public function evictEntity(string $entityClass, mixed $entityId): bool
    {
        return false;
    }

    public function putQueryResult(QueryCacheKey $key, array $result, ?Duration $ttl = null): bool
    {
        return false;
    }

    public function getQueryResult(QueryCacheKey $key): ?array
    {
        return null;
    }

    public function hasQueryResult(QueryCacheKey $key): bool
    {
        return false;
    }

    public function evictQueryResult(QueryCacheKey $key): bool
    {
        return false;
    }

    public function putCollection(string $entityClass, array $entities, string $cacheKey, ?Duration $ttl = null): bool
    {
        return false;
    }

    public function getCollection(string $entityClass, string $cacheKey): ?array
    {
        return null;
    }

    public function hasCollection(string $entityClass, string $cacheKey): bool
    {
        return false;
    }

    public function evictCollection(string $entityClass, string $cacheKey): bool
    {
        return false;
    }

    public function evictEntityClass(string $entityClass): int
    {
        return 0;
    }

    public function clear(): bool
    {
        return true;
    }

    public function getStats(): array
    {
        return [
            'hits' => 0,
            'misses' => 0,
            'puts' => 0,
            'evictions' => 0,
            'query_hits' => 0,
            'query_misses' => 0,
        ];
    }

    public function getRegionStats(): array
    {
        return [];
    }
}
