package cn.estsh.i3plus.pojo.aps.bean;

import cn.estsh.i3plus.pojo.aps.annotation.FieldAnnotation;
import cn.estsh.i3plus.pojo.aps.common.BaseAPS;
import cn.estsh.i3plus.pojo.aps.common.BeanRelation;
import cn.estsh.i3plus.pojo.aps.holders.EInterMediateDetail;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @Description :计算中间结果明细
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2021-04-27
 * @Modify:
 **/
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "APS_INTER_MEDIATE_DETAIL")
@Api("计算中间结果")
public class InterMediateDetail extends BaseAPS {
    private static final long serialVersionUID = -2588016171684238811L;

    @Column(name="RESULT_ID")
    @ApiParam(value ="中间结果")
    @FieldAnnotation(relation = "InterMediateResult")
    private Long resultId;

    @Column(name="RULE")
    @ApiParam(value ="评估规则")
    private String rule;

    @Column(name="EVALUATE_VALUE")
    @ApiParam(value ="评估值")
    private Double evaluateValue;

    public InterMediateResult getResult() { return BeanRelation.get(this, EInterMediateDetail.Result); }

    public void setResult(InterMediateResult result) {
        this.resultId = result != null ? result.getId() : 0;
        BeanRelation.set(this, EInterMediateDetail.Result, result);
    }
}
