using CarbonService.Models;
using CarbonLib.Carbon;
using Newtonsoft.Json;

namespace CarbonConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var configPath = "config25";
            ICarbonCalculation carbonCalc = new CarbonLib.Carbon.CarbonCalculation25(configPath);
            var request = new CarbonRequest();
            using (var reader = new StreamReader("input.txt"))
            {
                var filecontent = reader.ReadToEnd();
                request = JsonConvert.DeserializeObject<CarbonRequest>(filecontent);
            }
            
            var result = carbonCalc.CalculateClimateScenario(request);

            using (var writer = new StreamWriter("output.txt"))
            {
                var resultText = JsonConvert.SerializeObject(result, Formatting.Indented);
                writer.WriteLine(resultText);
            }
        }
    }
}