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 java.math.BigDecimal;
import java.util.Date;

/**
 * 平台店铺会员卡订单
 */
@Data
@JsonInclude
@TableName("platform_shop_membership_order")
@ApiModel(value = "PlatformShopMembershipOrder", description = "平台店铺会员卡订单")
public class PlatformShopMembershipOrder {

    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;

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

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

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

    @TableField("plan_id")
    @ApiModelProperty("方案ID")
    private Integer planId;

    @TableField("plan_name")
    @ApiModelProperty("方案名称快照")
    private String planName;

    @TableField("duration_months")
    @ApiModelProperty("时长（月）快照")
    private Integer durationMonths;

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

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

    @TableField("payment_method")
    @ApiModelProperty("支付方式")
    private String paymentMethod;

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

    @TableField("out_trade_no")
    @ApiModelProperty("商户订单号")
    private String outTradeNo;

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

    @TableField("validity_start")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("本笔权益开始")
    private Date validityStart;

    @TableField("validity_end")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("本笔权益结束")
    private Date validityEnd;

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

    @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;
}
