namespace Kompas.Mcp.Tests;

/// <summary>Пути для тестовых артефактов: корень репозитория и gitignore-папка .scratch.</summary>
internal static class TestPaths
{
    public static string RepoRoot()
    {
        var dir = new DirectoryInfo(AppContext.BaseDirectory);
        while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "KompasMcp.slnx")))
            dir = dir.Parent;
        return dir?.FullName ?? AppContext.BaseDirectory;
    }

    public static string Scratch
        => Directory.CreateDirectory(Path.Combine(RepoRoot(), ".scratch")).FullName;

    public static string NewFile(string extension)
        => Path.Combine(Scratch, $"test_{DateTime.Now:HHmmss}_{Guid.NewGuid():N}{extension}");
}
