/// The disciplinary weight class of a commitment. Central, not cosmetic — the
/// class decides debt weight, deferability and escalation harshness.
enum CommitmentClass {
  /// Never auto-deferrable, heaviest debt weight, hardest escalation.
  NonNegotiable,

  /// Normal weight, limited deferrals.
  Standard,

  /// Nice-to-have, no debt on miss, auto-archives.
  Elective,
}

/// Debt weight w(class) from the debt formula.
double classWeight(CommitmentClass value) {
  switch (value) {
    case CommitmentClass.NonNegotiable:
      return 5.0;
    case CommitmentClass.Standard:
      return 2.0;
    case CommitmentClass.Elective:
      return 0.0;
  }
}

String classLabel(CommitmentClass value) {
  switch (value) {
    case CommitmentClass.NonNegotiable:
      return "Non-negotiable";
    case CommitmentClass.Standard:
      return "Standard";
    case CommitmentClass.Elective:
      return "Elective";
  }
}

CommitmentClass getCommitmentClass(String? name) {
  for (CommitmentClass value in CommitmentClass.values) {
    if (value.name == name) {
      return value;
    }
  }
  return CommitmentClass.Standard;
}
