import 'package:uto_manager/domain/entities/authorized_rank.dart'; import 'package:uto_manager/domain/entities/personnel_record.dart'; import 'package:uto_manager/domain/value_objects/duty_mos.dart'; /// Abstract repository interface for [PersonnelRecord] persistence operations. /// /// Implementations are provided by the infrastructure layer. The domain layer /// depends only on this interface, never on concrete implementations. abstract interface class PersonnelRepository { /// Returns all personnel records in the database. Future> getAll(); /// Returns the personnel record with [soldierId], or null if not found. Future getById(String soldierId); /// Returns all soldiers assigned to the slot with [slotId]. Future> getBySlot(String slotId); /// Returns all unassigned soldiers (not assigned to any slot). Future> getUnassigned(); /// Returns all soldiers with the given [primaryMos]. Future> getByMos(DutyMos primaryMos); /// Returns all soldiers at the given [payGrade]. Future> getByPayGrade(AuthorizedRank payGrade); /// Inserts a new [record] into the repository. /// /// Throws [StateError] if a record with the same soldier ID already exists. Future insert(PersonnelRecord record); /// Inserts multiple [records] in a single atomic transaction. Future insertAll(List records); /// Updates an existing [record] in the repository. /// /// Throws [StateError] if no record with the given soldier ID exists. Future update(PersonnelRecord record); /// Deletes the personnel record with [soldierId]. Future delete(String soldierId); /// Assigns the soldier with [soldierId] to the slot with [slotId]. /// /// Clears any previous slot assignment for this soldier. Future assignToSlot(String soldierId, String slotId); /// Removes the slot assignment for the soldier with [soldierId]. Future unassignFromSlot(String soldierId); /// Returns a stream that emits the full personnel list whenever it changes. Stream> watchAll(); /// Returns a stream that emits unassigned soldiers whenever the list changes. Stream> watchUnassigned(); /// Deletes all personnel records from the repository. Future deleteAll(); }