using KYFramework;

namespace SimulationServer;
using Define = SimulationServer.Utils.Define;
public class TotalEconomical
{
    public string 火灾总面积 ;
    public string 火灾死亡人数;
    public string 火灾总受伤人数;
    public string 总获救人员数量;
    public string 火灾死亡总人数;
    public string 火灾受伤总人数;
    public string 总获救财产;
    public string 总损失财产;
    
}

public class TotalEconomicalComponent : Component
{
    public TotalEconomical TotalEconomical = new TotalEconomical();
    
    public void FillData()
    {
        var mission = GetParent<MHRescueMission>();
        var end = Fire.burnedCalculate(Define.WIND, mission.slope, mission.tn, mission.InitArea);
        
        double x = end.burnarea/10000;
        double y1 = 0.3096 * Math.Pow(x, 0.4893);
        double y2 = 1004.4520 * Math.Pow(x, 0.2193);
        double y3 = 0.2312 * Math.Pow(y1, 1.1668);
        double deadRoundedInt = Math.Round(y3);
        double injuredRoundedInt = Math.Round(y1-y3);
        double y2RoundedTwoDecimals = Math.Round(y2, 2);
        
        TotalEconomical.火灾总面积 = end.burnarea.ToString();
        TotalEconomical.火灾死亡人数 = deadRoundedInt.ToString();
        TotalEconomical.火灾总受伤人数 = injuredRoundedInt.ToString();
        TotalEconomical.总获救人员数量 = "-";
        TotalEconomical.火灾死亡总人数 = deadRoundedInt.ToString();
        TotalEconomical.火灾受伤总人数 = injuredRoundedInt.ToString();
        TotalEconomical.总获救财产 = "-";
        
        TotalEconomical.总损失财产 = y2RoundedTwoDecimals.ToString();
        
    }
    
    public Dictionary<string, Dictionary<string, string>> GetReport()
    {
        Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
        report["总经济性"] = new Dictionary<string, string>
        {
            { "火灾总面积/m2", TotalEconomical.火灾总面积.ToString() },
            { "火灾死亡人数/人", TotalEconomical.火灾死亡人数.ToString() },
            { "火灾总受伤人数/人", TotalEconomical.火灾总受伤人数.ToString() },
            { "总获救人员数量/人", TotalEconomical.总获救人员数量.ToString() },
            { "火灾死亡总人数/人", TotalEconomical.火灾死亡总人数.ToString() },
            { "火灾受伤总人数/人", TotalEconomical.火灾受伤总人数.ToString() },
            { "总获救财产/w", TotalEconomical.总获救财产.ToString() },
            { "总损失财产/w", TotalEconomical.总损失财产.ToString() }
        };
        return report;
    }
}