package com.zhongshu.card.server.core.domain.devices.permiss;

import com.zhongshu.card.client.type.permiss.PermissSendState;
import com.zhongshu.card.server.core.domain.base.SuperMain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

/**
 * 设备权限下发日志
 *
 * @author TRX
 * @date 2024/10/31
 */
@Data
@Document
@NoArgsConstructor
@AllArgsConstructor
public class DevicePermissSendLog extends SuperMain {

    @Schema(description = "下发对应的数据ID")
    private String dataId;

    @Schema(description = "所属批次ID")
    private String groupId;

    @Schema(description = "下发服务标志")
    private String event;

    @Schema(description = "设备ID")
    private String deviceId;

    @Schema(description = "设备名称")
    private String deviceName;

    @Schema(description = "设备类型")
    private String deviceType;

    @Schema(description = "设备所属网关ID")
    private String gateWayId;

    @Schema(description = "数据管理的用户id")
    private String userId;

    @Schema(description = "关联的用户名称")
    private String userName;

    @Schema(description = "下发时间")
    private String sendTime;

    @Schema(description = "下发的数据")
    private Object data;

    @Schema(description = "下发状态")
    private PermissSendState sendState = PermissSendState.Send;

    @Schema(description = "下发请求的结果")
    private String sendMsg = "";
    //----------------------------------响应数据 start ---------------------------

    @Schema(description = "是否响应")
    private Boolean isResponse = Boolean.FALSE;

    @Schema(description = "下发后响应时间")
    private Long responseTime;

    @Schema(description = "下发后响应时间，可读")
    private String responseTimeStr;

    @Schema(description = "响应提示内容")
    private String responseMsg = "";

    @Schema(description = "过期时间")
    @Indexed(expireAfterSeconds = 0)
    private Date ttl;

}
