# Interface IMasterListService<T>

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface IMasterListService<T> where T : MasterList

#### Type Parameters

`T`

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Methods

### AddOptionToMasterList(ObjectId, FilterOptionListElement)

Adds the specified option element to the master option list identified by the given identifier.

    Task<OptionList?> AddOptionToMasterList(ObjectId id, FilterOptionListElement opt)

#### Parameters

`id` ObjectId

  The unique identifier of the master option list to which the option will be added.

`opt` FilterOptionListElement

  The filter option list element to append to the master list.

#### Returns

Task<OptionList>

  A task that returns the updated OptionList, or `null` if the master list could not be found.

### DeleteMasterListById(ObjectId)

Deletes a master list identified by the specified identifier.

    Task DeleteMasterListById(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the master list to delete.

#### Returns

Task

### DeleteMasterListOption(ObjectId, ObjectId, string)

Asynchronously deletes a master list option identified by the supplied identifiers.

    Task<bool> DeleteMasterListOption(ObjectId id, ObjectId optId, string typeName)

#### Parameters

`id` ObjectId

  The identifier of the master list that contains the option to delete.

`optId` ObjectId

  The identifier of the specific option to remove from the master list.

`typeName` string

  The name of the master list type to which the option belongs.

#### Returns

Task<bool>

  A task that resolves to `true` if the option was successfully deleted; otherwise, `false`.

### FindOptionItemById(ObjectId, ObjectId, LocaleEnum)

Asynchronously retrieves an option list item identified by the specified master ID, option ID, and locale.

    Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale)

#### Parameters

`masterId` ObjectId

  The identifier of the master entity that owns the option list.

`optionId` ObjectId

  The identifier of the specific option item to find.

`locale` LocaleEnum

  The locale used to retrieve the localized option item.

#### Returns

Task<OptionList>

  A task that represents the asynchronous operation, containing the matching OptionList or `null` if no item is found.

### GetAllMasterList()

Asynchronously retrieves the complete master list of items of type `T`.

    Task<IEnumerable<T>> GetAllMasterList()

#### Returns

Task<IEnumerable<T>>

  A task that represents the asynchronous operation. The task result contains an IEnumerable<T> with all items from the master list.

### GetAllMasterListCount()

Asynchronously retrieves the total count of all items in the master list.

    Task<int> GetAllMasterListCount()

#### Returns

Task<int>

  A task that represents the asynchronous operation. The task result contains the total number of items in the master list.

### GetAllMasterListWithPaginatedOptions(PaginationFilter)

Retrieves a paginated collection of master list items with their associated options based on the specified pagination filter.

    Task<IEnumerable<MasterListWithPaginatedOptionsDto>> GetAllMasterListWithPaginatedOptions(PaginationFilter request)

#### Parameters

`request` PaginationFilter

  The pagination filter containing paging criteria such as page number and page size.

#### Returns

Task<IEnumerable<MasterListWithPaginatedOptionsDto>>

  A task that represents the asynchronous operation, containing an enumerable collection of MasterListWithPaginatedOptionsDto items for the requested page.

### GetAllMasterListWithoutOptions()

Retrieves all master list entries, excluding items categorized as options.

    Task<IEnumerable<MasterListDto>> GetAllMasterListWithoutOptions()

#### Returns

Task<IEnumerable<MasterListDto>>

  A task that represents the asynchronous operation. The task result contains a collection of MasterListDto items representing the master list without options.

### GetAssociatedList(ObjectId, MasterListType, MasterListType)

Retrieves the associated list identifier for the given object based on the specified master list types.

    Task<ObjectId?> GetAssociatedList(ObjectId id, MasterListType masterListType1, MasterListType masterListType2)

#### Parameters

`id` ObjectId

  The identifier of the object whose associated list is being requested.

`masterListType1` MasterListType

  The first master list type used to determine the association.

`masterListType2` MasterListType

  The second master list type used to determine the association.

#### Returns

Task<ObjectId?>

  A task that returns the associated MongoDB.Bson.ObjectId if found, or `null` if no association exists.

### GetMasterListById(ObjectId, LocaleEnum?)

Retrieves a master list entry identified by the specified `id`, optionally resolving localized content based on the provided `locale`. Returns `null` when no matching entry is found.

    Task<T?> GetMasterListById(ObjectId id, LocaleEnum? locale)

