package com.example.demo.model;

import java.time.LocalDateTime;

/**
 * 日志记录实体模型。
 * 用于记录登录日志、操作日志和异常日志。
 */
public class LogRecord {

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

    /** 日志类型：login-登录日志, operation-操作日志, exception-异常日志 */
    private String logType;

    /** 操作人ID */
    private Long operatorId;

    /** 操作人用户名 */
    private String operatorName;

    /** 操作内容 / 日志描述 */
    private String content;

    /** 操作IP地址 */
    private String ipAddress;

    /** 操作结果：success-成功, fail-失败 */
    private String result;

    /** 异常堆栈（仅异常日志时记录） */
    private String exceptionStack;

    /** 创建时间 */
    private LocalDateTime createTime;

    public LogRecord() {
    }

    public LogRecord(Long id, String logType, Long operatorId, String operatorName,
                     String content, String ipAddress, String result, String exceptionStack) {
        this.id = id;
        this.logType = logType;
        this.operatorId = operatorId;
        this.operatorName = operatorName;
        this.content = content;
        this.ipAddress = ipAddress;
        this.result = result;
        this.exceptionStack = exceptionStack;
        this.createTime = LocalDateTime.now();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLogType() {
        return logType;
    }

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

    public Long getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(Long operatorId) {
        this.operatorId = operatorId;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getIpAddress() {
        return ipAddress;
    }

    public void setIpAddress(String ipAddress) {
        this.ipAddress = ipAddress;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getExceptionStack() {
        return exceptionStack;
    }

    public void setExceptionStack(String exceptionStack) {
        this.exceptionStack = exceptionStack;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
}
