package com.inspect.guideline.domain;

import com.inspect.base.core.annotation.Excel;
import com.inspect.base.core.web.domain.BaseEntity;
import com.inspect.guideline.constant.DefectTypeEnum;
import lombok.Getter;

@Getter
public class PatrolGuidelineRule extends BaseEntity {
    private static final long serialVersionUID = 1L;
    private Long guidelineRuleId;
    @Excel(
            name = "导则ID"
    )
    private Long guidelineId;
    @Excel(
            name = "${comment}",
            readConverterExp = "$column.readConverterExp()"
    )
    private String levelType;
    @Excel(
            name = "条件"
    )
    private String ruleCondition;
    @Excel(
            name = "描述"
    )
    private String description;
    @Excel(
            name = "是否有效"
    )
    private String isEnable;
    private String defectName;

    public PatrolGuidelineRule() {
    }

    public PatrolGuidelineRule(String levelType, String defectName) {
        this.levelType = levelType;
        this.defectName = defectName;
    }

    public void setDefectName(String defectName) {
        this.defectName = defectName;
    }

    public void setGuidelineRuleId(Long guidelineRuleId) {
        this.guidelineRuleId = guidelineRuleId;
    }

    public void setGuidelineId(Long guidelineId) {
        this.guidelineId = guidelineId;
    }

    public void setLevelType(String levelType) {
        this.levelType = levelType;
        this.defectName = DefectTypeEnum.getInstance(levelType).getName();
    }

    public void setRuleCondition(String ruleCondition) {
        this.ruleCondition = ruleCondition;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setIsEnable(String isEnable) {
        this.isEnable = isEnable;
    }

    @Override
    public String toString() {
        return "PatrolGuidelineRule{" +
                "guidelineRuleId=" + guidelineRuleId +
                ", guidelineId=" + guidelineId +
                ", levelType='" + levelType + '\'' +
                ", ruleCondition='" + ruleCondition + '\'' +
                ", description='" + description + '\'' +
                ", isEnable='" + isEnable + '\'' +
                ", defectName='" + defectName + '\'' +
                '}';
    }
}
