package cn.novalon.gym.manage.sys.audit.domain;

import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

import java.time.LocalDateTime;

/**
 * 审计日志归档实体
 * 
 * @author 张翔
 * @date 2026-04-01
 */
@Table("audit_log_archive")
@Schema(description = "审计日志归档实体")
public class AuditLogArchive {

    @Id
    @Schema(description = "主键ID")
    private Long id;

    @Column("entity_type")
    @Schema(description = "实体类型（如User, Role等）", example = "User")
    private String entityType;

    @Column("entity_id")
    @Schema(description = "实体ID", example = "1")
    private Long entityId;

    @Column("operation_type")
    @Schema(description = "操作类型（CREATE, UPDATE, DELETE）", example = "UPDATE")
    private String operationType;

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

    @Column("operation_time")
    @Schema(description = "操作时间")
    private LocalDateTime operationTime;

    @Column("before_data")
    @Schema(description = "变更前数据（JSON格式）")
    private String beforeData;

    @Column("after_data")
    @Schema(description = "变更后数据（JSON格式）")
    private String afterData;

    @Column("changed_fields")
    @Schema(description = "变更字段列表")
    private String[] changedFields;

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

    @Column("user_agent")
    @Schema(description = "用户代理")
    private String userAgent;

    @Column("description")
    @Schema(description = "操作描述", example = "更新用户信息")
    private String description;

    @Column("created_at")
    @Schema(description = "记录创建时间")
    private LocalDateTime createdAt;

    @Column("archived_at")
    @Schema(description = "归档时间")
    private LocalDateTime archivedAt;

    public Long getId() {
        return id;
    }

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

    public String getEntityType() {
        return entityType;
    }

    public void setEntityType(String entityType) {
        this.entityType = entityType;
    }

    public Long getEntityId() {
        return entityId;
    }

    public void setEntityId(Long entityId) {
        this.entityId = entityId;
    }

    public String getOperationType() {
        return operationType;
    }

    public void setOperationType(String operationType) {
        this.operationType = operationType;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public LocalDateTime getOperationTime() {
        return operationTime;
    }

    public void setOperationTime(LocalDateTime operationTime) {
        this.operationTime = operationTime;
    }

    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[] getChangedFields() {
        return changedFields;
    }

    public void setChangedFields(String[] changedFields) {
        this.changedFields = changedFields;
    }

    public String getIpAddress() {
        return ipAddress;
    }

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

    public String getUserAgent() {
        return userAgent;
    }

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

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getArchivedAt() {
        return archivedAt;
    }

    public void setArchivedAt(LocalDateTime archivedAt) {
        this.archivedAt = archivedAt;
    }
}
