package com.cyksj.model.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

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

/**
 * 项目名: yhlxj
 * 文件名: SpotifyUserUpgradeOrder
 * 创建者: JavaZou
 * 创建时间:2024/12/3 13:41
 */
@Getter
@Setter
public class SpotifyUserUpgradeOrder extends BaseEntity{
	private Long userId;

	private Long goodsId;

	private Long skuId;

	private Long relationId;

	private String orderNo;

	/**
	 * 关联订单号
	 */
	private String relateOrderNo;

	private String transactionId;

	private String shopId;

	private BigDecimal money;

	private Status status;

	private Date payTime;

	private Type type;

	public enum Status {
		/**
		 * 订单状态
		 */
		close("已关闭"),
		noPayment("待付款"),
		hasPayment("已付款"),
		refund("已退款"),
		;

		private String desc;

		Status(String desc) {
			this.desc = desc;
		}

		public String getDesc() {
			return desc;
		}
	}

	@Getter
	@AllArgsConstructor
	public enum Type{
		WeChat("wechat","微信"),
		ALI_PAY("zfb","支付宝"),
		;
		String type;
		String desc;

		public static Type getType(String type) {
			return Arrays.stream(SpotifyUserUpgradeOrder.Type.values()).filter(tp -> tp.getType().equals(type)).findFirst().orElse(ALI_PAY);
		}
	}
}