#### Parameters

`id` ObjectId

  The unique identifier of the master list entry to retrieve.

`locale` LocaleEnum?

  The optional locale used to resolve localized fields; when `null`, a default or non-localized representation is returned.

#### Returns

Task<T>

  A task that resolves to the matching master list entry of type `T`, or `null` if the entry does not exist.

### GetMasterListByIdAndSearchOptions(ObjectId, FilterOptionListElement)

Asynchronously retrieves a master list of options associated with the specified identifier, applying the provided search and filter criteria.

    Task<List<OptionList>> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement filterOption)

#### Parameters

`id` ObjectId

  The identifier used to locate the master list to retrieve.

`filterOption` FilterOptionListElement

  The filter and search options used to refine the returned list.

#### Returns

Task<List<OptionList>>

  A task that represents the asynchronous operation, containing the list of OptionList entries that match the specified id and filter options.

### GetMasterListByIdAndTextSearch(ObjectId, string?)

Retrieves a master list of OptionList entries filtered by the specified identifier and an optional text search criterion.

    Task<List<OptionList>> GetMasterListByIdAndTextSearch(ObjectId id, string? textSearch)

#### Parameters

`id` ObjectId

  The unique identifier used to scope the master list lookup.

`textSearch` string

  An optional text string used to further filter the results; may be `null` to return all matching entries.

#### Returns

Task<List<OptionList>>

  A task that represents the asynchronous operation, containing a list of OptionList items matching the provided identifier and text search.

### GetMasterListByIdWithPaginatedOptions(ObjectId, PaginationFilter)

Asynchronously retrieves a master list along with its paginated options identified by the specified id. Returns null when no master list is found for the given identifier.

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

#### Parameters

`id` ObjectId

  The unique identifier of the master list to retrieve.

`request` PaginationFilter

  The pagination filter used to control the paginated options returned with the master list.

#### Returns

Task<MasterListWithPaginatedOptionsDto>

  A task that represents the asynchronous operation. The task result contains the MasterListWithPaginatedOptionsDto if a matching master list is found, otherwise null.

### GetMasterListByName(string)

Asynchronously retrieves a master list that matches the specified name.

    Task<T?> GetMasterListByName(string name)

#### Parameters

`name` string

  The name used to look up the master list.

#### Returns

Task<T>

  A task that represents the asynchronous operation. The result is the matching master list of type `T`, or `null` if no master list with the specified name is found.

### GetMasterListOptionsNamesById(ObjectId)

