package com.zsc.edu.gateway.modules.iot.tsl.entity;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.zsc.edu.gateway.common.enums.IState;
import lombok.*;

/**
 * @author lenovo
 */
@Setter
@Getter
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@TableName("iot_param")
@JsonInclude
public class CompareParam extends Param {

    /**
     * 对比类型
     */
    private CompareType compareType;

    /**
     * 默认数值
     */
    private String defaultValue;


    public enum CompareType implements IEnum<String>, IState<CompareType> {
        /**
         * 大于
         */
        GT("GT", "GT"),
        /**
         * 小于
         */
        LT("LT", "LT"),
        /**
         * 等于
         */
        EQ("EQ", "EQ"),
        /**
         * 大于等于
         */
        GE("GE", "GE"),
        /**
         * 小于等于
         */
        LE("LE", "LE");

        private final String value;
        private final String description;

        CompareType(String value, String description) {
            this.value = value;
            this.description = description;
        }

        @Override
        public String getValue() {
            return value;
        }

        @Override
        public String toString() {
            return this.description;
        }
    }
}
