using System.Runtime.InteropServices;

namespace BrikInstaller.Utils;

public static class OsHelper {
    
    public static string getOperatingSystem() {
        string os = "unknown";
        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
            os = "win";
        }
        else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
            os = "linux";
        }
        else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
            os = "macos";
        }
        return os;
    }

    public static string getArchitecture() {
        string arch = RuntimeInformation.OSArchitecture switch {
            Architecture.X64 => "x64",
            Architecture.X86 => "x86",
            Architecture.Arm64 => "arm64",
            Architecture.Arm => "arm",
            _ => RuntimeInformation.OSArchitecture.ToString().ToLower()
        };
        return arch;
    }
}