package org.dromara.main.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;

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

@Data
@EqualsAndHashCode(callSuper = true)
@TableName("main_order")
public class MainOrder extends BaseEntity {

    @TableId(value = "id")
    private Long id;

    private String orderNo;
    /** 客户单号 */
    private String customerSn;
    private Integer orderType;
    private Integer buyerType;
    private Long buyerId;
    private String buyerName;
    /** 订单来源（小程序/APP/PC） */
    private String source;
    private Long sellerId;
    private BigDecimal totalAmount;
    /** 定金金额 */
    private BigDecimal deposit;
    /** 尾款金额 */
    private BigDecimal balance;
    /** 商品数量 */
    private Integer quantity;
    private BigDecimal paidAmount;
    private BigDecimal refundAmount;
    private Integer orderStatus;
    private Integer payStatus;
    private Long businessId;
    private Long productId;
    private Date payTime;
    private Date completeTime;
    private Date cancelTime;
    private String tenantId;
    private String remark;

    // ===== 非数据库字段，用于前端展示（关联查询填充）=====
    /** 买家手机号（从 main_student 关联查询） */
    @TableField(exist = false)
    private String phone;

    /** 买家头像URL（从 main_student 关联查询） */
    @TableField(exist = false)
    private String userAvatar;

    /** 商品名称（根据订单类型关联查询） */
    @TableField(exist = false)
    private String productName;
}
