<?php

declare(strict_types=1);

namespace App\Framework\Discovery\ValueObjects;

/**
 * Configuration options for discovery process
 */
final readonly class DiscoveryOptions
{
    public function __construct(
        public ScanType $scanType = ScanType::FULL,
        public array $paths = ['/src'],
        public bool $useCache = true,
        public bool $parallel = false,
        public int $batchSize = 50,
        public bool $showProgress = false,
        public array $excludePatterns = [],
        public array $includePatterns = ['*.php']
    ) {
    }

    public static function defaults(): self
    {
        return new self();
    }

    public function withScanType(ScanType $scanType): self
    {
        return new self(
            scanType: $scanType,
            paths: $this->paths,
            useCache: $this->useCache,
            parallel: $this->parallel,
            batchSize: $this->batchSize,
            showProgress: $this->showProgress,
            excludePatterns: $this->excludePatterns,
            includePatterns: $this->includePatterns
        );
    }

    public function withPaths(array $paths): self
    {
        return new self(
            scanType: $this->scanType,
            paths: $paths,
            useCache: $this->useCache,
            parallel: $this->parallel,
            batchSize: $this->batchSize,
            showProgress: $this->showProgress,
            excludePatterns: $this->excludePatterns,
            includePatterns: $this->includePatterns
        );
    }

    public function withoutCache(): self
    {
        return new self(
            scanType: $this->scanType,
            paths: $this->paths,
            useCache: false,
            parallel: $this->parallel,
            batchSize: $this->batchSize,
            showProgress: $this->showProgress,
            excludePatterns: $this->excludePatterns,
            includePatterns: $this->includePatterns
        );
    }

    /**
     * Create default discovery options
     */
    public static function default(): self
    {
        return new self();
    }

    /**
     * Create comprehensive discovery options
     */
    public static function comprehensive(): self
    {
        return new self(
            scanType: ScanType::FULL,
            paths: ['/src', '/app'],
            useCache: true,
            parallel: true,
            batchSize: 100,
            showProgress: true,
            excludePatterns: [],
            includePatterns: ['*.php']
        );
    }

    /**
     * Create minimal discovery options
     */
    public static function minimal(): self
    {
        return new self(
            scanType: ScanType::INCREMENTAL,
            paths: ['/src'],
            useCache: true,
            parallel: false,
            batchSize: 25,
            showProgress: false,
            excludePatterns: ['*/test/*', '*/tests/*'],
            includePatterns: ['*.php']
        );
    }
}
