using System.Reflection;
using System.Text.Json;
using BrikInstaller.Utils;

namespace BrikInstaller;

public class Constants {
    public static readonly JsonSerializerOptions _jsonOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
    
    public static readonly string Os = OsHelper.getOperatingSystem();
    public static readonly string Arch = OsHelper.getArchitecture();
    
    public static readonly string Env = "PROD";

    public static readonly string BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
    public static readonly string CurrentWorkingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;

    public static class ProductMetadata {
        public static string Name = "";
        public static string InstallPath = "";
    }

    public static class URLs {
        public static readonly string ApiPoint = "https://brik.azures.fr";
        public static class Endpoints {
            public static string Manifest(string softName, string os, string arch) 
                => $"{ApiPoint}/products/{softName}/{os}-{arch}/manifest";

            public static string Download(string softName, string os, string arch) 
                => $"{ApiPoint}/products/{softName}/{os}-{arch}/download/";

            public static string Metadata() 
                => $"{ApiPoint}/metadata";

            public static string Configuration(string softName, string os, string arch) 
                => $"{ApiPoint}/products/{softName}/{os}-{arch}/configuration";
        }
    }
}