using adas_core.Domain.Enums;
using adas_core.Domain.Models.Filter;
using adas_core.Domain.Models.Masters;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Responses;
using MongoDB.Bson;
namespace adas_core.Application.Services.Interfaces;
public interface IPointOfCareService
{
///
/// Asynchronously deletes the entity identified by the specified identifier.
///
/// The unique identifier of the entity to delete.
/// A task that represents the asynchronous delete operation.
Task Delete(ObjectId id);
///
/// Updates an existing point of care record with the provided information.
///
/// The point of care entity containing the updated data.
/// A task representing the asynchronous operation, containing the updated point of care, or null if no matching record was found.
Task Update(PointOfCare pointOfCare);
///
/// Asynchronously updates an existing unit identified by the specified identifier with the provided unit data.
///
/// The unique identifier of the unit to update.
/// The unit data to apply to the existing record.
Task UpdateUnit(ObjectId id, Unit unit);
///
/// Retrieves all PointOfCare records asynchronously.
///
/// A task that represents the asynchronous operation. The task result contains a list of all PointOfCare entries.
Task> GetAll();
///
/// Asynchronously retrieves all PointOfCare configurations.
///
/// A task that represents the asynchronous operation. The task result contains a list of all configurations.
Task> GetAllConfigs();
///
/// Asynchronously retrieves all point-of-care location information.
///
/// A task representing the asynchronous operation, containing a list of all locations.
Task> GetAllLocationInfo();
///
/// Updates the point of care configuration identified by the specified identifier with the provided configuration data.
///
/// The unique identifier of the point of care configuration to update.
/// The new configuration data to apply.
Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration);
///
/// Asynchronously retrieves a entity by its unique identifier, returning null if no matching record is found.
///
/// The unique identifier of the to look up.
/// A task that represents the asynchronous lookup operation. The task result contains the matching if found, or null when no entity with the specified identifier exists.
Task FindById(ObjectId id);
///
/// Retrieves a entity by its identifier, including all of its associated configuration data.
///
/// The of the to locate.
/// A task that yields the matching with its full configuration, or null if no entity is found for the supplied identifier.
Task FindByIdAllConfig(ObjectId id);
///
/// Asynchronously retrieves all PointOfCare records associated with the specified unit identifier.
///
/// The unique identifier of the unit whose PointOfCare records should be retrieved.
/// A task that returns a collection of PointOfCare records for the specified unit, or null if no records are found.
Task?> FindAllByUnitId(ObjectId unit);
///
/// Asynchronously retrieves the collection of Points of Care associated with the specified room.
///
/// The room identifier used to look up the associated Points of Care.
/// A task that represents the asynchronous operation. The task result contains an enumerable of Points of Care found for the given room, or null if no matching results are found.
Task?> FindByRoom(string room);
///
/// Asynchronously retrieves the collection of points of care associated with the specified bed.
///
/// The bed identifier used to look up the associated points of care.
/// A task that represents the asynchronous operation. The task result contains a collection of instances matching the bed, or null if no match is found.
Task?> FindByBed(string bed);
///
/// Retrieves all points of care associated with the specified unit identifiers.
///
/// The list of unit identifiers used to look up the associated points of care.
/// A task that represents the asynchronous operation, containing the list of points of care matching the provided unit identifiers.
Task> FindAllByUnitIds(List unitIds);
///
/// Retrieves the information of a point of care by its identifier, optionally localized and enriched with patient data.
/// Returns null when no point of care matches the specified identifier.
///
/// The identifier of the point of care to retrieve.
/// Optional locale used to localize the retrieved point of care information; when null, the default locale is used.
/// When true, associated patient data is included in the result; when false, only the point of care information is returned.
/// Token to cancel the asynchronous operation.
/// A task that yields the corresponding to the given identifier, or null if it is not found.
Task GetInfo(ObjectId id, LocaleEnum? locale = null, bool fillPatientData = true, CancellationToken ct = default);
///
/// Inserts a new record into the system.
///
/// The entity to be inserted.
/// A containing the inserted , or null if the insertion was not performed.
Task InsertPointOfCare(PointOfCare pointOfCare);
///
/// Retrieves the Point of Care associated with the specified patient identifier.
///
/// The unique identifier of the patient whose Point of Care is being looked up.
/// A task that yields the associated with the patient, or null if no Point of Care is found for the given patient identifier.
Task FindPoCByPatientId(ObjectId patientId);
///
/// Asynchronously sets the Point of Care status for the entity identified by the specified identifier.
///
/// The unique identifier of the entity whose Point of Care status will be updated.
/// The Point of Care status to assign to the entity.
/// A task that represents the asynchronous status update operation.
Task SetPointOfCareStatus(ObjectId id, StatusEnum.PointOfCare status);
///
/// Retrieves the points of care associated with the specified unit and point-of-care status, optionally excluding virtual ones.
///
/// The identifier of the unit whose points of care are queried.
/// The point-of-care status used to filter the results.
/// When true, virtual points of care are excluded from the results; otherwise, they are included.
/// A task that returns the matching collection of entries.
Task> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare poc,
bool excludeVirtual = false);
///
/// Checks the next admission for the specified patient location.
///
/// The optional identifier of the patient location to check.
void CheckNextAdmission(ObjectId? patientLocation);
///
/// Retrieves a associated with the specified bed and unit identifier, returning null when no matching record is found.
///
/// The bed identifier used to locate the point of care.
/// The MongoDB of the unit the point of care belongs to.
/// A that resolves to the matching or null if no record matches the supplied bed and unit.
Task FindByBedAndUnitId(string? bed, ObjectId? unitId);
///
/// Updates the relay configuration associated with the specified point-of-care device.
///
/// The point-of-care device whose relay configuration should be updated.
Task UpdateRelayConfig(PointOfCare poc);
///
/// Asynchronously retrieves the Point of Care (PoC) associated with the specified patient number.
/// Returns null if no matching Point of Care is found for the given patient number.
///
/// The unique patient number used to look up the associated Point of Care.
/// A task that represents the asynchronous operation. The task result contains the if found, or null if no match exists.
Task FindPoCByPatientNumber(string patientNumber);
///
/// Asynchronously counts the number of Points of Contact (PoCs) associated with the specified unit identifier.
///
/// The unique identifier of the unit whose PoCs should be counted.
/// A task that represents the asynchronous operation, containing the total number of PoCs linked to the given unit.
Task CountPoCsByUnitId(ObjectId unitId);
///
/// Asynchronously retrieves the total number of virtual Proofs of Concept (PoCs) associated with the specified unit.
///
/// The unique identifier of the unit whose virtual PoCs should be counted.
/// A that represents the asynchronous operation, containing the count of virtual PoCs for the given unit.
Task CountVirtualPoCsByUnitId(ObjectId unitId);
///
/// Retrieves a paginated collection of Points of Care based on the provided filter.
///
/// The pagination parameters used to control page size and page number.
/// A task that represents the asynchronous operation, containing the paginated response of Points of Care.
Task> GetPaginatedPoCs(PaginationFilter filter);
///
/// Deletes all PoCs associated with the specified unit identifier.
///
/// The unique identifier of the unit whose PoCs should be removed.
Task DeletePoCsByUnitId(ObjectId unitId);
///
/// Asynchronously retrieves the set of all camera identifiers that are currently in use.
///
/// A task that represents the asynchronous operation. The task result contains a HashSet of ObjectId values representing the cameras currently in use.
Task> FindAllIdCamerasInUse();
///
/// Asynchronously retrieves the set of all ID relays that are currently in use.
///
/// A task that represents the asynchronous operation. The task result contains a of the ID relays currently in use.
Task> FindAllIdRelaysInUse();
///
/// Asynchronously retrieves the set of all ID beacons currently in use.
///
/// A task containing a of the ID beacons that are active or in use.
Task> FindAllIdBeaconsInUse();
///
/// Retrieves all Point of Care entries associated with the specified unit, including their related devices.
///
/// The unique identifier of the unit whose Point of Care entries should be retrieved.
/// A task that represents the asynchronous operation. The task result contains a collection of Point of Care entries with their devices, or null if no entries are found for the given unit.
Task?> FindAllByUnitIdWithDevices(ObjectId unitId);
}