package com.erp.dashboard.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单实体 - 用于Dashboard统计查询
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("orders")
public class Order {

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

    private String shortId;
    private String platformOrderSn;
    private String platform;
    private Long shopId;
    private String shopName;
    private LocalDateTime orderTime;
    private LocalDateTime paymentTime;
    private LocalDateTime endTime;
    private String buyerNick;
    private String receiverName;
    private String receiverPhone;
    private String receiverAddress;
    private BigDecimal goodsAmount;
    private BigDecimal discountAmount;
    private BigDecimal freight;
    private BigDecimal totalAmount;
    private String orderStatus;
    private String platformStatus;
    private String erpStatus;
    private String auditStatus;
    private String auditComment;
    private LocalDateTime auditTime;
    private Long auditorId;
    private String rejectReason;
    private LocalDateTime rejectTime;
    private Long rejectorId;
    private String cancelReason;
    private LocalDateTime cancelTime;
    private String cancelorId;
    private String deliveryStatus;
    private LocalDateTime deliveryTime;
    private String expressCompany;
    private String expressCode;
    private String expressName;
    private String expressNo;
    private Long warehouseId;
    private String warehouseName;
    private String remark;
    private String matchStatus;
    private LocalDateTime matchTime;
    private String syncStatus;
    private String printStatus;
    private LocalDateTime printTime;
    private LocalDateTime syncTime;
    private LocalDateTime shipTime;
    private LocalDateTime remindedAt;
    private Long tenantId;

    @TableLogic
    private LocalDateTime deletedAt;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    // 订单状态常量
    public static final String STATUS_PENDING = "pending";
    public static final String STATUS_MATCHED = "matched";
    public static final String STATUS_APPROVED = "wait_delivery";
    public static final String STATUS_REJECTED = "rejected";
    public static final String STATUS_SHIPPED = "shipped";
    public static final String STATUS_CANCELLED = "cancelled";
}
