package com.red.circle.other.inner.model.cmd.activity.lottery;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import lombok.AccessLevel;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;

/**
 * 活动抽奖模型.
 *
 * @author pengliang on 2021/11/11
 */
@Data
@ToString
@Accessors(chain = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ActivityLotteryTurntableCache implements Serializable {

  @Serial
  private static final long serialVersionUID = 1L;

  /**
   * 类型.
   */
  Integer type;

  /**
   * 启动消费.
   */
  String startConsume;

  /**
   * 直径.
   */
  String diameter;

  /**
   * 背景.
   */
  List<Blocks> blocks;

  /**
   * 奖品.
   */
  List<Prizes> prizes;

  /**
   * 按钮.
   */
  List<Buttons> buttons;

  /**
   * 默认配置.
   */
  DefaultConfig defaultConfig;

  /**
   * 默认样式.
   */
  DefaultStyle defaultStyle;

  public List<Prizes> filterInStock() {
    return this.getPrizes().stream()
        .filter(Prizes::checkAvailableInStock)
        .collect(Collectors.toList());
  }

}

