using adas_core.Domain.Enums; using adas_core.Domain.Models.DTO; using adas_core.Domain.Models.DTO.Display; 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 IDisplayService { //Task> GetAll(string? userName, List displayIdByAuthorities); /// /// Asynchronously retrieves all displays in a compact format containing only minimal identifying information. /// /// A task that represents the asynchronous operation. The task result contains a list of objects representing all available displays in a compact projection. Task> GetAllCompact(); /// /// Retrieves all displays along with their associated permissions for the specified user. /// When is null, the behavior is determined by the underlying implementation (e.g., returning all displays or an empty result). /// /// The username used to look up the associated displays and permissions. May be null. /// A task that represents the asynchronous operation, containing a list of entries for the user. Task> GetAllByUser(string? userName); /// /// Asynchronously retrieves a list of entries filtered by the specified display type. /// /// The display type used to filter the returned collection. /// A task that represents the asynchronous operation, containing the list of items matching the specified type. Task> GetByType(DisplayConfigEnums.DisplayType type); /// /// Asynchronously retrieves the list of displays associated with the specified point of care. /// /// The point of care used to filter the displays to be returned. /// A task that represents the asynchronous operation, containing the list of items linked to the given point of care. Task> GetByPointOfCare(PointOfCare pointOfCare); /// /// Retrieves a list of displays associated with the specified configuration identifier. /// /// The unique identifier of the configuration used to filter the displays. /// A task that represents the asynchronous operation. The task result contains a list of displays matching the specified configuration identifier. Task> GetByConfigId(ObjectId configId); /// /// Retrieves a list of entities associated with the specified card configuration identifier. /// /// The unique identifier of the card configuration whose associated displays are to be retrieved. /// A task that represents the asynchronous operation, containing a list of objects linked to the given card configuration. Task> GetByCardConfigId(ObjectId configId); // Task> GetByUser(); /// /// Retrieves a entity by its name asynchronously. /// Returns null when no matching display is found. /// /// The name of the display to look up. /// A that resolves to the matching , or null if none is found. Task GetByName(string name); /// /// Retrieves a entity by its unique identifier. /// /// The unique identifier of the display to retrieve. /// A task that represents the asynchronous operation. The task result contains the if found; otherwise, null. Task GetById(ObjectId id); /// /// Asynchronously retrieves a display representation of an entity along with its associated permissions, localized for the specified locale. /// /// The unique identifier of the entity to retrieve. /// The locale used to localize the returned display data. /// A task that represents the asynchronous operation, containing the localized display data with permissions. Task GetByIdWithPermissions(ObjectId id, LocaleEnum localeEnum); /// /// Asynchronously counts the number of displays associated with the specified unit identifier. /// /// The unique identifier of the unit whose displays should be counted. /// A task that represents the asynchronous operation. The task result contains the count of displays linked to the specified unit. Task CountDisplaysByUnitId(ObjectId unitId); /// /// Retrieves the display identified by , optionally populating related data such as point-of-care, patient, display list, and display configuration based on the corresponding fill flags. /// /// The identifier of the display to retrieve. /// The name of the user requesting the display, used for authorization checks. /// Optional collection of authorizations used to control access to the display and its related data. /// Optional locale used to localize the returned display information. /// When true, includes the associated point-of-care data in the result. /// When true, includes the associated patient data in the result. /// When true, includes the display list in the result. /// When true, includes the display configuration in the result. /// Token used to cancel the asynchronous operation. /// A that resolves to the if found, or null if no display matches the specified . Task GetInfo( ObjectId id, string? userName, List? authorizations, LocaleEnum? locale, bool fillPointOfCare = true, bool fillPatientData = false, bool fillDisplayList = true, bool fillDisplayConfig = true, CancellationToken ct = default ); /// /// Retrieves a list of minimal display sections filtered by display type, current display context, user name, and the provided authorizations. /// /// The display type used to filter the available sections. /// The identifier of the current display, or null when no display is selected. /// The user name used to resolve user-specific sections, or null if not applicable. /// The list of authorizations used to authorize and filter the returned sections, or null if no authorization filtering is required. /// A task that yields the list of instances matching the supplied criteria. Task> GetDisplaySectionByUser( DisplayConfigEnums.DisplayType type, ObjectId? currentDisplay, string? userName, List? authorizations); /// /// Asynchronously retrieves all display sections as a minimal display list. /// /// A task that represents the asynchronous operation, containing the with the display section data. Task GetAllDisplaySection(); /// /// Retrieves a list of records associated with the specified unit identifier. /// /// The that identifies the unit whose displays are being requested. /// A task that represents the asynchronous operation, containing a of displays linked to the given unit. Task> GetByUnitId(ObjectId id); /// /// Retrieves all available Points of Contact (POCs) along with their associated unit information, optionally filtered by the provided display identifiers and allowing exclusion of virtual entries. /// /// The list of display identifiers used to filter the available POCs. /// When set to true, excludes virtual POCs from the results; otherwise, virtual POCs are included. /// A task that represents the asynchronous operation. The task result contains a with the matching POCs and their unit details. Task GetAllAvailablePoc(List displayIds, bool excludeVirtual = false); /// /// Asynchronously retrieves all Points of Care (POCs) associated with the specified display identifier. /// /// The display identifier used to look up the associated Points of Care. /// A task representing the asynchronous operation, containing a list of Points of Care matching the specified display identifier. Task> GetAllPocsByDisplayId(ObjectId id); /// /// Inserts a new display record into the data store and returns the persisted entity. /// /// The display entity to insert. /// A task that represents the asynchronous operation, containing the inserted . Task InsertOne(Display display); /// /// Asynchronously inserts a single test record and returns the persisted result. /// /// A that represents the asynchronous insert operation, containing the inserted . Task InsertOneTest(); /// /// Updates the configuration of an existing display using the provided new configuration. /// /// The current display whose configuration will be updated. /// The new display configuration to apply, or null to leave the configuration unchanged. /// A task that represents the asynchronous operation. The task result contains the updated , or null if the update was not performed. Task UpdateConfig(Display oldDisplay, DisplayConfig? newDisplayConfig); /// /// Updates the configuration identifier associated with the specified display. /// /// The existing display whose configuration identifier will be updated. /// The new configuration identifier to associate with the display. /// A task that resolves to the updated , or null if no result is available. Task UpdateConfigId(Display oldDisplay, ObjectId configId); /// /// Updates the point of care list associated with the specified object identifier, replacing or merging it with the provided list of point of care object identifiers. /// /// The identifier of the object whose point of care list is being updated. /// The collection of point of care object identifiers to apply to the target object. /// A task that represents the asynchronous operation, containing the resulting when the update succeeds, or null when no matching object is found. Task UpdatePointOfCareList(ObjectId objectId, List listPocObId); /// /// Updates the configuration preset associated with the specified display using the provided configuration display. /// /// The unique identifier of the display whose configuration preset will be updated. /// The unique identifier of the configuration display to apply as the preset. /// A task that resolves to the updated , or null if no matching display is found. Task UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay); /// /// Updates the name of the entity identified by the given identifier and returns the resulting . /// /// The identifier of the entity whose name should be updated. /// The new name to apply to the entity. /// A task that represents the asynchronous update operation, containing the updated or null if no entity was found. Task UpdateName(ObjectId id, string name); /// /// Retrieves a paginated collection of displays based on the provided filter criteria. /// /// The pagination filter that defines the page size, page number, and any additional filtering criteria for the display results. /// A task that represents the asynchronous operation, containing a with the requested page of displays and pagination metadata. Task> GetPaginatedDisplays(PaginationFilter filter); /// /// Asynchronously deletes the display identified by the specified identifier. /// /// The unique identifier of the display to delete. /// A task that represents the asynchronous operation, containing a value indicating whether the display was successfully deleted. Task DeleteDisplay(ObjectId id); /// /// Retrieves the list of display configuration locations associated with the specified display configuration. /// /// The unique identifier of the display configuration whose locations are being retrieved. /// A task that represents the asynchronous operation, containing a list of objects for the specified display configuration. Task> GetDisplayConfigLocations(ObjectId displayConfigId); /// /// Asynchronously determines whether the specified display configuration is currently in use. /// /// The identifier of the display configuration to check. /// A task that represents the asynchronous operation. The task result is true if the display configuration is in use; otherwise, false. Task IsDisplayConfigInUse(ObjectId displayConfigId); /// /// Deletes display records associated with the specified unit identifier. /// /// The identifier of the unit whose displays should be removed. Task DeleteDisplaysByUnitId(ObjectId unitId); }