# Interface IDisplayRepository

Namespace
  adas_core.Application.Repositories.Interfaces

Assembly
  adas-core.Application.dll

Repository abstraction for Display entities persisted in MongoDB.

    public interface IDisplayRepository : IMongoRepository<Display>

Inherited Members
  IMongoRepository<Display>.Collection
  IMongoRepository<Display>.GetCollectionName()
  IMongoRepository<Display>.InsertOneAsync(Display)
  IMongoRepository<Display>.DeleteAsync(ObjectId)
  IMongoRepository<Display>.UpdateOneAsync(ObjectId, Display)

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Methods

### CountByUnitId(ObjectId)

Counts the number of displays that belong to the specified unit.

    Task<long> CountByUnitId(ObjectId unitId)

#### Parameters

`unitId` ObjectId

  The MongoDB.Bson.ObjectId of the unit.

#### Returns

Task<long>

  A Task<TResult> representing the asynchronous operation. The task result contains the number of displays for the unit.

### DeleteManyByUnitId(ObjectId)

Deletes every display that belongs to the specified unit.

    Task<bool> DeleteManyByUnitId(ObjectId unitId)

#### Parameters

`unitId` ObjectId

  The MongoDB.Bson.ObjectId of the unit whose displays should be removed.

#### Returns

Task<bool>

  A Task<TResult> representing the asynchronous operation. The task result is true when at least one display was deleted; otherwise, false.

### GetAll()

Retrieves every display stored in the collection.

    Task<List<Display>> GetAll()

#### Returns

Task<List<Display>>

  A Task<TResult> representing the asynchronous operation. The task result contains all displays, or an empty list if none exist.

### GetByCardConfigId(ObjectId)

Retrieves all displays that reference the supplied card-configuration identifier.

    Task<List<Display>> GetByCardConfigId(ObjectId configId)

#### Parameters

`configId` ObjectId

  The MongoDB.Bson.ObjectId of the card configuration to filter by.

#### Returns

Task<List<Display>>

  A Task<TResult> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.

### GetByConfigId(ObjectId)

Retrieves all displays whose `DisplayConfigId` matches the supplied value.

    Task<List<Display>> GetByConfigId(ObjectId id)

#### Parameters

`id` ObjectId

  The MongoDB.Bson.ObjectId of the display configuration to filter by.

#### Returns

Task<List<Display>>

  A Task<TResult> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.

### GetById(ObjectId)

Retrieves a display by its unique identifier.

    Task<Display?> GetById(ObjectId id)

#### Parameters

`id` ObjectId

  The MongoDB.Bson.ObjectId of the display to retrieve.

#### Returns

Task<Display>

  A Task<TResult> representing the asynchronous operation. The task result contains the Display if found; otherwise, null.

### GetByIdWithConfigDisplay(ObjectId)

Retrieves a display by its identifier, eagerly loading its associated DisplayConfig document.

    Task<Display?> GetByIdWithConfigDisplay(ObjectId id)

#### Parameters

`id` ObjectId

  The MongoDB.Bson.ObjectId of the display to retrieve.

#### Returns

Task<Display>

  A Task<TResult> representing the asynchronous operation. The task result contains the Display with its config populated if found; otherwise, null.

### GetByName(string)

Retrieves the display whose `Name` exactly matches the supplied value.

    Task<Display?> GetByName(string name)

#### Parameters

`name` string

  The display name to look up.

#### Returns

Task<Display>

  A Task<TResult> representing the asynchronous operation. The task result contains the Display if found; otherwise, null.

### GetByPointOfCare(PointOfCare)

Retrieves all displays that include the specified point-of-care in their point-of-care list.

    Task<List<Display>> GetByPointOfCare(PointOfCare pointOfCare)

#### Parameters

`pointOfCare` PointOfCare

  The PointOfCare to filter by.

#### Returns

Task<List<Display>>

  A Task<TResult> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.

### GetByUnitId(ObjectId)

Retrieves all displays that belong to the specified unit.

    Task<List<Display>> GetByUnitId(ObjectId id)

