using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Domain.Models.DTO;
using adas_core.Domain.Models.Filter;
using adas_core.Domain.Models.GroupedObservations;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Pumps;
using adas_core.Domain.Models.Responses;
using MongoDB.Bson;

namespace adas_core.Application.Services.Interfaces;

public interface IConfigObservationService
{
    Task<ConfigObservation?> GetByCodeSysAndCode(string codingSystem, string code);
    Task<ConfigObservation?> Get(string name);

    Task<ConfigObservation?> Get<T>(T obs, bool onlyByName = false) where T : BasePatientObservation;
    
    Task<ObservatitonRetentionResult?> RetentionActions<T>(T obs) where T : BasePatientObservation;
    Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation;
    Task<PatientTreatment?> Map(PatientTreatment treatment);

    Task<StatusEnum.Type> GroupedObservationStatus(GroupedField groupedField, GroupedObservationEnum.Result result,
        string name, object value, double? min, double? max);

    Task<ICollection<ConfigObservation>> GetAllConfigs(CancellationToken ct = default);
    Task<PaginationResponse<ConfigObservation>> GetPaginatedItems(PaginationFilter filter);
    Task<ConfigObservationDto> GetAllCompact();
    Task<ConfigObservation?> GetConfigById(ObjectId id);
    Task<List<string>> GetConfigNames(string id);
    Task<List<string>> GetConfigNames();
    Task<ConfigObservation?> UpdateConfig(ConfigObservation configObservation);
    Task<ConfigObservation?> CreateConfig(ConfigObservation configObservation);
    Task<ConfigObservation?> RemoveConfigItem(string itemName);
    Task<ConfigObservation?> RemoveConfigItem(ObjectId id);
    Task<IEnumerable<ConfigObservation>?> GetConfigObservationItem(string name);

    Task<ConfigObservation?> GetSingleConfigObservationItem(string? code, string? codingSystem, string? name,
        string? originalName);

    Task<bool> DeleteSingleConfigObservationItem(ConfigObservation configObservationItem);
    Task<IEnumerable<ConfigObservation>> GetConfigObservationItemsByName(string name);
}