// PRE-GENERATED (design session). Free space on the drive where local models are stored.
using System;
using System.IO;

namespace DansoriEQ.App.Ai;

public static class DiskInfo
{
    /// <summary>Free space (GB) on the drive that holds Ollama models (~%USERPROFILE%\.ollama).</summary>
    public static (double freeGb, string drive) ModelDriveFree()
    {
        var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".ollama");
        var root = Path.GetPathRoot(path) ?? "C:\\";
        try
        {
            var di = new DriveInfo(root);
            return (di.AvailableFreeSpace / 1024.0 / 1024.0 / 1024.0, root);
        }
        catch { return (0, root); }
    }
}