#### Parameters

`id` ObjectId

  The MongoDB.Bson.ObjectId of the unit.

#### Returns

Task<List<Display>>

  A Task<TResult> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.

### GetPaginatedDisplays(PaginationFilter)

Builds a paginated, sorted, and filtered query over displays according to the supplied PaginationFilter.

    IFindFluent<Display, Display> GetPaginatedDisplays(PaginationFilter filter)

#### Parameters

`filter` PaginationFilter

  The PaginationFilter containing pagination and filter criteria.

#### Returns

IFindFluent<Display, Display>

  An MongoDB.Driver.IFindFluent<TDocument, TProjection> instance that can be used to further refine and execute the query.

### IsDisplayConfigInUse(ObjectId)

Counts the number of displays that currently reference the supplied display configuration.

    Task<long> IsDisplayConfigInUse(ObjectId displayConfigId)

#### Parameters

`displayConfigId` ObjectId

  The MongoDB.Bson.ObjectId of the display configuration to check for usage.

#### Returns

Task<long>

  A Task<TResult> representing the asynchronous operation. The task result contains the number of displays referencing the configuration.

### UpdateConfig(ObjectId, DisplayConfig)

Replaces the DisplayConfig of the display identified by `oldDisplayId` with the supplied configuration instance.

    Task<Display?> UpdateConfig(ObjectId oldDisplayId, DisplayConfig newDisplayConfigCast)

#### Parameters

`oldDisplayId` ObjectId

  The MongoDB.Bson.ObjectId of the display whose configuration should be replaced.

`newDisplayConfigCast` DisplayConfig

  The new DisplayConfig instance to assign to the display.

#### Returns

Task<Display>

  A Task<TResult> representing the asynchronous operation. The task result contains the updated Display if the update succeeded; otherwise, null.

### UpdateConfigId(ObjectId, ObjectId)

Updates the `DisplayConfigId` of the specified display.

    Task<Display?> UpdateConfigId(ObjectId objectId, ObjectId displayConfigId)

#### Parameters

`objectId` ObjectId

  The MongoDB.Bson.ObjectId of the display to update.

`displayConfigId` ObjectId

  The new MongoDB.Bson.ObjectId of the display configuration to associate with the display.

#### Returns

Task<Display>

  A Task<TResult> representing the asynchronous operation. The task result contains the updated Display if the update succeeded; otherwise, null.

### UpdateConfigPreset(ObjectId, ObjectId)

Associates the display with an existing display-config preset by setting its `DisplayConfigId` to the supplied identifier.

    Task<Display?> UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay)

#### Parameters

`objectIdDisplay` ObjectId

  The MongoDB.Bson.ObjectId of the display to update.

`objectIdConfigDisplay` ObjectId

  The MongoDB.Bson.ObjectId of the display-config preset to associate.

#### Returns

Task<Display>

  A Task<TResult> representing the asynchronous operation. The task result contains the updated Display if the update succeeded; otherwise, null.

### UpdateName(Display, string)

Updates the `Name` of the supplied display instance and persists it.

    Task<Display> UpdateName(Display display, string name)

#### Parameters

`display` Display

  The Display instance to update. Its MongoDB.Bson.ObjectId is used to identify the document.

`name` string

  The new display name.

#### Returns

Task<Display>

  A Task<TResult> representing the asynchronous operation. The task result contains the updated Display.

### UpdatePointOfCareList(ObjectId, List<ObjectId>)

Replaces the point-of-care list of the specified display with the supplied set of point-of-care identifiers.

    Task<Display?> UpdatePointOfCareList(ObjectId objectId, List<ObjectId> listPocObId)

#### Parameters

`objectId` ObjectId

  The MongoDB.Bson.ObjectId of the display to update.

`listPocObId` List<ObjectId>

  The new list of MongoDB.Bson.ObjectId values representing the point-of-cares to associate with the display.

#### Returns

Task<Display>

  A Task<TResult> representing the asynchronous operation. The task result contains the updated Display if the update succeeded; otherwise, null.