<?php

declare(strict_types=1);

namespace App\Framework\Mcp\Tools;

use App\Framework\Config\Environment;
use App\Framework\DI\Initializer;
use App\Framework\HttpClient\HttpClient;

/**
 * Initializer for Gitea MCP Tools
 */
final readonly class GiteaToolsInitializer
{
    public function __construct(
        private HttpClient $httpClient,
        private Environment $environment
    ) {
    }

    #[Initializer]
    public function __invoke(): GiteaTools
    {
        // Get Gitea configuration from environment
        $giteaUrl = $this->environment->get('GITEA_URL', 'https://localhost:9443');
        $giteaUsername = $this->environment->get('GITEA_USERNAME', 'michael');
        $giteaPassword = $this->environment->get('GITEA_PASSWORD', 'GiteaAdmin2024');

        return new GiteaTools(
            $this->httpClient,
            $giteaUrl,
            $giteaUsername,
            $giteaPassword
        );
    }
}
