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;

/**
 * 项目名: yhlxj2
 * 文件名: UserMirrorShopFeeOrderDon
 * 创建者: JavaZou
 * 创建时间:2024/10/23 16:15
 */
@Getter
@Setter
public class UserMirrorShopFeeOrderDon extends BaseEntity {
	private String openId;

	private Long userId;

	/**
	 * 商家订单号
	 */
	private String orderNo;

	/**
	 * 交易id
	 */
	private String transactionId;

	/**
	 * 卖家id
	 */
	private String buyerId;

	private BigDecimal money;

	private BigDecimal refundMoney;

	private String refundDesc;

	private String outRefundNo;

	/**
	 * 订单状态
	 */
	private Status status;

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

	private Date payTime;

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

	/**
	 * 上级店铺主id
	 */
	private Long mpId;


	/**
	 * 订单状态
	 */
	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", "支付宝"),
		PAYPAL("paypal", "paypal支付"),
		STRIPE("stripe", "stripe支付");
		String type;
		String desc;

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