<?php

declare(strict_types=1);

namespace App\Framework\Cache;

/**
 * Enum for different types of cache identifiers
 */
enum CacheIdentifierType: string
{
    case KEY = 'key';
    case TAG = 'tag';
    case PREFIX = 'prefix';
    case PATTERN = 'pattern';

    /**
     * Check if this type supports batch operations
     */
    public function supportsBatchOperations(): bool
    {
        return match ($this) {
            self::KEY => true,
            self::TAG, self::PREFIX, self::PATTERN => true,
        };
    }

    /**
     * Check if this type supports exact matching
     */
    public function isExactMatch(): bool
    {
        return match ($this) {
            self::KEY => true,
            self::TAG, self::PREFIX, self::PATTERN => false,
        };
    }

    /**
     * Get description for debugging
     */
    public function getDescription(): string
    {
        return match ($this) {
            self::KEY => 'Exact cache key match',
            self::TAG => 'All items with specific tag',
            self::PREFIX => 'All items with key prefix',
            self::PATTERN => 'All items matching pattern',
        };
    }
}
