package com.purui.prims.headless.api.pojo;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Measure {

    @ApiModelProperty(value = "度量名称")
    private String name;

    @ApiModelProperty(value = "聚合函数")
    private String agg;

    @ApiModelProperty(value = "表达式")
    private String expr;

    @ApiModelProperty(value = "业务名称")
    private String bizName;

    @ApiModelProperty(value = "是否创建指标")
    private Integer isCreateMetric = 0;

    @ApiModelProperty(value = "约束条件")
    private String constraint;

    @ApiModelProperty(value = "别名")
    private String alias;

    public Measure(String name, String bizName, String agg, Integer isCreateMetric) {
        this.name = name;
        this.agg = agg;
        this.isCreateMetric = isCreateMetric;
        this.bizName = bizName;
    }

    public Measure(String bizName, String constraint) {
        this.bizName = bizName;
        this.constraint = constraint;
    }

    public String getFieldName() {
        return expr;
    }

}
