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

import cn.estsh.i3plus.pojo.aps.annotation.FieldAnnotation;
import cn.estsh.i3plus.pojo.aps.common.BeanRelation;
import cn.estsh.i3plus.pojo.aps.holders.EBaseOrder;
import cn.estsh.i3plus.pojo.base.enumutil.ApsEnumUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
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;
import java.util.Date;

/**
 * @Description :销售订单
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2019-09-17
 * @Modify:
 **/
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "APS_SALES_ORDER")
@Api("销售订单")
public class SalesOrder extends BaseOrder {
    private static final long serialVersionUID = -511784925441907538L;
    @Column(name="LOW_EST")
    @ApiParam(value ="底阶最早开始时间")
    private Date lowEst;

    @Column(name="SPECIFY_LOW_EST")
    @ApiParam(value ="指定底阶最早开始时间")
    private Date specifyLowEst;

    @Column(name="SPECIFY_LET")
    @ApiParam(value ="指定最晚结束时间")
    private Date specifyLet;

    @Column(name="SPECIFY_LEAD_TIME")
    @ApiParam(value ="指定提前期")
    @FieldAnnotation(editType = ApsEnumUtil.EDIT_TYPE.DURATION)
    private String specifyLeadTime;

    @Column(name="CALC_LEAD_TIME")
    @ApiParam(value ="提前期计算值")
    @FieldAnnotation(modify = false)
    private String calcLeadTime;

    @Column(name="ALLOW_DELAY_TIME")
    @ApiParam(value ="允许延期时间")
    @FieldAnnotation(editType = ApsEnumUtil.EDIT_TYPE.DURATION)
    private String allowDelayTime;

    @JsonIgnore
    public Work getWork() {
        return BeanRelation.get(this, EBaseOrder.Works);
    }
}
