package com.example.demo.model;

import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 登录日志实体。
 * <p>对应数据库 login_log 表，记录用户登录行为。</p>
 */
@Schema(description = "登录日志实体")
public class LoginLog {

    @Schema(description = "日志ID", example = "1")
    private Long logId;

    @Schema(description = "用户名", example = "admin")
    private String username;

    @Schema(description = "登录时间", example = "2024-01-15 09:00:00")
    private String loginTime;

    @Schema(description = "IP地址", example = "192.168.1.1")
    private String ipAddress;

    @Schema(description = "设备信息", example = "Chrome 120 on Windows 10")
    private String deviceInfo;

    @Schema(description = "登录结果：成功/失败", example = "成功")
    private String result;

    @Schema(description = "失败原因", example = "密码错误")
    private String failReason;

    public LoginLog() {}

    public LoginLog(Long logId, String username, String loginTime, String ipAddress,
                    String deviceInfo, String result, String failReason) {
        this.logId = logId;
        this.username = username;
        this.loginTime = loginTime;
        this.ipAddress = ipAddress;
        this.deviceInfo = deviceInfo;
        this.result = result;
        this.failReason = failReason;
    }

    public Long getLogId() { return logId; }
    public void setLogId(Long logId) { this.logId = logId; }
    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }
    public String getLoginTime() { return loginTime; }
    public void setLoginTime(String loginTime) { this.loginTime = loginTime; }
    public String getIpAddress() { return ipAddress; }
    public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; }
    public String getDeviceInfo() { return deviceInfo; }
    public void setDeviceInfo(String deviceInfo) { this.deviceInfo = deviceInfo; }
    public String getResult() { return result; }
    public void setResult(String result) { this.result = result; }
    public String getFailReason() { return failReason; }
    public void setFailReason(String failReason) { this.failReason = failReason; }
}
