using adas_core.Domain.Models;
using adas_core.Domain.Models.DTO;
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 IAdmissionService : IApiRequestService
{
///
/// Asynchronously retrieves an admission by its unique identifier, returning null when no matching admission is found.
///
/// The unique identifier of the admission to retrieve.
/// A task that represents the asynchronous operation, containing the if found, or null if no admission matches the specified identifier.
Task GetAdmissionByIdAsync(ObjectId admissionId);
///
/// Asynchronously deletes an admission record identified by the specified admission ID.
///
/// The unique identifier of the admission to delete.
Task DeleteAdmissionByIdAsync(ObjectId admissionId);
///
/// Asynchronously deletes the specified admission record.
///
/// The admission entity to remove.
Task DeleteAdmissionAsync(Admission admission);
///
/// Deletes all admissions associated with the specified unit identifier.
///
/// The identifier of the unit whose admissions will be deleted.
Task DeleteAdmissionsByUnitId(ObjectId unitId);
///
/// Asynchronously updates an existing admission record with the provided information.
///
/// The admission entity containing the updated data to be persisted.
/// A task that represents the asynchronous update operation.
Task UpdateAdmissionAsync(Admission admission);
///
/// Asynchronously retrieves a collection of admissions.
///
/// A task that represents the asynchronous operation. The task result contains an enumerable collection of objects.
Task> GetAdmissionsAsync();
///
/// Asynchronously inserts a new admission record and returns the created entry, or if the insertion was not performed.
///
/// The admission entity to be inserted into the data store.
/// A task that represents the asynchronous operation. The task result contains the inserted , or when no record is produced.
Task InsertAdmission(Admission admission);
///
/// Admits a patient based on the provided admission details, optionally registering the patient as new.
///
/// The admission information used to process the patient admission.
/// Indicates whether the patient is being admitted for the first time. Defaults to false.
Task AdmitPatient(Admission admission, bool isNew = false);
///
/// Processes the return of a patient to the admissions workflow, typically used when a patient needs to be re-queued or reinstated for admission processing.
///
/// The unique identifier of the patient to be returned to admissions.
Task ReturnPatientToAdmissions(ObjectId patientId);
///
/// Asynchronously returns a patient to the admissions workflow using the specified admission record.
///
/// The unique identifier of the patient being returned to admissions.
/// The admission record associated with the patient being returned.
Task ReturnPatientToAdmissions(ObjectId patientId, Admission adm);
///
/// Retrieves a list of admissions associated with the specified patient location.
///
/// The patient location used to filter the admissions.
/// A task that represents the asynchronous operation, containing a list of admissions for the given location.
Task> GetAdmissionByLocation(PatientLocation location);
///
/// Asynchronously retrieves the list of admissions associated with the specified point of care identifier.
///
/// The of the point of care used to filter the admissions.
/// A task that represents the asynchronous operation. The task result contains a list of objects matching the specified point of care id, or an empty list if no admissions are found.
Task> GetAdmissionByPointOfCareId(ObjectId id);
///
/// Retrieves the list of admissions associated with the specified point of care, localized for the given locale.
///
/// The identifier of the point of care whose admissions are being queried.
/// The locale used to localize the returned admission data.
/// A task that resolves to the list of admissions matching the point of care and locale; an empty list when no matches are found.
Task> GetAdmissionByPointOfCareIdAndLocale(ObjectId pocId, LocaleEnum locale);
///
/// Retrieves a list of admissions associated with the specified unit identifier, excluding any Point of Care (PoC) related admissions.
///
/// The unique identifier of the unit whose admissions should be retrieved.
/// A task that represents the asynchronous operation. The task result contains a list of admissions for the specified unit, excluding PoC admissions.
Task> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId);
///
/// Asynchronously counts the number of admissions associated with the specified unit identifier.
///
/// The MongoDB ObjectId of the unit whose admissions should be counted.
/// A task that represents the asynchronous operation, containing the total count of admissions for the given unit.
Task CountAdmissionsByUnitId(ObjectId unitId);
///
/// Searches for a patient by their patient number within the specified unit, returning the matching patient search result or null if no match is found.
///
/// The patient number used to identify the patient.
/// The identifier of the unit in which the patient is being searched.
/// A task that returns the matching if found; otherwise, null.
Task SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
///
/// Retrieves the admission record associated with the specified patient number, returning null when no matching admission is found.
///
/// The unique patient number used to look up the admission.
/// A task that resolves to the matching , or null if no admission exists for the given patient number.
Task GetAdmissionByPatientNumber(string patientNumber);
///
/// Updates a patient master list item based on the provided option change and related unit and type information.
///
/// The update option master list data transfer object containing the change details.
/// The collection of units associated with the master list item change.
/// The name of the type used to identify the master list item category.
/// A task that represents the asynchronous update operation.
Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable unitList, string typeName);
///
/// Deletes a patient master list item identified by the specified options, units, and type name.
///
/// The option list used to identify the master list item to delete.
/// The collection of units associated with the master list item.
/// The name of the type associated with the master list item.
Task DeletePatientMasterListItem(OptionList opt, IEnumerable unitList, string typeName);
}