using adas_core.Domain.Enums;
using adas_core.Domain.Models.Filter;
using adas_core.Domain.Models.Masters;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Responses;
using MongoDB.Bson;

namespace adas_core.Application.Services.Interfaces;

public interface IPointOfCareService
{
    Task Delete(ObjectId id);

    Task<PointOfCare?> Update(PointOfCare pointOfCare);

    Task UpdateUnit(ObjectId id, Unit unit);
    Task<List<PointOfCare>> GetAll();

    Task<List<PointOfCare>> GetAllConfigs();
    Task<List<PointOfCare>> GetAllLocationInfo();

    Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration);

    Task<PointOfCare?> FindById(ObjectId id);
    Task<PointOfCare?> FindByIdAllConfig(ObjectId id);

    Task<IEnumerable<PointOfCare>?> FindAllByUnitId(ObjectId unit);

    Task<IEnumerable<PointOfCare>?> FindByRoom(string room);

    Task<IEnumerable<PointOfCare>?> FindByBed(string bed);

    Task<List<PointOfCare>> FindAllByUnitIds(List<ObjectId> unitIds);

    Task<PointOfCare?> GetInfo(ObjectId id, LocaleEnum? locale = null, bool fillPatientData = true, CancellationToken ct = default);

    Task<PointOfCare?> InsertPointOfCare(PointOfCare pointOfCare);
    Task<PointOfCare?> FindPoCByPatientId(ObjectId patientId);

    Task SetPointOfCareStatus(ObjectId id, StatusEnum.PointOfCare status);

    Task<IEnumerable<PointOfCare>> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare poc,
        bool excludeVirtual = false);

    void CheckNextAdmission(ObjectId? patientLocation);
    Task<PointOfCare?> FindByBedAndUnitId(string? bed, ObjectId? unitId);
    Task UpdateRelayConfig(PointOfCare poc);
    Task<PointOfCare?> FindPoCByPatientNumber(string patientNumber);

    Task<long> CountPoCsByUnitId(ObjectId unitId);
    Task<long> CountVirtualPoCsByUnitId(ObjectId unitId);
    Task<PaginationResponse<PointOfCare>> GetPaginatedPoCs(PaginationFilter filter);
    Task DeletePoCsByUnitId(ObjectId unitId);
    Task<HashSet<ObjectId>> FindAllIdCamerasInUse();
    Task<HashSet<ObjectId>> FindAllIdRelaysInUse();
    Task<HashSet<ObjectId>> FindAllIdBeaconsInUse();
    Task<IEnumerable<PointOfCare>?> FindAllByUnitIdWithDevices(ObjectId unitId);
}