package com.zhongshu.card.client.model.operLogs;

import com.zhongshu.card.client.model.base.SuperModel;
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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * @author TRX
 * @date 2024/5/29
 */
@Data
public class OperationLogsModel extends SuperModel {

    @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 String ua;

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

    private String loginTypeStr;

    public String getLoginTypeStr() {
        if (loginType != null) {
            return loginType.getRemark();
        }
        return "";
    }

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

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

    private String levelStr;

    public String getLevelStr() {
        if (level != null) {
            return level.getRemark();
        }
        return "";
    }

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

    private String messageTypeStr;

    public String getMessageTypeStr() {
        if (messageType != null) {
            return messageType.getRemark();
        }
        return "";
    }

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

    private String responseCodeStr;

    public String getResponseCodeStr() {
        if (responseCode != null) {
            return responseCode.getRemark();
        }
        return "";
    }
}
