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


import com.purui.prims.common.pojo.enums.DataTypeEnums;
import com.purui.prims.headless.api.pojo.DimValueMap;
import com.purui.prims.headless.api.pojo.SchemaItem;
import com.purui.prims.headless.api.pojo.enums.DimensionType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

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


@Data
@ToString(callSuper = true)
@ApiModel(value = "维度")
public class DimensionResp extends SchemaItem {

    @ApiModelProperty(value = "模型ID")
    private Long modelId;

    @ApiModelProperty(value = "类型")
    private DimensionType type;

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

    @ApiModelProperty(value = "模型名称")
    private String modelName;

    @ApiModelProperty(value = "模型业务名称")
    private String modelBizName;

    @ApiModelProperty(value = "模型过滤SQL")
    private String modelFilterSql;
    //DATE ID CATEGORY
    @ApiModelProperty(value = "语义类型")
    private String semanticType;

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

    @ApiModelProperty(value = "默认值")
    private List<String> defaultValues;

    @ApiModelProperty(value = "值映射")
    private List<DimValueMap> dimValueMaps;

    @ApiModelProperty(value = "数据类型")
    private DataTypeEnums dataType;

    @ApiModelProperty(value = "扩展信息")
    private Map<String, Object> ext = new HashMap<>();

    public boolean isTimeDimension() {
        return DimensionType.isTimeDimension(type);
    }
}
