package com.yonge.cooleshow.biz.dal.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
import com.yonge.cooleshow.biz.dal.enums.OrderStatusEnum;
import com.yonge.cooleshow.biz.dal.enums.OrderTypeEnum;
import com.yonge.cooleshow.common.enums.EPaymentVersion;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;

/**
 * 平台订单表
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("user_order")
@ApiModel(value = "UserOrder对象", description = "平台订单表")
public class UserOrder implements Serializable {
    @TableId(value = "id_", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty("订单号 ")
    @TableField(value = "order_no_")
    private String orderNo;

    @ApiModelProperty("支付版本 ")
    @TableField(value = "payment_version_")
    private EPaymentVersion paymentVersion;

    @ApiModelProperty("机构ID ")
    @TableField(value = "tenant_id_")
    private Long tenantId;

    @ApiModelProperty("买家id ")
    @TableField(value = "user_id_")
    private Long userId;

    @ApiModelProperty("支付厂商")
    @TableField(value = "payment_vendor_")
    private String paymentVendor;

    @ApiModelProperty("支付appId")
    @TableField(value = "payment_app_id_")
    private String paymentAppId;

    @ApiModelProperty("支付渠道")
    @TableField(value = "payment_channel_")
    private String paymentChannel;

    @ApiModelProperty(value = "推荐用户id(有推荐人的情况)")
    @TableField(value = "recom_user_id_")
    private Long recomUserId;

    @ApiModelProperty(value = "活动id(有活动的情况)")
    @TableField(value = "activity_id_")
    private Long activityId;

    @ApiModelProperty(value = "活动奖品id(有活动的情况)")
    @TableField(value = "reward_id_")
    private Long rewardId;

    @ApiModelProperty("订单名称 ")
    @TableField(value = "order_name_")
    private String orderName;

    @ApiModelProperty("下单应用：STUDENT 学生端 TEACHER 老师端")
    @TableField(value = "order_client_")
    private ClientEnum orderClient;

    @ApiModelProperty("订单类型: 学生端（ VIP、开通会员  PRACTICE、趣纠课购买  LIVE、直播课购买 VIDEO、视频课购买 MUSIC、单曲点播 ACTI_REGIST、活动报名 TENANT_ALBUM 平台专辑） " +
            "老师端（VIP、开通会员 PIANO_ROOM、琴房时长）")
    @TableField(value = "order_type_")
    private OrderTypeEnum orderType;

    @ApiModelProperty("订单描述信息 ")
    @TableField(value = "order_desc_")
    private String orderDesc;

    @ApiModelProperty("订单状态 WAIT_PAY 待支付 PAYING 支付中  PAID 已付款 CLOSE 已关闭 FAIL 支付失败")
    @TableField(value = "status_")
    private OrderStatusEnum status;

    @ApiModelProperty("原价 ")
    @TableField(value = "original_price_")
    private BigDecimal originalPrice;

    @ApiModelProperty("预计价格 ")
    @TableField(value = "expect_price_")
    private BigDecimal expectPrice;

    @ApiModelProperty("实际价格 ")
    @TableField(value = "actual_price_")
    private BigDecimal actualPrice;

    @ApiModelProperty("优惠金额 ")
    @TableField(value = "coupon_amount_")
    private BigDecimal couponAmount;

    @ApiModelProperty("平台服务费 ")
    @TableField(value = "plantform_fee_")
    private BigDecimal plantformFee;

    @ApiModelProperty("用户备注 ")
    @TableField(value = "user_note_")
    private String userNote;

    @ApiModelProperty("下单时间 ")
    @TableField(value = "create_time_")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

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

    @ApiModelProperty("原因 ")
    @TableField(value = "reason_")
    private String reason;

    @TableField(value = "update_time_")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

}