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 com.zsc.edu.gateway.modules.iot.tsl.dto.ParamDto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.context.annotation.ImportSelector;

import java.util.List;
import java.util.Set;

/**
 * @author Yao
 * @desciption 物模型服务
 */
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@TableName("iot_event")
@JsonInclude
public class Event extends BaseParam {

    private Long productId;

    /**
     * 事件类型
     */
    private Type type;

    /**
     * 服务输出的参数
     */
    @TableField(exist = false)
    private List<Param> outputs;

    public enum Type implements IEnum<String>, IState<Type> {
        /**
         * 主动
         */
        ACTIVE("ACTIVE", "主动"),
        /**
         * 被动
         */
        PASSIVE("PASSIVE", "被动");

        private final String value;
        private final String description;

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

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

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