# Interface IAppointmentRepository

Namespace
  adas_core.Application.Repositories.Interfaces

Assembly
  adas-core.Application.dll

    public interface IAppointmentRepository : IMongoRepository<PatientAppointment>

Inherited Members
  IMongoRepository<PatientAppointment>.Collection
  IMongoRepository<PatientAppointment>.GetCollectionName()
  IMongoRepository<PatientAppointment>.UpdateOneAsync(ObjectId, PatientAppointment)

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

## Methods

### DeleteAsync(ObjectId)

Asynchronously deletes the entity identified by the specified identifier.

    Task DeleteAsync(ObjectId id)

#### Parameters

`id` ObjectId

  The ObjectId of the entity to delete.

#### Returns

Task

### DeleteByPatientId(ObjectId)

Asynchronously deletes records associated with the specified patient identifier.

    Task DeleteByPatientId(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique ObjectId of the patient whose related records should be removed.

#### Returns

Task

### FindByLocation(PatientLocation)

Retrieves a list of patient appointments associated with the specified location.

    Task<List<PatientAppointment>> FindByLocation(PatientLocation location)

#### Parameters

`location` PatientLocation

  The patient location used to filter and retrieve matching appointments.

#### Returns

Task<List<PatientAppointment>>

  A task that represents the asynchronous operation, containing a list of PatientAppointment entries for the given location.

### FindByPatientAndReason(ObjectId, string?)

Asynchronously retrieves a patient appointment matching the specified patient identifier and appointment reason. Returns `null` when no matching appointment is found.

    Task<PatientAppointment?> FindByPatientAndReason(ObjectId patientId, string? appointmentReason)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose appointment should be located.

`appointmentReason` string

  The appointment reason used to filter the lookup, or `null` to match any reason.

#### Returns

Task<PatientAppointment>

  A Task<TResult> that resolves to the matching PatientAppointment, or `null` if none exists.

### FindByPatientAndVisitNumber(ObjectId, string)

Asynchronously retrieves a PatientAppointment matching the specified patient identifier and visit number.

    Task<PatientAppointment?> FindByPatientAndVisitNumber(ObjectId patientId, string visitNumber)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose appointment should be located.

`visitNumber` string

  The visit number used to identify the specific appointment for the patient.

#### Returns

Task<PatientAppointment>

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

### FindByPatientIdAsync(ObjectId)

Asynchronously retrieves a cursor of PatientAppointment records associated with the specified patient identifier.

    Task<IAsyncCursor<PatientAppointment>> FindByPatientIdAsync(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique MongoDB.Bson.ObjectId of the patient whose appointments are being queried.

#### Returns

Task<IAsyncCursor<PatientAppointment>>

  A Task<TResult> that yields the matching patient appointments; the cursor may be empty if no appointments are found for the given patient.

### FindByPoC(PointOfCare)

Asynchronously retrieves the list of patient appointments associated with the specified point of care.

    Task<List<PatientAppointment>> FindByPoC(PointOfCare poc)

#### Parameters

`poc` PointOfCare

  The point of care used to filter the patient appointments.

#### Returns

Task<List<PatientAppointment>>

  A task that represents the asynchronous operation. The task result contains a list of patient appointments for the given point of care.

### GetByPatient(ObjectId)

Asynchronously retrieves the list of patient appointments associated with the specified patient identifier.

    Task<List<PatientAppointment>> GetByPatient(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose appointments are being retrieved.

#### Returns

Task<List<PatientAppointment>>

  A task that represents the asynchronous operation, containing a list of PatientAppointment objects for the specified patient.

### InsertOneAsync(PatientAppointment)

Asynchronously inserts a single patient appointment record into the data store.

    Task InsertOneAsync(PatientAppointment appointment)

#### Parameters

`appointment` PatientAppointment

  The patient appointment entity to be inserted.

#### Returns

Task

### Update(PatientAppointment)

Updates an existing patient appointment asynchronously.

    Task Update(PatientAppointment appointment)

#### Parameters

`appointment` PatientAppointment

  The patient appointment containing the updated information.

#### Returns

Task

### UpdateManyObjectId(string, ObjectId, ObjectId)

Updates the MongoDB.Bson.ObjectId field identified by `nameId` across many records, replacing the existing value `oldId` with the new value `id`.

    Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)

#### Parameters

`nameId` string

  The name of the field that contains the MongoDB.Bson.ObjectId to update.

`id` ObjectId

  The new MongoDB.Bson.ObjectId value to assign to matching records.

`oldId` ObjectId

  The current MongoDB.Bson.ObjectId value to be replaced.

#### Returns

Task