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.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import lombok.Data;

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

/**
 * 用户订单基础实体，对应表：life_user_order。
 * 仅承载订单字段（不含评论信息），在评论视图中会被扩展为 VO。
 *
 * 字段对应：
 * id                  - 主键
 * userId              - 用户id
 * storeId             - 商铺id
 * quanId              - 优惠券券id(life_discount_coupon_user)
 * quanCode            - 券编号
 * orderNo             - 订单编号
 * status              - 订单状态(0待支付;1已支付/待使用;2已核销;3已过期;4已取消;5已退款;6退款失败;7已完成)
 * price               - 原价
 * finalPrice          - 实付价
 * buyTime             - 购买时间
 * payTime             - 支付时间
 * payMethod           - 支付方式
 * usedTime            - 使用时间
 * refundTime          - 退款时间
 * deleteFlag          - 删除标记(0未删,1已删)
 * createdTime         - 创建时间
 * createdUserId       - 创建人ID
 * updatedTime         - 更新时间
 * updatedUserId       - 修改人ID
 * sendDiscountCouponFlag - 核销发送优惠券标记(0未发,1已发)
 * isSync              - 是否同步
 * couponType          - 订单类型(1代金券;2团购订单)
 * cancelTime          - 取消时间
 * cancelReason        - 取消原因
 * finishTime          - 完成时间
 * orderStr            - 订单字符串
 * expertOrderId       - 达人订单id
 * orderAppraise       - 订单评价标记(0未评价;1已评价)
 */
@Data
@JsonInclude
@TableName("life_user_order")
@ApiModel(value = "LifeUserOrder对象", description = "用户订单表")
public class LifeUserOrder {

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

    @ApiModelProperty(value = "用户id")
    private String userId;

    @ApiModelProperty(value = "商铺id")
    private String storeId;

    @ApiModelProperty(value = "优惠券券id(life_discount_coupon_user)")
    private String quanId;

    @ApiModelProperty(value = "券编号")
    private String quanCode;

    @ApiModelProperty(value = "订单编号")
    private String orderNo;

    @ApiModelProperty(value = "订单字符串")
    private String orderStr;

    @ApiModelProperty(value = "订单状态,0待支付;1已支付/待使用;2已核销;3已过期;4已取消;5已退款;6退款失败;7已完成")
    private Integer status;

    @ApiModelProperty(value = "订单价格（原价）")
    private String price;

    @ApiModelProperty(value = "最终价格（付款）")
    private String finalPrice;

    @ApiModelProperty(value = "购买时间")
    private Date buyTime;

    @ApiModelProperty(value = "支付时间")
    private Date payTime;

    @ApiModelProperty(value = "支付方法")
    private String payMethod;

    @ApiModelProperty(value = "使用时间")
    private Date usedTime;

    @ApiModelProperty(value = "退款时间")
    private Date refundTime;

    /**
     * 购买类型(订单类型，1，代金券；2，团购订单)
     */
    @ApiModelProperty(value = "订单类型，1代金券；2团购订单")
    private Integer couponType;


    @ApiModelProperty(value = "取消时间")
    @TableField("cancel_time")
    private Date cancelTime;
    /**
     * 取消原因
     */
    @ApiModelProperty(value = "取消原因")
    @TableField("cancel_reason")
    private String cancelReason;

    @ApiModelProperty(value = "结束时间")
    private Date finishTime;

    @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")
    private Date createdTime;

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

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

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

    @ApiModelProperty(value = "核销发送优惠券（0：未发送，1：已发送）")
    @TableField("send_discount_coupon_flag")
    private Integer sendDiscountCouponFlag;

    @ApiModelProperty(value = "达人订单id")
    @TableField("expert_order_id")
    private Integer expertOrderId;

    @ApiModelProperty(value = "订单评价 0：未评价 1：已评价")
    @TableField("order_appraise")
    private Integer orderAppraise;
}
