package com.zhongshu.card.server.core.domain.operlog;

import com.github.microservice.models.type.LogServiceType;
import com.zhongshu.card.client.type.LoginType;
import com.zhongshu.card.client.type.LogsLevel;
import com.zhongshu.card.client.type.MessageType;
import com.zhongshu.card.client.type.ResponseCode;
import com.zhongshu.card.server.core.domain.base.SuperMain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.data.mongodb.core.index.Indexed;

import java.util.Date;

/**
 * @author TRX
 * @date 2024/5/27
 */
@Data
public class OperationLogs extends SuperMain {

    @Schema(description = "用户ID")
    private String uid;

    @Schema(description = "登录名")
    private String loginName;

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

    @Schema(description = "IP地址")
    private String ip;

    @Schema(description = "日志来自那个服务")
    private LogServiceType logServiceType;

    @Schema(description = "api地址")
    private String url;

    @Schema(description = "浏览器")
    private String ua;

    @Schema(description = "日志操作端类型")
    private LoginType loginType;

    @Schema(description = "标题")
    private String title;

    @Schema(description = "日志内容")
    private String content;

    @Schema(description = "日志级别，重要程度")
    private LogsLevel level;

    @Schema(description = "时间")
    private String time;

    @Schema(description = "管理数据ID")
    private String dataId;

    @Schema(description = "关联保存关联信息")
    private Object backObj;

    @Schema(description = "消息类型")
    private MessageType messageType;

    @Schema(description = "响应姿态")
    private ResponseCode responseCode;

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