using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;

namespace adas_core.Application.Repositories.Interfaces;

public interface IArchivePatientCarePlanRepository : IMongoRepository<PatientCarePlan>
{
    /// <summary>
    /// Retrieves the list of care plans associated with the specified patient identifier.
    /// </summary>
    /// <param name="patientId">The unique identifier of the patient whose care plans should be retrieved.</param>
    /// <returns>A task that returns a list of <see cref="PatientCarePlan"/> objects for the given patient, or <c>null</c> when no care plans are found.</returns>
    Task<List<PatientCarePlan>?> FindByPatientId(ObjectId patientId);
    /// <summary>
    /// Retrieves the list of patient care plans associated with the specified patient identifier.
    /// </summary>
    /// <param name="patientId">The unique identifier of the patient whose care plans are being queried.</param>
    /// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientCarePlan"/> for the given patient, or <c>null</c> if no care plans are found.</returns>
    Task<List<PatientCarePlan>?> FindByPatientId(string patientId);
    /// <summary>
    /// Asynchronously retrieves the list of care plans associated with the specified patient number, returning <c>null</c> when no matching care plans are found.
    /// </summary>
    /// <param name="patientId">The patient number used to look up the associated care plans.</param>
    /// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> entries for the patient, or <c>null</c> if none exist.</returns>
    Task<List<PatientCarePlan>?> FindByPatientNumber(string patientId);
    /// <summary>
    /// Asynchronously retrieves all patient care plans from the data store.
    /// </summary>
    /// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="PatientCarePlan"/> entries.</returns>
    Task<List<PatientCarePlan>> FindAll();

    /// <summary>
    /// Asynchronously retrieves a list of patient care plans matching the provided legacy patient identifiers.
    /// </summary>
    /// <param name="oldPatientId">The legacy <see cref="ObjectId"/> identifier used to locate the patient.</param>
    /// <param name="oldPatientPatientId">An optional legacy patient ID string used as an additional lookup criterion.</param>
    /// <param name="oldPatientPatientNumber">An optional legacy patient number string used as an additional lookup criterion.</param>
    /// <returns>A <see cref="Task{TResult}"/> containing a nullable list of <see cref="PatientCarePlan"/> records, or <c>null</c> if no matching care plans are found.</returns>
    Task<List<PatientCarePlan>?> FindByIds(ObjectId oldPatientId, string? oldPatientPatientId,
            string? oldPatientPatientNumber);

    /// <summary>
    /// Asynchronously inserts a collection of patient care plans into the underlying data store.
    /// </summary>
    /// <param name="patientCarePla">The list of <see cref="PatientCarePlan"/> records to be inserted.</param>
    Task InsertManyAsync(List<PatientCarePlan> patientCarePla);
}