package cn.axzo.workflow.common.model.request.bpmn;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 条件
 *
 * @author wangli
 * @since 2023/11/13 20:33
 */
@ApiModel("JSON 版本的 BPMN 协议模型中的条件")
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class BpmnCondition {
    /**
     * 条件的中文名称, 前端使用的参数
     */
    @ApiModelProperty(value = "条件的中文名称")
    private String name;

    /**
     * string(字符串)/number(数字)/radio(单选)/checkbox(复选)
     */
    @ApiModelProperty(value = "基础属性:字段类型", notes = "string, number, radio, checkbox", example = "string")
    private String type;

    /**
     * 字段 code
     */
    @ApiModelProperty(value = "基础属性:字段 code", notes = "字段管理中字段的 Code", example = "fieldCode")
    private String code;

    /**
     * 操作符(与字段类型有关)
     * <p>
     * 当字段类型为 string 时, 操作符为 contains, notContains <br/>
     * 当字段类型为 number 时, 操作符为 eq, ne, gt, gte, lt, lte, between <br/>
     * 当字段类型为 radio 时, 操作符为 eq <br/>
     * 当字段类型为 checkbox 时, 操作符为 in <br/>
     */
    @ApiModelProperty(value = "基础属性:操作符", notes = "操作符", example = "eq")
    private String operator;

    /**
     * 默认的比较值
     */
    @ApiModelProperty(value = "基础属性:默认的比较值", notes = "同时也用于 fieldDateType = radio", example = "1")
    private String defaultValue;

    /**
     * 只有 fieldDateType = checkbox 才有值
     */
    @ApiModelProperty(value = "当 fieldDateType = checkbox时, 选中的值")
    private List<String> defaultValues;

    /**
     * 只有 operator = between 才有值 lt, lte
     */
    @ApiModelProperty(value = "当 fieldDateType = number 并且 operator = between 时, 左侧操作符")
    private String leftOperator;

    /**
     * 只有 operator = between 才有值 lt, lte,
     */
    @ApiModelProperty(value = "当 fieldDateType = number 并且 operator = between 时, 右侧操作符")
    private String rightOperator;

    /**
     * 只有 operator = between 才有值
     */
    @ApiModelProperty(value = "当 fieldDateType = number 并且 operator = between 时, 左侧比较值")
    private String leftValue;

    /**
     * 只有 operator = between 才有值
     */
    @ApiModelProperty(value = "当 fieldDateType = number 并且 operator = between 时, 右侧比较值")
    private String rightValue;

    /**
     * 记录前端的下拉选项, 后端无任何逻辑
     */
    @ApiModelProperty(value = "记录前端的下拉选项, 后端无任何逻辑")
    private List<BpmnFieldOptionConf> options;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public List<String> getDefaultValues() {
        return defaultValues;
    }

    public void setDefaultValues(List<String> defaultValues) {
        this.defaultValues = defaultValues;
    }

    public String getLeftOperator() {
        return leftOperator;
    }

    public void setLeftOperator(String leftOperator) {
        this.leftOperator = leftOperator;
    }

    public String getRightOperator() {
        return rightOperator;
    }

    public void setRightOperator(String rightOperator) {
        this.rightOperator = rightOperator;
    }

    public String getLeftValue() {
        return leftValue;
    }

    public void setLeftValue(String leftValue) {
        this.leftValue = leftValue;
    }

    public String getRightValue() {
        return rightValue;
    }

    public void setRightValue(String rightValue) {
        this.rightValue = rightValue;
    }
}
