using adas_core.Domain.Models;
using adas_core.Domain.Models.DTO;
using adas_core.Domain.Models.Filter;
using adas_core.Domain.Models.Masters;
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
using MongoDB.Driver;

namespace adas_core.Application.Repositories.Interfaces;

public interface IPatientRepository : IMongoRepository<Patient>
{
    Task Delete(ObjectId id);
    Task<Patient?> FindByLocation(PatientLocation location);
    Task<Patient?> FindById(ObjectId id);
    Task UpdateLocation(ObjectId id, PatientLocation location);
    Task UpdateLocation(ObjectId id, ObjectId location);
    Task UpdateAttendingDoctor(ObjectId id, Person attendingDoctor);
    Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true);
    Task Update(Patient patient);
    Task<Patient?> FindByPatientNumber(string patientNumber);
    Task<Patient?> FindByPatientId(string patientId);
    Task<List<Patient>> FindAll();
    Task<List<Patient>> FindByPointOfCare(string pointOfCare);
    Task<List<Patient>> FindByPointOfCare(ObjectId pointOfCare);
    Task<Patient?> FindByPointOfCareId(ObjectId pointOfCare);
    Task<List<Patient>> FindDischargedPatients();
    Task<Patient?> UpdateOne(Patient updatedPatient);
    Task<List<Patient>> FindInActivePoC();
    Task<List<Patient>> FindInInactivePoC();
    Task<List<Patient>> FindPatientsNotUpdatedSince(DateTime date);
    Task<Patient?> FindByPatientId(ObjectId patientId);
    Task<Patient?> UpdatePatientIncomingData(ObjectId patientId, Patient person);
    Task<Patient?> UpdatePatientDemographicData(ObjectId patientId, Patient person);
    Task<Patient> FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare);
    Task<long> CountByUnitId(ObjectId unitId);
    Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
    IFindFluent<Patient, Patient> GetPaginatedPatients(PaginationFilter filter);
    Task<List<Patient>> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes);
    Task<List<Patient>> FindAllPatientWithFinishedTests(int archiveTestEndDateAfterMinutes);
    Task<List<Patient>> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes);
    Task<List<Patient>> UpdateMasterListOption(List<ObjectId> unitIds, UpdateOptionMasterListDto opt, string typeName);
    Task<List<Patient>> GetPatientsByUnitIds(List<ObjectId> unitIds, string typeName);
    Task<IEnumerable<Patient>> DeleteMasterListOption(List<ObjectId> unitIds, OptionList opt, string typeName);
}