Retrieves the list of master list option names associated with the specified identifier.

    Task<List<string>> GetMasterListOptionsNamesById(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the master list whose option names are being retrieved.

#### Returns

Task<List<string>>

  A task that represents the asynchronous operation, containing a list of option names for the specified master list.

### GetOptionsOfList(ObjectId)

Retrieves the available options associated with the specified list identifier.

    Task<List<string>> GetOptionsOfList(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the list whose options are being retrieved.

#### Returns

Task<List<string>>

  A task that represents the asynchronous operation, containing a list of option strings for the specified list.

### GetPaginatedMasterList(PaginationFilter)

Retrieves a paginated master list of items based on the specified filter criteria.

    Task<PaginationResponse<T>> GetPaginatedMasterList(PaginationFilter filter)

#### Parameters

`filter` PaginationFilter

  The pagination filter that defines paging parameters such as page number and page size.

#### Returns

Task<PaginationResponse<T>>

  A task that represents the asynchronous operation, containing the paginated response with the requested master list items.

### GetPaginatedMasterListWithPaginatedOptions(PaginationFilter, PaginationFilter)

Asynchronously retrieves a paginated master list along with its associated paginated options.

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

#### Parameters

`listFilter` PaginationFilter

  The pagination filter applied to the master list results.

`optionsFilter` PaginationFilter

  The pagination filter applied to the associated options.

#### Returns

Task<PaginationResponse<MasterListWithPaginatedOptionsDto>>

  A task that represents the asynchronous operation, containing the paginated response with master list and options data.

### GetPaginatedOptions(PaginationFilter, ObjectId)

Retrieves a paginated collection of options associated with the specified list.

    Task<PaginationResponse<OptionList>> GetPaginatedOptions(PaginationFilter filter, ObjectId listId)

#### Parameters

`filter` PaginationFilter

  The pagination parameters used to control the page size and page index of the returned results.

`listId` ObjectId

  The identifier of the list whose options should be retrieved.

#### Returns

Task<PaginationResponse<OptionList>>

  A task that represents the asynchronous operation, containing a PaginationResponse<T> with the requested options.

### InsertMasterList(T)

Inserts the specified item into the master list and returns the resulting entry, or `null` if the operation did not produce a result.

    Task<T?> InsertMasterList(T item)

#### Parameters

`item` T

  The item to insert into the master list.

#### Returns

Task<T>

  A Task<TResult> that resolves to the inserted item, or `null` when no result is available.

### RemoveMasterListOption(ObjectId, OptionList)

Asynchronously removes the specified option from the master list identified by the given id.

    Task<bool> RemoveMasterListOption(ObjectId id, OptionList oldOpt)

#### Parameters

`id` ObjectId

  The identifier of the master list from which the option will be removed.

`oldOpt` OptionList

  The option entry to be removed from the master list.

#### Returns

Task<bool>

  A task that represents the asynchronous operation. The task result is `true` if the option was successfully removed; otherwise, `false`.

### UpdateFullMasterListOption(ObjectId, OptionList, string)

Updates the full master list option identified by the specified identifier and type name.

    Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList opt, string typeName)

#### Parameters

`id` ObjectId

  The identifier of the option to update.

`opt` OptionList

  The option list containing the updated values.

`typeName` string

  The name of the type associated with the master list option.

#### Returns

Task<OptionList>

  A task that represents the asynchronous operation. The task result contains the updated OptionList, or `null` if the option was not found.

### UpdateMasterList(T)

Updates the master list with the specified item.

    Task<T?> UpdateMasterList(T item)

#### Parameters

`item` T

  The item to be updated in the master list.

#### Returns

Task<T>

  A task that represents the asynchronous update operation, containing the updated item or `null` if the update could not be performed.

### UpdateMasterListDescription(ObjectId, string)

Updates the description (name) of a master list entry identified by the specified identifier.

    Task<bool> UpdateMasterListDescription(ObjectId id, string name)

#### Parameters

`id` ObjectId

  The unique identifier of the master list entry to update.

`name` string

  The new description to apply to the master list entry.

#### Returns

Task<bool>

  A task that represents the asynchronous operation. The task result is `true` if the update was successful; otherwise, `false`.

### UpdateMasterListName(ObjectId, string)

Updates the name of an existing master list identified by the specified identifier.

    Task<bool> UpdateMasterListName(ObjectId id, string name)

#### Parameters

`id` ObjectId

  The identifier of the master list to update.

`name` string

  The new name to assign to the master list.

#### Returns

Task<bool>

  A task that represents the asynchronous operation. The task result is `true` if the master list was successfully updated; otherwise, `false`.

### UpdateMasterListOption(ObjectId, OptionList, string)

Updates a master list option for the specified type with the provided option data.

    Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName)

#### Parameters

`id` ObjectId

  The unique identifier of the option to update.

`opt` OptionList

  The option data to apply to the master list.

`typeName` string

  The name of the master list type containing the option.

#### Returns

Task<OptionList>

  The updated OptionList, or null if the option is not found.

### UpdateMasterListOption(ObjectId, OptionList, string, LocaleEnum)

Updates an option in a master list, localized for the specified locale, and returns the updated option list.

    Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName, LocaleEnum locale)

#### Parameters

`id` ObjectId

  The identifier of the option to update.

`opt` OptionList

  The option data to apply to the existing entry.

`typeName` string

  The name of the master list type that owns the option.

`locale` LocaleEnum

  The locale used to resolve or apply localized values.

#### Returns

Task<OptionList>

  A task that returns the updated OptionList, or `null` if the option could not be found.

### UpdateOptionDetailsToMasterList(ObjectId, UpdateMasterListDetailsDto)

Updates the option details of a master list entry identified by the specified id.

    Task<UpdateMasterListDetailsDto?> UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt)

#### Parameters

`id` ObjectId

  The identifier of the master list entry to update.

`opt` UpdateMasterListDetailsDto

  The master list details to apply to the entry.

#### Returns

Task<UpdateMasterListDetailsDto>

  A task that returns the updated master list details, or null if no matching entry is found.