package com.red.circle.other.inner.model.dto.material.props;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.red.circle.other.inner.enums.material.PropsCurrencyType;
import com.red.circle.tool.core.text.StringUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import lombok.Data;

/**
 * 头像商店.
 *
 * @author pengliang on 2021/5/29
 */
@Deprecated
@Data
public class AvatarFrameStore implements Serializable, PropsCurrencyTypesFilter {

  private static final long serialVersionUID = 1L;

  /**
   * 主键标识.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long id;

  /**
   * 归属平台.
   */
  private String sysOrigin;

  /**
   * 付费类型.
   */
  private String currencyTypes;

  /**
   * 有效天数.
   */
  private String validDays;

  /**
   * 标签.
   */
  private String label;

  /**
   * 0.下架 1.上架.
   */
  private Boolean shelfStatus;

  /**
   * 道具资源.
   */
  private PropsResources propsResources;

  /**
   * 道具价格
   */
  private List<PropsPrice> propsPrices;

  /**
   * 钻石价格.
   */
  private List<PropsPrice> diamondPrices;

  @Override
  public boolean filterCurrency(PropsCurrencyType type) {
    return Objects.nonNull(type) && StringUtils.isNotBlank(currencyTypes) && currencyTypes
        .contains(type.name());
  }

  /**
   * 计算价格.
   */
  public BigDecimal calculatePropsPrices(Integer days) {
    return PropsPrice.of(days, propsResources.getAmount()).getAmount();
  }

  /**
   * 获取资源id.
   */
  public Long propsResourceId() {
    return propsResources.getId();
  }

  /**
   * 道具金额.
   */
  public BigDecimal propsResourceAmount() {
    return propsResources.getAmount();
  }


}
