88 lines
2.6 KiB
Dart
88 lines
2.6 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
|
|
import 'package:uto_manager/domain/entities/authorized_rank.dart';
|
|
import 'package:uto_manager/domain/value_objects/duty_mos.dart';
|
|
|
|
/// Represents an authorized duty position slot within a unit.
|
|
///
|
|
/// A [PositionSlot] defines a specific billet in the unit's MTOE,
|
|
/// including the required MOS, authorized rank, and whether it is
|
|
/// a key leader position. A slot may or may not have an assigned soldier.
|
|
class PositionSlot extends Equatable {
|
|
const PositionSlot({
|
|
required this.slotId,
|
|
required this.unitId,
|
|
required this.positionTitle,
|
|
required this.dutyMos,
|
|
required this.authorizedRank,
|
|
required this.isKeyLeader,
|
|
this.assignedPersonnelId,
|
|
});
|
|
|
|
/// Unique identifier for this position slot (UUID v4).
|
|
final String slotId;
|
|
|
|
/// The unit this slot belongs to.
|
|
final String unitId;
|
|
|
|
/// The official position title (e.g., "Platoon Leader", "Squad Leader").
|
|
final String positionTitle;
|
|
|
|
/// The authorized duty MOS for this position.
|
|
final DutyMos dutyMos;
|
|
|
|
/// The authorized pay grade for this position.
|
|
final AuthorizedRank authorizedRank;
|
|
|
|
/// Whether this is a key leader position (PL, PSG, SL, CO CDR, etc.).
|
|
final bool isKeyLeader;
|
|
|
|
/// The ID of the assigned soldier, or null if the slot is vacant.
|
|
final String? assignedPersonnelId;
|
|
|
|
/// Returns true if this slot has no assigned soldier.
|
|
bool get isVacant => assignedPersonnelId == null;
|
|
|
|
/// Returns true if this slot is filled.
|
|
bool get isFilled => assignedPersonnelId != null;
|
|
|
|
/// Returns a copy of this [PositionSlot] with the given fields replaced.
|
|
PositionSlot copyWith({
|
|
String? slotId,
|
|
String? unitId,
|
|
String? positionTitle,
|
|
DutyMos? dutyMos,
|
|
AuthorizedRank? authorizedRank,
|
|
bool? isKeyLeader,
|
|
String? assignedPersonnelId,
|
|
bool clearAssignment = false,
|
|
}) {
|
|
return PositionSlot(
|
|
slotId: slotId ?? this.slotId,
|
|
unitId: unitId ?? this.unitId,
|
|
positionTitle: positionTitle ?? this.positionTitle,
|
|
dutyMos: dutyMos ?? this.dutyMos,
|
|
authorizedRank: authorizedRank ?? this.authorizedRank,
|
|
isKeyLeader: isKeyLeader ?? this.isKeyLeader,
|
|
assignedPersonnelId:
|
|
clearAssignment ? null : (assignedPersonnelId ?? this.assignedPersonnelId),
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
slotId,
|
|
unitId,
|
|
positionTitle,
|
|
dutyMos,
|
|
authorizedRank,
|
|
isKeyLeader,
|
|
assignedPersonnelId,
|
|
];
|
|
|
|
@override
|
|
String toString() => 'PositionSlot(id: $slotId, title: $positionTitle, '
|
|
'mos: ${dutyMos.code}, rank: ${authorizedRank.payGrade}, '
|
|
'vacant: $isVacant)';
|
|
}
|