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 Yao
 * &#064;desciption  参数
 */
@Setter
@Getter
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@TableName("iot_param")
@JsonInclude
public class Param extends BaseParam {
    /**
     * 数据类型
     */
    private DataType dataType;

    /**
     * 单位
     */
    private String uint;

    /**
     * 输入输出类型
     */
    private Type type;

    /**
     * 联表的类型
     */
    private ForeignType foreignType;

    /**
     * 联表的id
     */
    private Long foreignId;
    public enum Type implements IEnum<Integer>, IState<Type> {
        /**
         * 物模型输入
         */
        INPUT(1, "Input"),
        /**
         * 物模型输出
         */
        OUTPUT(2, "Output"),
        /**
         * 读写属性
         */
        RW(3, "Read Write");

        private final int value;
        private final String description;

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

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

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

    public enum ForeignType implements IEnum<Integer>, IState<ForeignType> {
        /**
         * 事件
         */
        EVENT(1, "Event"),
        /**
         * 服务
         */
        SERVE(2, "Service"),
        /**
         * 产品
         */
        PRODUCT(3, "Product");

        private final int value;
        private final String description;

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

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

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