package com.softwarebr.nunu.entity.user;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单
 * @date 2020-02-27 12:00:43
 * @author lilin
 */
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name="u_order")
@Builder
public class Order {

	/**
	 * 1待付款
	 */
	public final static Integer ORDER_STATUS_AWAITING = 1;

	/**
	 * 2已付款
	 */
	public final static Integer ORDER_STATUS_RECEIVED = 2;


	/**
	 * 3退款中
	 */
	public final static Integer ORDER_STATUS_REFUNDING = 3;

	/**
	 * 4已退款
	 */
	public final static Integer ORDER_STATUS_REFUNDED = 4;

	/**
	 * 5已拒绝
	 */
	public final static Integer ORDER_STATUS_REJECTED = 5;

	/**
	 * 6已取消
	 */
	public final static Integer ORDER_STATUS_CANCEL = 6;


	/**
	 * 支付方式(1微信)
	 */
	public final static Integer PAY_TYPE_WECHAT = 1;

	/**
	 * 支付方式(2支付宝)
	 */
	public final static Integer PAY_TYPE_ALIPAY = 2;


	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@ApiModelProperty(value = "id", required = true, example = "1")
	private Long id;

	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "创建时间", required = true, example = "2018-03-12 21:32:33")
	private LocalDateTime createDate;

	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "自动取消时间", required = true, example = "")
	private LocalDateTime autoCancelDate;

	@ApiModelProperty(value = "活动id", required = true, example = "")
	private Long activityId;

	@ApiModelProperty(value = "用户id", required = true, example = "")
	private Long memberId;

	@ApiModelProperty(value = "订单号", required = true, example = "")
	private String orderNo;

	@ApiModelProperty(value = "订单数量", required = true, example = "")
	private Integer orderAmount;

	@ApiModelProperty(value = "活动价格", required = true, example = "")
	private BigDecimal price;

	@ApiModelProperty(value = "订单总价", required = true, example = "")
	private BigDecimal totalPrice;

	@ApiModelProperty(value = "支付方式(1微信 2支付宝)", required = true, example = "")
	private Integer payType;

	@ApiModelProperty(value = "订单状态(1待付款 2已付款 3退款中 4已退款 5已拒绝 6已取消)", required = true, example = "")
	private Integer orderStatus;

}