// <auto-generated />

#if !NETCOREAPP && !EXCLUDE_OS_POLYFILL

using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;

using Microsoft.CodeAnalysis;

namespace Polyfills;

internal static partial class Polyfill
{
    extension(OperatingSystem)
    {
#if NETFRAMEWORK
        // .NET Framework only runs on Windows (and, rarely, Unix via Mono); it never runs on WASI,
        // Android, iOS, tvOS, or the browser (WASM). RuntimeInformation.IsOSPlatform is also unavailable
        // on .NET Framework before 4.7.1, so these checks are constant false down-level.
        public static bool IsWasi()
            => false;

        public static bool IsAndroid()
            => false;

        public static bool IsIOS()
            => false;

        public static bool IsTvOS()
            => false;

        public static bool IsBrowser()
            => false;
#else
        public static bool IsWasi()
            => RuntimeInformation.IsOSPlatform(OSPlatform.Create("WASI"));

        public static bool IsAndroid()
            => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID"));

        public static bool IsIOS()
            => RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"));

        public static bool IsTvOS()
            => RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS"));

        public static bool IsBrowser()
            => RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"));
#endif
    }
}
#endif
