package com.tzy.common.dto;

import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

@Data
public class MerchantPointDTO implements Serializable {
	/**商家id*/
	private Integer id;
	/**商户名称*/
	private String name;
	private String avatar;
	private String type;
	private String pointName;
	/**总积分*/
	private Long point;

	private BigDecimal showPoint;

	private String pointTypeMsg;

	public BigDecimal getShowPoint() {
		Integer showPointRate = getShowPointRateByType(this.type);
		return new BigDecimal(point.toString()).divide(new BigDecimal(showPointRate.toString()),2, RoundingMode.HALF_DOWN);
	}

	private Integer getShowPointRateByType(String type){
		int rate=100;
		switch (type){
			case "lucky_point_2023_618":
				rate = 500;
				break;
			case "user_growth":
				rate = 1000;
				break;
			default:
		}
		return rate;
	}
}