package com.erp.aftersale.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.Builder;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("after_sale_logs")
public class AfterSaleOperationLog {

    @TableId(type = IdType.AUTO)
    private Long id;

    /** 售后单ID */
    private Long afterSaleId;

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

    /** 操作人姓名 */
    private String operatorName;

    /** 操作人类型: user/system/admin */
    private String operatorType;

    /** 操作动作 */
    private String action;

    /** 操作前状态 */
    private String fromStatus;

    /** 操作后状态 */
    private String toStatus;

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

    /** 操作IP */
    private String ip;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    @TableLogic
    @JsonIgnore
    private Integer deleted;

    /** 操作动作常量 */
    public static final String ACTION_CREATE = "create";
    public static final String ACTION_AUDIT = "audit";
    public static final String ACTION_APPROVE = "approve";
    public static final String ACTION_REJECT = "reject";
    public static final String ACTION_REFUND = "refund";
    public static final String ACTION_COMPLETE = "complete";
    public static final String ACTION_CLOSE = "close";
    public static final String ACTION_UPDATE = "update";
    public static final String ACTION_RECEIVE = "receive";
    public static final String ACTION_SHIP = "ship";
}
