package shop.alien.entity.store;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 埋点事件实体类
 *
 * @author system
 * @since 2026-01-14
 */
@Data
@JsonInclude
@TableName("store_track_event")
@ApiModel(value = "StoreTrackEvent对象", description = "埋点事件表")
public class StoreTrackEvent {

    @ApiModelProperty(value = "主键ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "事件类型")
    @TableField("event_type")
    private String eventType;

    @ApiModelProperty(value = "事件分类")
    @TableField("event_category")
    private String eventCategory;

    @ApiModelProperty(value = "用户ID")
    @TableField("user_id")
    private Integer userId;

    @ApiModelProperty(value = "店铺ID")
    @TableField("store_id")
    private Integer storeId;

    @ApiModelProperty(value = "目标对象ID")
    @TableField("target_id")
    private Integer targetId;

    @ApiModelProperty(value = "目标对象类型")
    @TableField("target_type")
    private String targetType;

    @ApiModelProperty(value = "事件附加数据(JSON格式)")
    @TableField("event_data")
    private String eventData;

    @ApiModelProperty(value = "金额")
    @TableField("amount")
    private BigDecimal amount;

    @ApiModelProperty(value = "时长(毫秒)")
    @TableField(value = "duration", insertStrategy = com.baomidou.mybatisplus.annotation.FieldStrategy.IGNORED, updateStrategy = com.baomidou.mybatisplus.annotation.FieldStrategy.IGNORED)
    private Long duration;

    @ApiModelProperty(value = "IP地址")
    @TableField("ip_address")
    private String ipAddress;

    @ApiModelProperty(value = "用户代理")
    @TableField("user_agent")
    private String userAgent;

    @ApiModelProperty(value = "设备类型")
    @TableField("device_type")
    private String deviceType;

    @ApiModelProperty(value = "APP版本号")
    @TableField("app_version")
    private String appVersion;

    @ApiModelProperty(value = "事件发生时间")
    @TableField("event_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date eventTime;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;
}