using System.IO;
using c3stream.Pages;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace c3stream {
	public static class c3stream {
		public const  string DataPath  = "data";
		public const  string DbFile    = "_c3stream.json";
		public const  string CachePath = "/mnt/storage/archive/Video/congress/";
		public const  string CacheUrl  = "https://mirror.c3stream.de/";
		public static object Lock      = new object();
		public static string DbPath    = Path.Combine(DataPath, DbFile);

		public static void Main(string[] args) {
			if (!Directory.Exists(DataPath))
				Directory.CreateDirectory(DataPath);
			if (!File.Exists(DbPath))
				ConferenceModel.WriteEventMetadata();
			CreateHostBuilder(args).Build().Run();
		}

		public static IHostBuilder CreateHostBuilder(string[] args) =>
			Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
	}
}