package com.wzj.soopin.order.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.dromara.common.core.domain.model.BaseAudit;
import org.dromara.common.excel.annotation.Excel;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单表对象 oms_order
 *
 * @author zcc
 */
@EqualsAndHashCode(callSuper = true)
@Schema(description = "订单表对象")
@Data
@TableName("oms_order")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Order extends BaseAudit implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "订单id")
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "支付id")
    private Long payId;

    @Schema(description = "租户id")
    private String tenantId;

    @Schema(description = "订单编号")
    @Excel(name = "订单编号")
    private String orderSn;

    @Schema(description = "MEMBER_ID")
    @Excel(name = "MEMBER_ID")
    private Long memberId;

    @Schema(description = "用户帐号")
    @Excel(name = "用户帐号")
    private String memberUsername;

    @Schema(description = "商家备注")
    @Excel(name = "商家备注")
    private String merchantNote;

    @Schema(description = "订单总金额")
    @Excel(name = "订单总金额")
    private BigDecimal totalAmount;

    @Schema(description = "采购价")
    @Excel(name = "采购价")
    private BigDecimal purchasePrice;

    @Schema(description = "应付金额（实际支付金额）")
    @Excel(name = "应付金额", readConverterExp = "实=际支付金额")
    private BigDecimal payAmount;


    @Schema(description = "支付方式：0->未支付；1->支付宝；2->微信")
    @Excel(name = "支付方式：0->未支付；1->支付宝；2->微信")
    private Integer payType;


    /**
     *  订单状态枚举类型见{@link com.wzj.soopin.order.emum.OrderStatusEnum}
     */
    private Integer status;

    /**
     * 是否处于退款状态
     */
    @Schema(description="是否处于退款状态")
    private Boolean aftersale;



    @Schema(description = "加密的手机号")
    @Excel(name = "加密的手机号")
    private String receiverPhoneEncrypted;

    @Schema(description = "省份/直辖市")
    @Excel(name = "省份/直辖市")
    private String receiverProvince;

    @Schema(description = "城市")
    @Excel(name = "城市")
    private String receiverCity;

    @Schema(description = "区")
    @Excel(name = "区")
    private String receiverDistrict;

    @Schema(description = "省份/直辖市id")
    @Excel(name = "省份/直辖市id")
    private Long receiverProvinceId;

    @Schema(description = "城市id")
    @Excel(name = "城市id")
    private Long receiverCityId;

    @Schema(description = "区id")
    @Excel(name = "区id")
    private Long receiverDistrictId;

    @Schema(description = "详细地址")
    @Excel(name = "详细地址")
    private String receiverDetailAddress;

    @Schema(description = "订单备注")
    @Excel(name = "订单备注")
    private String note;

    @Schema(description = "支付时间")
    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime paymentTime;


    @Schema(description = "优惠券ID")
    private Long memberCouponId;

    @Schema(description = "优惠券金额")
    private BigDecimal couponAmount;

    @Schema(description = "核销时间")
    private LocalDateTime usedTime;

    @Schema(description = "核销码url")
    private String codeUrl;

    @Schema(description = "订单类型：1->团购；2->拼团;3->秒杀；")
    private Integer type;

    @Schema(description = "提现状态：1->等待转账；2->转帐中;3->转账成功;4->转账失败")
    private Integer withdrawStatus;


    @Schema(description = "配送方式 1->到店核销；2->自提;3->配送;")
    private Integer distribution;

    @Schema(description = "核销码")
    private String code;


}
