// 新算法，肌肉重量=蛋白重量+水份重量，以蛋白重量为基准

using Hinse.Health;
using Hinse.Health.Service;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

internal class Program
{
    private static void Main(string[] args)
    {
        var host = new HostBuilder().ConfigureServices((context, services) =>
        {
            services.AddTransient<IHealthCalcService, HealthCalcService>();
        })
        .UseConsoleLifetime().Build();
        using (var serviceScope = host.Services.CreateScope())
        {
            var services = serviceScope.ServiceProvider;
            var healthservice = services.GetRequiredService<IHealthCalcService>();
            for (var i = 150; i < 165; i++)
            {
                var inputdata = new BodyCalcData24
                {
                    Weight = 105.2 / 2,
                    Height = 165,
                    Age = 30,
                    Adc = 550,
                    Gender = 2//1-男,2-女
                };
                inputdata.Height = i;
                var data = healthservice.GetBodyFatResultsV2(inputdata);
                Console.WriteLine($"身高:{inputdata.Height}");
                Console.WriteLine($"之前体重:{inputdata.Weight}");
                inputdata.Weight = 105.0 / 2;
                Console.WriteLine($"之后体重:{inputdata.Weight}");
                var data1 = healthservice.GetBodyFatResultsV2(inputdata);
                Console.WriteLine($"体重变化:{(data.weight - data1.weight).ToString("f2")},脂肪量变化:{(data.bfrval - data1.bfrval).ToString("f2")}");
                Console.WriteLine($"脂肪率变化:{(data.bfr - data1.bfr).ToString("f2")}");
                Console.WriteLine($"水份变化:{(data.vwc - data1.vwc).ToString("f2")}");
                Console.WriteLine($"骨量变化:{(data.bm - data1.bm).ToString("f2")}");
                Console.WriteLine($"蛋白率变化:{(data.pp - data1.pp).ToString("f2")}");
                Console.WriteLine($"蛋白量变化:{(data.ppval - data1.ppval).ToString("f2")}");
                Console.WriteLine($"肌肉率变化:{data.rom},{data1.rom}");
                Console.WriteLine($"肌肉率变化:{(data.rom - data1.rom).ToString("f2")}");
                Console.WriteLine($"肌肉量变化:{data.romval},{data1.romval}");
                Console.WriteLine($"肌肉量变化:{(data.romval - data1.romval).ToString("f2")}");
                Console.WriteLine("____________________");
            }
        }
        Console.ReadLine();
        host.Run();
    }
}