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;

/**
 * 商户支付单表（关联 user_reservation_order，记录每笔支付与支付宝/微信流水）
 *
 * @author system
 */
@Data
@JsonInclude
@TableName("merchant_payment_order")
@ApiModel(value = "MerchantPaymentOrder对象", description = "商户支付单表")
public class MerchantPaymentOrder {

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

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

    @ApiModelProperty(value = "业务订单类型: reservation_order-预订订单")
    @TableField("order_type")
    private String orderType;

    @ApiModelProperty(value = "业务订单主键 user_reservation_order.id")
    @TableField("order_id")
    private Integer orderId;

    @ApiModelProperty(value = "业务订单编号 user_reservation_order.order_sn")
    @TableField("order_sn")
    private String orderSn;

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

    @ApiModelProperty(value = "支付方式: alipay-支付宝, wechatPay-微信")
    @TableField("pay_type")
    private String payType;

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

    @ApiModelProperty(value = "第三方交易号（支付宝trade_no/微信transaction_id）")
    @TableField("trade_no")
    private String tradeNo;

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

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

    @ApiModelProperty(value = "支付完成时间")
    @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(value = "付款人用户ID")
    @TableField("payer_user_id")
    private Integer payerUserId;

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

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

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

    @ApiModelProperty(value = "创建人ID")
    @TableField("created_user_id")
    private Integer createdUserId;

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

    @ApiModelProperty(value = "修改人ID")
    @TableField("updated_user_id")
    private Integer updatedUserId;
}
