using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    private const string BaseUrl = "https://saoauth.com/api/client/auth";
    private const string AppName = "Kirigaya";
    private const string OwnerId = "706f2d48f9eb0762";
    private const string AppSecret = "27b79d48a7df496de8aff0c56f7624ddf29e9fff66fac08efb578e919a74e42f";
    private const string AppVersion = "1.0";

    static async Task Main()
    {
        Console.WriteLine($"SaoAuth C# example ready. App: {AppName} v{AppVersion}");
        // await CheckSession("your-session-id", AppName, OwnerId);
    }

    static async Task<bool> CheckSession(string sessionId, string appName, string ownerId)
    {
        using var client = new HttpClient();
        using var content = new FormUrlEncodedContent(new Dictionary<string, string>
        {
            ["type"] = "check",
            ["sessionid"] = sessionId,
            ["name"] = appName,
            ["ownerid"] = ownerId
        });

        var response = await client.PostAsync(BaseUrl, content);
        var body = await response.Content.ReadAsStringAsync();
        return body.Contains("success", StringComparison.OrdinalIgnoreCase);
    }
}
