package cn.reghao.bnt.web.admin.model.vo;

import cn.reghao.bnt.web.admin.model.po.AccessLog;
import cn.reghao.jutil.jdk.converter.DateTimeConverter;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @author reghao
 * @date 2025-10-04 00:23:09
 */
@NoArgsConstructor
@Setter
@Getter
public class AccessLogInfo {
    private String requestId;
    private Integer statusCode;
    private double executeTime;
    private String requestMethod;
    private String requestUrl;
    private String requestTimeStr;
    private String userAgent;
    private String remoteAddr;

    public AccessLogInfo(AccessLog accessLog) {
        this.requestId = accessLog.getRequestId();
        this.statusCode = accessLog.getStatusCode();
        this.executeTime = accessLog.getExecuteTime()/1000D;
        this.requestMethod = accessLog.getRequestMethod();
        this.requestUrl = accessLog.getRequestUrl();
        this.requestTimeStr = DateTimeConverter.format(accessLog.getRequestTime());
        this.userAgent = accessLog.getUserAgent();
        this.remoteAddr = accessLog.getRemoteAddr();
    }
}
