# Interface IPumpAlarmEventRepository

Namespace
  adas_core.Application.Repositories.Interfaces

Assembly
  adas-core.Application.dll

    public interface IPumpAlarmEventRepository

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

## Methods

### DeleteByPatientId(ObjectId)

Deletes records associated with the specified patient identifier.

    Task DeleteByPatientId(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose records should be deleted.

#### Returns

Task

### FindByDeviceIdAsync(string, DateTime?, DateTime?, int?)

Retrieves pump alarm events associated with the specified device, optionally filtered by a date range and capped by a maximum result count.

    Task<IEnumerable<PumpAlarmEvent>> FindByDeviceIdAsync(string deviceId, DateTime? from = null, DateTime? to = null, int? limit = null)

#### Parameters

`deviceId` string

  The unique identifier of the device whose alarm events should be returned.

`from` DateTime?

  Optional start of the date range used to filter the events.

`to` DateTime?

  Optional end of the date range used to filter the events.

`limit` int?

  Optional maximum number of alarm events to return.

#### Returns

Task<IEnumerable<PumpAlarmEvent>>

  A task that represents the asynchronous operation, containing the collection of pump alarm events matching the criteria.

### FindLastByDeviceIdAsync(string)

Asynchronously retrieves the most recent pump alarm event associated with the specified device identifier. Returns null if no alarm event is found for the given device.

    Task<PumpAlarmEvent?> FindLastByDeviceIdAsync(string deviceId)

#### Parameters

`deviceId` string

  The unique identifier of the device whose last pump alarm event is to be retrieved.

#### Returns

Task<PumpAlarmEvent>

  A task that represents the asynchronous operation, containing the most recent PumpAlarmEvent for the device, or null if none exists.

### InsertAsync(PumpAlarmEvent)

Asynchronously inserts a pump alarm event into the underlying data store.

    Task InsertAsync(PumpAlarmEvent alarmEvent)

#### Parameters

`alarmEvent` PumpAlarmEvent

  The pump alarm event to be persisted.

#### Returns

Task

### UpdateManyObjectIdByFiledNameAsync(string, ObjectId, ObjectId)

Asynchronously updates the ObjectId value of multiple records where the specified field currently matches the old identifier, replacing it with the new identifier.

    Task<long> UpdateManyObjectIdByFiledNameAsync(string fieldName, ObjectId newId, ObjectId oldId)

#### Parameters

`fieldName` string

  The name of the field whose value should be updated.

`newId` ObjectId

  The new ObjectId value to assign to the matching records.

`oldId` ObjectId

  The existing ObjectId value used to identify the records to be updated.

#### Returns

Task<long>

  A task that represents the asynchronous operation, containing the number of records that were updated.