package com.cyksj.model.entity;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

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

/**
 * 项目名: yhlxj2
 * 文件名: WebWholesaleOrderDon
 * 创建者: JavaZou
 * 创建时间:2025/6/4 16:12
 */
@Getter
@Setter
public class WebWholesaleOrderDon extends BaseEntity {
	private Long userId;

	private Integer num;

	private BigDecimal money;

	private BigDecimal refundMoney;

	private String transactionId;

	private String buyerId;

	private String orderNo;

	/**
	 * 支付状态
	 */
	private Status status;

	/**
	 * 支付类型
	 */
	private Type type;

	private Date payTime;

	/**
	 * 商户ID
	 */
	private String shopId;

	/**
	 * 支付标题
	 */
	private String payTitle;

	/**
	 * 批发规格ids
	 */
	private String skuIds;

	public enum Status {
		/**
		 * 订单状态
		 */
		close("已关闭"),
		noPayment("待付款"),
		hasPayment("已付款"),
		complete("已完成"),
		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","支付宝"),
		BALANCE("balance", "余额支付"),
		PAYPAL("paypal","paypal支付"),
		STRIPE("stripe","stripe支付")
		;
		String type;
		String desc;

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