uto_manager/lib/domain/entities/echelon.dart

65 lines
1.5 KiB
Dart

/// Represents the hierarchical echelon levels in U.S. Army doctrine.
///
/// Ordered from highest (Brigade) to lowest (Team) echelon.
enum Echelon {
brigade,
battalion,
company,
platoon,
section,
squad,
team;
/// Returns a human-readable display name for this echelon.
String get displayName {
switch (this) {
case Echelon.brigade:
return 'Brigade';
case Echelon.battalion:
return 'Battalion';
case Echelon.company:
return 'Company';
case Echelon.platoon:
return 'Platoon';
case Echelon.section:
return 'Section';
case Echelon.squad:
return 'Squad';
case Echelon.team:
return 'Team';
}
}
/// Returns the numeric level (lower = higher echelon).
int get level {
switch (this) {
case Echelon.brigade:
return 1;
case Echelon.battalion:
return 2;
case Echelon.company:
return 3;
case Echelon.platoon:
return 4;
case Echelon.section:
return 5;
case Echelon.squad:
return 6;
case Echelon.team:
return 7;
}
}
/// Returns true if [other] is a valid parent echelon for this echelon.
///
/// A valid parent must be exactly one level higher (lower level number).
bool isValidParent(Echelon other) {
return other.level == level - 1;
}
/// Returns true if [other] is a valid child echelon for this echelon.
bool isValidChild(Echelon other) {
return other.level == level + 1;
}
}