package com.gyee.runeconomy.model;

import com.gyee.runeconomy.dto.speed.Desc;
import com.gyee.runeconomy.init.CacheContext;
import com.gyee.runeconomy.model.auto.ProBasicModelPowerRd;
import lombok.Data;

/**
 * 拟合后对应的曲线 model
 */
@Data
public class PowerFittingData {

    public PowerFittingData() {
    }

    public PowerFittingData(String[] str) {
        if (str.length >= 2) {
            this.speed = Double.valueOf(str[0]);
            this.nhdata = Double.valueOf(str[1]);
            this.cpdata = ((double) ((int) (Double.valueOf(str[2]) * 1000))) / 1000;
        }
    }

    public PowerFittingData(String[] str, String modleId) {
        if (str.length >= 2) {
            this.speed = Double.valueOf(str[0]);
            this.nhdata = Double.valueOf(str[1]);
            ProBasicModelPowerRd rd = CacheContext.theoreticalPowerMap.get(modleId).get(this.speed);
            this.xzdata = rd == null ? 0 : rd.getEnsurePower();
            this.cpdata = ((double) ((int) (Double.valueOf(str[2]) * 1000))) / 1000;
        }
    }


    //风速
    @Desc(des = "风速", remark = "1")
    private Double speed;
    //拟合功率
    @Desc(des = "拟合功率", remark = "1")
    private Double nhdata;
    //修正数据
    @Desc(des = "修正功率", remark = "0")
    private Double xzdata;
    //cp值
    @Desc(des = "Cp值", remark = "1")
    private Double cpdata;

}
