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

namespace adas_core.Application.Services.Interfaces;

public interface IMasterListService<T> where T : MasterList
{
    Task<IEnumerable<T>> GetAllMasterList();
    Task<IEnumerable<MasterListDto>> GetAllMasterListWithoutOptions();
    Task<IEnumerable<MasterListWithPaginatedOptionsDto>> GetAllMasterListWithPaginatedOptions(PaginationFilter request);
    Task<T?> GetMasterListById(ObjectId id, LocaleEnum? locale);

    Task<MasterListWithPaginatedOptionsDto?> GetMasterListByIdWithPaginatedOptions(ObjectId id,
        PaginationFilter request);

    Task<List<string>> GetMasterListOptionsNamesById(ObjectId id);
    Task<List<OptionList>> GetMasterListByIdAndTextSearch(ObjectId id, string? textSearch);
    Task<List<OptionList>> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement filterOption);
    Task<T?> GetMasterListByName(string name);
    Task<T?> InsertMasterList(T item);
    Task<T?> UpdateMasterList(T item);
    Task DeleteMasterListById(ObjectId id);
    Task<OptionList?> AddOptionToMasterList(ObjectId id, FilterOptionListElement opt);
    Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName, LocaleEnum locale);
    Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList opt, string typeName);
    Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName);
    Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale);
    Task<UpdateMasterListDetailsDto?> UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt);
    Task<bool> UpdateMasterListName(ObjectId id, string name);
    Task<bool> UpdateMasterListDescription(ObjectId id, string name);
    Task<bool> RemoveMasterListOption(ObjectId id, OptionList oldOpt);
    Task<int> GetAllMasterListCount();
    Task<PaginationResponse<T>> GetPaginatedMasterList(PaginationFilter filter);
    Task<bool> DeleteMasterListOption(ObjectId id, ObjectId optId, string typeName);

    Task<PaginationResponse<MasterListWithPaginatedOptionsDto>> GetPaginatedMasterListWithPaginatedOptions(
        PaginationFilter listFilter, PaginationFilter optionsFilter);

    Task<PaginationResponse<OptionList>> GetPaginatedOptions(PaginationFilter filter, ObjectId listId);
    Task<ObjectId?> GetAssociatedList(ObjectId id, MasterListType masterListType1, MasterListType masterListType2);
    Task<List<string>> GetOptionsOfList(ObjectId id);
}