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

namespace adas_core.Application.Services.Interfaces;

public interface IPatientCarePlanService
{
    /// <summary>
    /// Retrieves a 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 retrieved.</param>
    /// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> records for the given patient.</returns>
    Task<List<PatientCarePlan>> FindByPatientId(ObjectId patientId);
    /// <summary>
    /// Retrieves a list of patient care plans associated with the specified user identifier.
    /// </summary>
    /// <param name="userId">The unique identifier of the user whose patient care plans are being retrieved.</param>
    /// <returns>A task that represents the asynchronous operation. The task result contains a list of patient care plans associated with the user.</returns>
    Task<List<PatientCarePlan>> FindByUserId(ObjectId userId);
    /// <summary>
    /// Retrieves all patient care plans from the system.
    /// </summary>
    /// <returns>A task containing a list of all <see cref="PatientCarePlan"/> records.</returns>
    Task<List<PatientCarePlan>> FindAll();
    /// <summary>
    /// Asynchronously inserts a single patient care plan into the underlying data store.
    /// </summary>
    /// <param name="patientCarePlan">The patient care plan to insert.</param>
    Task InsertOneAsync(PatientCarePlan patientCarePlan);
    /// <summary>
    /// Archives the care plan associated with a finished procedure for the specified patient, processing the provided list of items to be archived.
    /// </summary>
    /// <param name="patientWithFinishedProcedure">The patient whose procedure has been completed and whose care plan should be archived.</param>
    /// <param name="itemsToArchive">The collection of option list items to be archived as part of the care plan archival process.</param>
    Task ArchiveCarePlanFromJob(Patient patientWithFinishedProcedure, List<OptionList> itemsToArchive);

    /// <summary>
    /// Asynchronously archives records associated with the specified patient identifier.
    /// </summary>
    /// <param name="patientid">The unique identifier of the patient whose records are to be archived.</param>
    Task ArchiveByPatientId(ObjectId patientid);
    /// <summary>
    /// Updates the ObjectId references from the specified old identifier to a new one across multiple records associated with the given patient.
    /// </summary>
    /// <param name="patientid">The string identifier of the patient whose related records will be updated.</param>
    /// <param name="patientId">The ObjectId of the patient used to locate the records to update.</param>
    /// <param name="oldId">The existing ObjectId value to be replaced in the matched records.</param>
    Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId);
}