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

import com.baomidou.mybatisplus.annotation.IEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.zsc.edu.gateway.common.enums.IState;
import com.zsc.edu.gateway.modules.iot.product.entity.Product;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;


/**
 * @author Yao
 * &#064;desciption  物模型属性
 */
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@TableName("iot_property")
@JsonInclude
public class Property extends BaseParam {

    private Long productId;
    /**
     * 数据类型
     */
    private DataType dataType;

    /**
     * 读写类型
     */
    private IoType ioType;


    public enum IoType implements IEnum<Integer>, IState<IoType> {
        /**
         * 可读写
         */
        READ_WRITE(1, "可读写"),
        /**
         * 只读
         */
        READ_ONLY(2, "只读");

        private final int value;
        private final String description;

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

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

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