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;

/**
 * 用户预订订单表
 *
 * @author system
 */
@Data
@JsonInclude
@TableName("user_reservation_order")
@ApiModel(value = "UserReservationOrder对象", description = "用户预订订单表")
public class UserReservationOrder {

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

    @ApiModelProperty(value = "订单编号（唯一，如 YS+序列）")
    @TableField("order_sn")
    private String orderSn;

    @ApiModelProperty(value = "关联预约ID（user_reservation.id）")
    @TableField("reservation_id")
    private Integer reservationId;

    @ApiModelProperty(value = "用户ID")
    @TableField("user_id")
    private Integer userId;

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

    @ApiModelProperty(value = "订单状态 0:待支付 1:待使用 2:已完成 3:已过期 4:已取消 5:已关闭 6:退款中 7:已退款 8:商家预订")
    @TableField("order_status")
    private Integer orderStatus;

    @ApiModelProperty(value = "支付状态 0:未支付 1:已支付 2:已退款 3:部分退款 4：退款中")
    @TableField("payment_status")
    private Integer paymentStatus;

    @ApiModelProperty(value = "订单费用类型 0-免费，1-收费")
    @TableField("order_cost_type")
    private Integer orderCostType;

    @ApiModelProperty(value = "订金金额（元），0表示免费预订")
    @TableField("deposit_amount")
    private BigDecimal depositAmount;

    @ApiModelProperty(value = "支付方式：微信支付等")
    @TableField("payment_method")
    private String paymentMethod;

    @ApiModelProperty(value = "支付截止时间（待支付时剩余时间）")
    @TableField("payment_deadline")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date paymentDeadline;

    @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 = "使用凭证/券码（核销用）")
    @TableField("verification_code")
    private String verificationCode;

    @ApiModelProperty(value = "使用凭证url")
    @TableField("verification_url")
    private String verificationUrl;

    @ApiModelProperty(value = "取消政策类型 0:免费预订 1:不可免费取消 2:分情况免责")
    @TableField("cancellation_policy_type")
    private Integer cancellationPolicyType;

    @ApiModelProperty(value = "免费取消截止时间（分情况免责时有值）")
    @TableField("free_cancellation_deadline")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date freeCancellationDeadline;

    @ApiModelProperty(value = "未按时到店座位保留时长（分钟），0或NULL表示不保留")
    @TableField("late_arrival_grace_minutes")
    private Integer lateArrivalGraceMinutes;

    @ApiModelProperty(value = "订金退还规则描述")
    @TableField("deposit_refund_rule")
    private String depositRefundRule;

    @ApiModelProperty(value = "退款金额（元）")
    @TableField("refund_amount")
    private BigDecimal refundAmount;

    @ApiModelProperty(value = "退款时间")
    @TableField("refund_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date refundTime;

    @ApiModelProperty(value = "退款原因")
    @TableField("refund_reason")
    private String refundReason;

    @ApiModelProperty(value = "退款类型 0:用户取消 1:商家退款 2:部分退款等")
    @TableField("refund_type")
    private Integer refundType;

    @ApiModelProperty(value = "是否商家代订 0:否 1:是")
    @TableField("is_merchant_reservation")
    private Integer isMerchantReservation;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    private String remark;

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

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