package com.ruoyi.credit.domain;

import java.util.Date;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 验证日志记录对象 dc_validation_log
 * 
 * @author ruoyi
 * @date 2025-12-31
 */
public class ValidationLog extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 日志ID */
    private Long logId;

    /** 验证记录ID */
    @Excel(name = "验证记录ID")
    private Long validationId;

    /** 贷款ID */
    @Excel(name = "贷款ID")
    @NotNull(message = "贷款ID不能为空")
    private Long loanId;

    /** 日志级别 */
    @Excel(name = "日志级别")
    @NotNull(message = "日志级别不能为空")
    @Size(max = 10, message = "日志级别长度不能超过10个字符")
    private String logLevel;

    /** 日志类型 */
    @Excel(name = "日志类型")
    @NotNull(message = "日志类型不能为空")
    @Size(max = 50, message = "日志类型长度不能超过50个字符")
    private String logType;

    /** 日志消息 */
    @Excel(name = "日志消息")
    @NotNull(message = "日志消息不能为空")
    @Size(max = 2000, message = "日志消息长度不能超过2000个字符")
    private String logMessage;

    /** 详细信息 */
    @Excel(name = "详细信息")
    @Size(max = 4000, message = "详细信息长度不能超过4000个字符")
    private String logDetails;

    /** 执行步骤 */
    @Excel(name = "执行步骤")
    @Size(max = 100, message = "执行步骤长度不能超过100个字符")
    private String executionStep;

    /** 执行时长(毫秒) */
    @Excel(name = "执行时长")
    private Long executionDuration;

    /** 异常信息 */
    @Excel(name = "异常信息")
    @Size(max = 4000, message = "异常信息长度不能超过4000个字符")
    private String exceptionInfo;

    /** 日志时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "日志时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "日志时间不能为空")
    private Date logTime;

    /** 操作用户 */
    @Excel(name = "操作用户")
    @Size(max = 100, message = "操作用户长度不能超过100个字符")
    private String operatorUser;

    /** 客户端IP */
    @Excel(name = "客户端IP")
    @Size(max = 50, message = "客户端IP长度不能超过50个字符")
    private String clientIp;

    /** 用户代理 */
    @Excel(name = "用户代理")
    @Size(max = 500, message = "用户代理长度不能超过500个字符")
    private String userAgent;

    // 日志级别常量
    public static final String LEVEL_DEBUG = "DEBUG";
    public static final String LEVEL_INFO = "INFO";
    public static final String LEVEL_WARN = "WARN";
    public static final String LEVEL_ERROR = "ERROR";

    // 日志类型常量
    public static final String TYPE_VALIDATION_START = "VALIDATION_START";
    public static final String TYPE_VALIDATION_STEP = "VALIDATION_STEP";
    public static final String TYPE_VALIDATION_SUCCESS = "VALIDATION_SUCCESS";
    public static final String TYPE_VALIDATION_FAILURE = "VALIDATION_FAILURE";
    public static final String TYPE_VALIDATION_ERROR = "VALIDATION_ERROR";
    public static final String TYPE_CACHE_OPERATION = "CACHE_OPERATION";
    public static final String TYPE_NOTIFICATION_SENT = "NOTIFICATION_SENT";
    public static final String TYPE_PERFORMANCE_WARNING = "PERFORMANCE_WARNING";

    public void setLogId(Long logId) 
    {
        this.logId = logId;
    }

    public Long getLogId() 
    {
        return logId;
    }

    public void setValidationId(Long validationId) 
    {
        this.validationId = validationId;
    }

    public Long getValidationId() 
    {
        return validationId;
    }

    public void setLoanId(Long loanId) 
    {
        this.loanId = loanId;
    }

    public Long getLoanId() 
    {
        return loanId;
    }

    public void setLogLevel(String logLevel) 
    {
        this.logLevel = logLevel;
    }

    public String getLogLevel() 
    {
        return logLevel;
    }

    public void setLogType(String logType) 
    {
        this.logType = logType;
    }

    public String getLogType() 
    {
        return logType;
    }

    public void setLogMessage(String logMessage) 
    {
        this.logMessage = logMessage;
    }

    public String getLogMessage() 
    {
        return logMessage;
    }

    public void setLogDetails(String logDetails) 
    {
        this.logDetails = logDetails;
    }

    public String getLogDetails() 
    {
        return logDetails;
    }

    public void setExecutionStep(String executionStep) 
    {
        this.executionStep = executionStep;
    }

    public String getExecutionStep() 
    {
        return executionStep;
    }

    public void setExecutionDuration(Long executionDuration) 
    {
        this.executionDuration = executionDuration;
    }

    public Long getExecutionDuration() 
    {
        return executionDuration;
    }

    public void setExceptionInfo(String exceptionInfo) 
    {
        this.exceptionInfo = exceptionInfo;
    }

    public String getExceptionInfo() 
    {
        return exceptionInfo;
    }

    public void setLogTime(Date logTime) 
    {
        this.logTime = logTime;
    }

    public Date getLogTime() 
    {
        return logTime;
    }

    public void setOperatorUser(String operatorUser) 
    {
        this.operatorUser = operatorUser;
    }

    public String getOperatorUser() 
    {
        return operatorUser;
    }

    public void setClientIp(String clientIp) 
    {
        this.clientIp = clientIp;
    }

    public String getClientIp() 
    {
        return clientIp;
    }

    public void setUserAgent(String userAgent) 
    {
        this.userAgent = userAgent;
    }

    public String getUserAgent() 
    {
        return userAgent;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("logId", getLogId())
            .append("validationId", getValidationId())
            .append("loanId", getLoanId())
            .append("logLevel", getLogLevel())
            .append("logType", getLogType())
            .append("logMessage", getLogMessage())
            .append("logDetails", getLogDetails())
            .append("executionStep", getExecutionStep())
            .append("executionDuration", getExecutionDuration())
            .append("exceptionInfo", getExceptionInfo())
            .append("logTime", getLogTime())
            .append("operatorUser", getOperatorUser())
            .append("clientIp", getClientIp())
            .append("userAgent", getUserAgent())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}