# Interface IDischargeRepository

Namespace
  adas_core.Application.Repositories.Interfaces

Assembly
  adas-core.Application.dll

    public interface IDischargeRepository : IMongoRepository<Discharge>

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

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

## Methods

### CountByUnitId(ObjectId)

Asynchronously counts the number of records associated with the specified unit identifier.

    Task<long> CountByUnitId(ObjectId unitId)

#### Parameters

`unitId` ObjectId

  The ObjectId of the unit whose associated records will be counted.

#### Returns

Task<long>

  A task that represents the asynchronous operation. The task result contains the count of records for the specified unit.

### Delete(ObjectId)

Deletes the entity identified by the specified identifier.

    Task Delete(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the entity to delete.

#### Returns

Task

### DeleteByUnitId(ObjectId)

Deletes the entity associated with the specified unit identifier.

    Task<bool> DeleteByUnitId(ObjectId unitId)

#### Parameters

`unitId` ObjectId

  The unique identifier of the unit whose associated record should be removed.

#### Returns

Task<bool>

  A task that represents the asynchronous operation. The result is `true` if a record was deleted; otherwise, `false`.

### DeleteMasterListOption(List<ObjectId>, OptionList, string)

Deletes the specified master list option from the given units and returns the resulting discharges.

    Task<IEnumerable<Discharge>> DeleteMasterListOption(List<ObjectId> unitIds, OptionList opt, string typeName)

#### Parameters

`unitIds` List<ObjectId>

  The identifiers of the units from which the option will be removed.

`opt` OptionList

  The master list option to delete.

`typeName` string

  The type name associated with the option.

#### Returns

Task<IEnumerable<Discharge>>

  A task that represents the asynchronous operation, containing the collection of Discharge objects resulting from the deletion.

### FindAll()

Asynchronously retrieves all discharge records.

    Task<IEnumerable<Discharge>> FindAll()

#### Returns

Task<IEnumerable<Discharge>>

  A task that represents the asynchronous operation. The task result contains a collection of all Discharge entities.

### FindByDestination(string)

Asynchronously retrieves the collection of discharge records associated with the specified destination.

    Task<IEnumerable<Discharge>?> FindByDestination(string destination)

#### Parameters

`destination` string

  The destination identifier used to look up matching discharge records.

#### Returns

Task<IEnumerable<Discharge>>

  A task that yields an IEnumerable<T> of matching discharge records, or `null` if no records are found for the given destination.

### FindById(ObjectId)

Retrieves a Discharge record by its unique identifier.

    Task<Discharge?> FindById(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the discharge record to find.

#### Returns

Task<Discharge>

  A task that represents the asynchronous operation. The task result contains the Discharge if a matching record is found; otherwise, `null`.

### FindByPoCId(ObjectId)

Asynchronously retrieves the collection of Discharge records associated with the specified point-of-care identifier.

    Task<IEnumerable<Discharge>?> FindByPoCId(ObjectId pocId)

#### Parameters

`pocId` ObjectId

  The point-of-care identifier used to look up the associated discharges.

#### Returns

Task<IEnumerable<Discharge>>

  A task that returns an IEnumerable<T> of Discharge records, or null if no discharges are found for the given point-of-care identifier.

### FindByService(string)

Asynchronously retrieves a collection of discharges associated with the specified service. Returns null when no matching discharges are found for the given service.

    Task<IEnumerable<Discharge>?> FindByService(string service)

#### Parameters

`service` string

  The service identifier used to look up matching discharge records.

#### Returns

Task<IEnumerable<Discharge>>

  A task that represents the asynchronous operation. The result is an IEnumerable<T> of Discharge entries for the specified service, or `null` if none are found.

### FindByUnit(string)

Asynchronously retrieves a collection of Discharge records associated with the specified unit, or null if no matching records are found.

    Task<IEnumerable<Discharge>?> FindByUnit(string unit)

#### Parameters

`unit` string

  The unit identifier used to filter the discharge records.

#### Returns

Task<IEnumerable<Discharge>>

  A task that represents the asynchronous operation. The result is an IEnumerable<T> of Discharge containing the matching records, or null when no records are found.

### GetByPatientId(ObjectId)

Retrieves the discharge record associated with the specified patient identifier, or null if no discharge exists for that patient.

    Task<Discharge?> GetByPatientId(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose discharge record is being requested.

#### Returns

Task<Discharge>

  A Task<TResult> that resolves to the matching Discharge, or null when no record is found.

### GetDischargeByLocation(PatientLocation)

Asynchronously retrieves the discharge record associated with the specified patient location, returning null if no discharge is found for that location.

    Task<Discharge?> GetDischargeByLocation(PatientLocation location)

#### Parameters

`location` PatientLocation

  The patient location used to look up the associated discharge record.

#### Returns

Task<Discharge>

  A task that represents the asynchronous operation. The task result contains the matching Discharge if found; otherwise, `null`.

### GetDischargeByPointOfCareId(ObjectId)

Retrieves the discharge associated with the specified point of care identifier.

    Task<Discharge?> GetDischargeByPointOfCareId(ObjectId poc)

#### Parameters

`poc` ObjectId

  The identifier of the point of care used to look up the discharge.

#### Returns

Task<Discharge>

  A task that returns the matching Discharge if one is found; otherwise, `null`.

### GetDischargesByUnitIds(IEnumerable<ObjectId>?)

Asynchronously retrieves a collection of Discharge records associated with the specified unit identifiers.

    Task<IEnumerable<Discharge>?> GetDischargesByUnitIds(IEnumerable<ObjectId>? unitIds)

#### Parameters

`unitIds` IEnumerable<ObjectId>

  The collection of unit identifiers used to look up the matching discharges. May be `null`.

#### Returns

Task<IEnumerable<Discharge>>

  A task that represents the asynchronous operation, containing a collection of Discharge objects, or `null` when no matching discharges are available.

### Update(Discharge)

Asynchronously updates an existing discharge record.

    Task Update(Discharge discharge)

#### Parameters

`discharge` Discharge

  The discharge entity containing the updated information to be persisted.

#### Returns

Task

### UpdateMasterListOption(List<ObjectId>, UpdateOptionMasterListDto, string)

Updates the master list option for the specified units based on the provided update details and type name.

    Task<IEnumerable<Discharge>> UpdateMasterListOption(List<ObjectId> unitIds, UpdateOptionMasterListDto opt, string typeName)

#### Parameters

`unitIds` List<ObjectId>

  The list of unit identifiers to be updated.

`opt` UpdateOptionMasterListDto

  The update option master list data transfer object containing the new option details.

`typeName` string

  The name of the type to which the master list option applies.

#### Returns

Task<IEnumerable<Discharge>>

  A task that represents the asynchronous operation. The task result contains a collection of updated Discharge records.

### UpdatePatient(ObjectId, Patient)

Updates an existing patient record identified by the specified identifier with the provided patient data.

    Task UpdatePatient(ObjectId id, Patient patient)

#### Parameters

`id` ObjectId

  The unique identifier of the patient to update.

`patient` Patient

  The patient object containing the updated information to be applied to the existing record.

#### Returns

Task

### UpdateUnit(ObjectId, string)

Asynchronously updates the unit associated with the specified object identifier.

    Task UpdateUnit(ObjectId id, string unit)

#### Parameters

`id` ObjectId

  The unique identifier of the object whose unit will be updated.

`unit` string

  The new unit value to assign to the object.

#### Returns

Task