using MongoDB.Bson; using adas_core.Domain.Models; using adas_core.Domain.Models.Pumps; using adas_core.Domain.Models.Filter; using adas_core.Domain.Models.MongoModels; using adas_core.Domain.Models.Responses; namespace adas_core.Application.Services.Interfaces; public interface IPumpService: IApiRequestService { // Insert manual /// /// Asynchronously inserts a pump observation record into the underlying data store. /// /// The pump observation to persist. Task InsertPumpObservation(PumpObservation obs); // Mapping /// /// Asynchronously maps the specified pump observation to a resulting , returning null when no mapping result is produced. /// /// The source pump observation to be mapped. /// A task that represents the asynchronous mapping operation, containing the resulting or null if no result is available. Task MapPumpObservation(PumpObservation obs); // Consultas por paciente /// /// Retrieves the most recent pump observations for the specified patient. /// /// The unique identifier of the patient whose pump observations are being queried. /// The maximum number of recent observations to return. Defaults to 1. /// A task that represents the asynchronous operation. The task result contains a list of the most recent pump observations for the patient, up to the specified count. Task> FindLastPumpObservations(ObjectId patientId, int num = 1); /// /// Asynchronously retrieves the most recent observation timestamp for every patient, returning a dictionary keyed by patient identifier. /// /// A task that represents the asynchronous operation. The task result contains a dictionary mapping each patient's to their last observation . Task> FindAllLastPatientObservationTime(); // Gestión de configuración /// /// Retrieves the list of configuration pump items associated with the specified identifier. /// /// The unique identifier used to look up the configuration pump items. /// A task that resolves to a list of objects matching the given identifier, or null when no items are found. Task?> GetItemsById(string id); /// /// Asynchronously retrieves the full list of pump configurations from the underlying data source. /// /// A task that resolves to a containing all pump configurations, or null if no configurations are available. Task?> GetAllPumpConfig(); /// /// Asynchronously retrieves the pump configuration associated with the specified identifier. /// /// The unique identifier of the pump configuration to retrieve. /// A task that represents the asynchronous operation. The task result contains the instance matching the specified identifier, or if no configuration is found. Task GetPumpConfigsById(string id); /// /// Asynchronously updates the pump configuration. /// /// The pump configuration to update. /// A task that represents the asynchronous operation, containing the updated or null if not found. Task UpdatePumpConfig(ConfigPumps config); /// /// Inserts a new pump configuration into the system asynchronously. /// /// The pump configuration to be inserted. /// A task that represents the asynchronous operation, containing the inserted or null if the insertion fails. Task InsertPumpConfig(ConfigPumps config); /// /// Deletes the specified pump configuration. /// /// The pump configuration to delete. /// A task that represents the asynchronous delete operation. The task result is true if the configuration was deleted successfully; otherwise, false. Task DeletePumpConfig(ConfigPumps config); // Paginación /// /// Retrieves a paginated collection of pump observations based on the provided filter criteria. /// Returns null when no pump observations match the supplied pagination filter. /// /// The pagination filter that defines page size, page number, and any additional filtering criteria applied to the pump observations. /// A task that resolves to a containing the matching pump observations, or null when no results are found. Task?> GetPaginatedPump(PaginationFilter filter); // Archivado / limpieza /// /// Asynchronously deletes records associated with the specified patient identifier. /// /// The ObjectId of the patient whose related records should be deleted. Task DeleteByPatientId(ObjectId id); /// /// Archives the specified patient, marking the patient record as archived in the system. /// /// The patient to be archived. Task Archive(Patient patient); /// /// Asynchronously archives the data associated with the specified patient identifier. /// /// The unique identifier of the patient whose data should be archived. /// A task that represents the asynchronous archive operation. Task ArchiveByPatientId(ObjectId id); // Mantenimiento ids /// /// Asynchronously updates multiple records, replacing the specified old ObjectId with a new one in the field identified by . /// /// The name of the field whose ObjectId value should be updated. /// The new ObjectId value to assign. /// The existing ObjectId value to be replaced. Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId); }