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

import com.github.microservice.types.user.DevicePermissFromType;
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.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 用户可使用设备临时权限
 *
 * @author TRX
 * @date 2025/2/11
 */
@Data
@Document
@NoArgsConstructor
@AllArgsConstructor
public class Device2UseUsable extends SuperMain {

    @Schema(description = "使用方（用户或者什么）的关联的数据id")
    private List<String> useDataIds = new ArrayList<>();

    @Schema(description = "临时权限来自哪里")
    private DevicePermissFromType tempType;

    @Schema(description = "数据id")
    private String fromDataId;

    @Schema(description = "处理的service名称")
    private String serviceBeanName;

    @Schema(description = "设备id")
    private List<String> deviceIds;

    @Schema(description = "开始时间")
    private Long startTime;

    @Schema(description = "结束时间")
    private Long endTime;

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

}
