package com.red.circle.console.app.dto.cmd.app.activity.invite;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 常驻邀请活动配置保存命令.
 */
@Data
@Accessors(chain = true)
public class InviteCampaignConfigSaveCmd implements Serializable {

  @Serial
  private static final long serialVersionUID = 1L;

  @NotBlank(message = "sysOrigin required.")
  private String sysOrigin;

  @NotNull(message = "enabled required.")
  private Boolean enabled;

  private String downloadUrl;

  private String shareTitle;

  private String shareDesc;

  private String serviceContact;

  private String timezone;

  @NotNull(message = "antiCheat required.")
  private AntiCheatCmd antiCheat = new AntiCheatCmd();

  @NotNull(message = "inviterBindReward required.")
  private RewardItemCmd inviterBindReward = new RewardItemCmd();

  @NotNull(message = "inviteeBindReward required.")
  private RewardItemCmd inviteeBindReward = new RewardItemCmd();

  private List<RuleItemCmd> inviteeRechargeRules = new ArrayList<>();

  private List<RuleItemCmd> inviterValidCountRules = new ArrayList<>();

  private List<RuleItemCmd> inviterTotalRechargeRules = new ArrayList<>();

  @Data
  @Accessors(chain = true)
  public static class AntiCheatCmd implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    private Boolean sameIpOnce = Boolean.TRUE;

    private Boolean sameDeviceOnce = Boolean.TRUE;
  }

  @Data
  @Accessors(chain = true)
  public static class RewardItemCmd implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    private Long goldAmount;

    private Long rewardGroupId;
  }

  @Data
  @Accessors(chain = true)
  public static class RuleItemCmd extends RewardItemCmd {

    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "threshold required.")
    private Long threshold;

    private Boolean enabled = Boolean.TRUE;
  }
}
