package com.example.demo.model;

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

/**
 * 操作日志实体。
 * <p>对应数据库 operation_log 表，记录用户关键操作及数据变更。</p>
 */
@Schema(description = "操作日志实体")
public class OperationLog {

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

    @Schema(description = "操作人", example = "admin")
    private String operator;

    @Schema(description = "操作时间", example = "2024-01-15 10:30:00")
    private String operateTime;

    @Schema(description = "操作类型", example = "新增")
    private String operateType;

    @Schema(description = "业务类型", example = "用户管理")
    private String businessType;

    @Schema(description = "业务数据ID", example = "1")
    private Long businessId;

    @Schema(description = "操作前数据（JSON）", example = "{}")
    private String beforeData;

    @Schema(description = "操作后数据（JSON）", example = "{\"username\":\"new_user\"}")
    private String afterData;

    @Schema(description = "操作IP", example = "192.168.1.1")
    private String ip;

    public OperationLog() {}

    public OperationLog(Long logId, String operator, String operateTime, String operateType,
                        String businessType, Long businessId, String beforeData,
                        String afterData, String ip) {
        this.logId = logId;
        this.operator = operator;
        this.operateTime = operateTime;
        this.operateType = operateType;
        this.businessType = businessType;
        this.businessId = businessId;
        this.beforeData = beforeData;
        this.afterData = afterData;
        this.ip = ip;
    }

    public Long getLogId() { return logId; }
    public void setLogId(Long logId) { this.logId = logId; }
    public String getOperator() { return operator; }
    public void setOperator(String operator) { this.operator = operator; }
    public String getOperateTime() { return operateTime; }
    public void setOperateTime(String operateTime) { this.operateTime = operateTime; }
    public String getOperateType() { return operateType; }
    public void setOperateType(String operateType) { this.operateType = operateType; }
    public String getBusinessType() { return businessType; }
    public void setBusinessType(String businessType) { this.businessType = businessType; }
    public Long getBusinessId() { return businessId; }
    public void setBusinessId(Long businessId) { this.businessId = businessId; }
    public String getBeforeData() { return beforeData; }
    public void setBeforeData(String beforeData) { this.beforeData = beforeData; }
    public String getAfterData() { return afterData; }
    public void setAfterData(String afterData) { this.afterData = afterData; }
    public String getIp() { return ip; }
    public void setIp(String ip) { this.ip = ip; }
}
