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

namespace adas_core.Application.Repositories.Interfaces;

public interface IMasterListRepository<T> : IMongoRepository<T> where T : MasterList
{
    Task Delete(ObjectId id);
    Task Update(T list);
    Task<T?> FindById(ObjectId id, LocaleEnum? locale);
    Task<T?> FindById(ObjectId id);
    Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale);
    Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId);
    Task<IEnumerable<T>> GetAll();
    Task<IEnumerable<MasterListDto>> GetAllWithoutOptions();
    Task<T?> FindByName(string name);
    Task<List<OptionList>> GetMasterListByIdAndTextSearchContaining(ObjectId id, string? textSearch);
    Task<OptionList?> AddOptionToMasterList(ObjectId id, FilterOptionListElement opt);
    Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList newOpt, LocaleEnum locale);
    Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList newOpt);
    Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList newOpt);
    Task<bool> DeleteMasterListOption(ObjectId id, ObjectId deleteOptId);
    Task<UpdateMasterListDetailsDto?> UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt);
    Task<bool> UpdateMasterListName(ObjectId id, string name);
    Task<bool> UpdateMasterListDescription(ObjectId id, string description);
    Task<bool> RemoveMasterListOption(ObjectId id, OptionList oldOpt);
    IFindFluent<T, T> GetPaginatedMasterList(PaginationFilter filter);
    Task<List<OptionList>> GetPaginatedOptions(PaginationFilter filter, ObjectId listId);
    Task<int> Count();
    Task<List<OptionList>> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement? filterOption);
}