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 org.springframework.format.annotation.DateTimeFormat;

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

/**
 * 平台店铺会员卡 — 支付流水（独立表，不写入 merchant_payment_order）
 */
@Data
@JsonInclude
@TableName("platform_shop_membership_payment_order")
@ApiModel(value = "PlatformShopMembershipPaymentOrder", description = "平台店铺会员卡支付单")
public class PlatformShopMembershipPaymentOrder {

    public static final int PAY_STATUS_PENDING = 0;
    public static final int PAY_STATUS_PAID = 1;
    public static final int PAY_STATUS_CLOSED = 2;
    public static final int PAY_STATUS_REFUNDED = 3;

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

    @ApiModelProperty("支付单号（业务唯一）")
    @TableField("payment_no")
    private String paymentNo;

    @ApiModelProperty("会员卡业务订单ID platform_shop_membership_order.id")
    @TableField("membership_order_id")
    private Integer membershipOrderId;

    @ApiModelProperty("会员卡业务订单号")
    @TableField("order_sn")
    private String orderSn;

    @ApiModelProperty("门店ID")
    @TableField("store_id")
    private Integer storeId;

    @ApiModelProperty("支付方式 alipay/wechatPay")
    @TableField("pay_type")
    private String payType;

    @ApiModelProperty("商户订单号（传支付宝/微信）")
    @TableField("out_trade_no")
    private String outTradeNo;

    @ApiModelProperty("第三方交易号")
    @TableField("trade_no")
    private String tradeNo;

    @ApiModelProperty("支付金额（元）")
    @TableField("pay_amount")
    private BigDecimal payAmount;

    @ApiModelProperty("支付状态 0待支付 1已支付 2已关闭 3已退款 4退款中")
    @TableField("pay_status")
    private Integer payStatus;

    @ApiModelProperty("支付完成时间")
    @TableField("pay_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;

    @ApiModelProperty("付款人门店用户ID")
    @TableField("payer_user_id")
    private Integer payerUserId;

    @ApiModelProperty("订单描述/商品标题")
    @TableField("subject")
    private String subject;

    @TableLogic
    @TableField("delete_flag")
    private Integer deleteFlag;

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

    @TableField("created_user_id")
    private Integer createdUserId;

    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @TableField("updated_user_id")
    private Integer updatedUserId;
}
