package cn.lihongjie.coal.coalAnalysis.dto;

import cn.lihongjie.coal.base.dto.OrgCommonDto;
import cn.lihongjie.coal.coalInfo.dto.CoalInfoDto;
import cn.lihongjie.coal.common.DictCode;
import cn.lihongjie.coal.pojoProcessor.DictTranslate;

import lombok.Data;

import org.hibernate.annotations.Comment;

import java.util.HashMap;
import java.util.Map;

@Data
public class CoalAnalysisDto extends OrgCommonDto {
    @Comment("关联的煤源信息")
    private CoalInfoDto coalInfo;

    @Comment("归档状态")
    private String archiveStatus;


    @DictTranslate(dictKey =  DictCode.ARCHIVESTATUS)
    private String archiveStatusName;
    @Comment("参数 1 ")
    private Double param1;

    @Comment("参数 2 ")
    private Double param2;

    @Comment("参数 3 ")
    private Double param3;

    @Comment("参数 4 ")
    private Double param4;

    @Comment("参数 5 ")
    private Double param5;

    @Comment("参数 6 ")
    private Double param6;

    @Comment("参数 7 ")
    private Double param7;

    @Comment("参数 8 ")
    private Double param8;

    @Comment("参数 9 ")
    private Double param9;

    @Comment("参数 10 ")
    private Double param10;

    @Comment("参数 11 ")
    private Double param11;

    @Comment("参数 12 ")
    private Double param12;

    @Comment("参数 13 ")
    private Double param13;

    @Comment("参数 14 ")
    private Double param14;

    @Comment("参数 15 ")
    private Double param15;

    @Comment("参数 16 ")
    private Double param16;

    @Comment("参数 17 ")
    private Double param17;

    @Comment("参数 18 ")
    private Double param18;

    @Comment("参数 19 ")
    private Double param19;

    @Comment("参数 20 ")
    private Double param20;

    public Map<String, Object> toMap() {

        HashMap<String, Object> ma = new HashMap<>();

        ma.put("param1", param1);
        ma.put("param2", param2);
        ma.put("param3", param3);
        ma.put("param4", param4);
        ma.put("param5", param5);
        ma.put("param6", param6);
        ma.put("param7", param7);
        ma.put("param8", param8);
        ma.put("param9", param9);
        ma.put("param10", param10);
        ma.put("param11", param11);
        ma.put("param12", param12);
        ma.put("param13", param13);
        ma.put("param14", param14);
        ma.put("param15", param15);
        ma.put("param16", param16);
        ma.put("param17", param17);
        ma.put("param18", param18);
        ma.put("param19", param19);
        ma.put("param20", param20);

        return ma;
    }

    public void updateFromMap(Map<String, Object> map) {

        this.param1 = (Double) map.getOrDefault("param1", null);
        this.param2 = (Double) map.getOrDefault("param2", null);
        this.param3 = (Double) map.getOrDefault("param3", null);
        this.param4 = (Double) map.getOrDefault("param4", null);
        this.param5 = (Double) map.getOrDefault("param5", null);
        this.param6 = (Double) map.getOrDefault("param6", null);
        this.param7 = (Double) map.getOrDefault("param7", null);
        this.param8 = (Double) map.getOrDefault("param8", null);
        this.param9 = (Double) map.getOrDefault("param9", null);
        this.param10 = (Double) map.getOrDefault("param10", null);
        this.param11 = (Double) map.getOrDefault("param11", null);
        this.param12 = (Double) map.getOrDefault("param12", null);
        this.param13 = (Double) map.getOrDefault("param13", null);
        this.param14 = (Double) map.getOrDefault("param14", null);
        this.param15 = (Double) map.getOrDefault("param15", null);
        this.param16 = (Double) map.getOrDefault("param16", null);
        this.param17 = (Double) map.getOrDefault("param17", null);
        this.param18 = (Double) map.getOrDefault("param18", null);
        this.param19 = (Double) map.getOrDefault("param19", null);
        this.param20 = (Double) map.getOrDefault("param20", null);
    }
}
