dropReasonFor static method

DropReason dropReasonFor(
  1. String? denyReason
)

The drop reason a refused chance settles as. Only the two denials that really are a cap (capReached, alreadyPlayed) read as frequency_capped; every other backend denyReason names what happened, and an unknown or missing one is not_eligible, never a cap. Spellings are the backend's DenyReason.

Implementation

static DropReason dropReasonFor(String? denyReason) => switch (denyReason) {
      'capReached' || 'alreadyPlayed' => DropReason.frequencyCapped,
      'notVerified' => DropReason.userNotVerified,
      'notLive' => DropReason.campaignNotLive,
      'notInAudience' => DropReason.notInAudience,
      'budgetUsed' => DropReason.budgetExhausted,
      'chanceExpired' => DropReason.chanceExpired,
      _ => DropReason.notEligible,
    };