package com.red.circle.other.app.common.cp;

import com.red.circle.other.infra.enums.user.user.CpRelationshipType;
import com.red.circle.other.inner.enums.config.EnumConfigKey;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * Relation gold config helpers.
 */
public final class CpRelationGoldConfig {

  private CpRelationGoldConfig() {
  }

  public static EnumConfigKey dismissConsumeGoldKey(String relationType) {
    CpRelationshipType normalizedType = CpRelationshipType.of(relationType);
    return switch (normalizedType) {
      case BROTHER -> EnumConfigKey.BROTHER_DISMISS_CONSUME_GOLD;
      case SISTERS -> EnumConfigKey.SISTERS_DISMISS_CONSUME_GOLD;
      case CP -> EnumConfigKey.CP_DISMISS_CONSUME_GOLD;
    };
  }

  public static BigDecimal defaultGold(BigDecimal gold) {
    return Objects.isNull(gold) ? BigDecimal.ZERO : gold;
  }

  public static Long defaultGoldLong(BigDecimal gold) {
    return defaultGold(gold).longValue();
  }
}
