# Interface IMasterListRepository<T>

Namespace
  adas_core.Application.Repositories.Interfaces

Assembly
  adas-core.Application.dll

    public interface IMasterListRepository<T> : IMongoRepository<T> where T : MasterList

#### Type Parameters

`T`

Inherited Members
  IMongoRepository<T>.Collection
  IMongoRepository<T>.GetCollectionName()
  IMongoRepository<T>.InsertOneAsync(T)
  IMongoRepository<T>.DeleteAsync(ObjectId)
  IMongoRepository<T>.UpdateOneAsync(ObjectId, T)

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

## Methods

### AddOptionToMasterList(ObjectId, FilterOptionListElement)

Asynchronously adds a FilterOptionListElement to the master option list identified by the given MongoDB.Bson.ObjectId.

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

#### Parameters

`id` ObjectId

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

`opt` FilterOptionListElement

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

#### Returns

Task<OptionList>

  A task that represents the asynchronous operation. The task result contains the resulting OptionList, or `null` if no list is returned.

### Count()

Asynchronously counts the number of items and returns the total.

    Task<int> Count()

#### Returns

Task<int>

  A task that represents the asynchronous operation. The task result contains the total count of items.

### Delete(ObjectId)

Deletes the entity identified by the specified identifier.

    Task Delete(ObjectId id)

#### Parameters

`id` ObjectId

  The identifier of the entity to delete.

#### Returns

Task

### DeleteMasterListOption(ObjectId, ObjectId)

Deletes a master list option identified by the specified option ID.

    Task<bool> DeleteMasterListOption(ObjectId id, ObjectId deleteOptId)

#### Parameters

`id` ObjectId

  The identifier of the master list containing the option to delete.

`deleteOptId` ObjectId

  The identifier of the option to be deleted from the master list.

#### Returns

Task<bool>

  A task that represents the asynchronous operation. The task result contains a boolean indicating whether the option was successfully deleted.

### FindById(ObjectId)

Asynchronously retrieves an entity of type `T` by its unique identifier. Returns `null` when no matching entity is found.

    Task<T?> FindById(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the entity to locate.

#### Returns

Task<T>

  A task that represents the asynchronous operation. The task result contains the entity of type `T` if found, or `null` otherwise.

### FindById(ObjectId, LocaleEnum?)

Asynchronously retrieves an entity identified by the specified `id`, optionally resolving localized content using the given `locale`. Returns `null` when no matching entity is found.

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

#### Parameters

`id` ObjectId

  The unique identifier of the entity to look up.

`locale` LocaleEnum?

  The optional locale used to resolve localized fields of the retrieved entity.

#### Returns

Task<T>

  A task that yields the matching entity, or `null` if the entity is not found.

### FindByName(string)

Asynchronously finds and returns an entity of type `T` matching the specified `name`. Returns `null` when no matching entity is found.

    Task<T?> FindByName(string name)

#### Parameters

`name` string

  The name used to look up the entity.

#### Returns

Task<T>

  A task that represents the asynchronous lookup, containing the matched entity of type `T` or `null` if no match exists.

### FindOptionItemById(ObjectId, ObjectId)

Asynchronously retrieves an OptionList identified by the given master and option identifiers.

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

#### Parameters

`masterId` ObjectId

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

`optionId` ObjectId

  The identifier of the specific option item to locate within the master.

#### Returns

Task<OptionList>

  A Task<TResult> that yields the matching OptionList, or `null` when no item is found.

### FindOptionItemById(ObjectId, ObjectId, LocaleEnum)

Asynchronously retrieves an OptionList item identified by the specified master and option identifiers for the given locale. Returns `null` when no matching option item is found for the provided identifiers and locale.

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

#### Parameters

`masterId` ObjectId

  The master identifier used to scope the lookup of the option item.

`optionId` ObjectId

  The identifier of the specific option item to retrieve within the master scope.

`locale` LocaleEnum

  The locale used to select the localized version of the option item.

#### Returns

Task<OptionList>

  A Task<TResult> that yields the matching OptionList, or `null` if no item is found.

### GetAll()

Asynchronously retrieves all items of type T.

    Task<IEnumerable<T>> GetAll()

#### Returns

Task<IEnumerable<T>>

  A task that represents the asynchronous operation. The task result contains an enumerable collection of all items of type T.

### GetAllWithoutOptions()

Retrieves all master list entries without applying optional filters or including related option data. Used to fetch the complete set of master list records for scenarios such as full enumeration or bulk operations.

    Task<IEnumerable<MasterListDto>> GetAllWithoutOptions()

#### Returns

Task<IEnumerable<MasterListDto>>

  A task that represents the asynchronous operation, containing an IEnumerable<T> with all available master list entries.

### GetMasterListByIdAndSearchOptions(ObjectId, FilterOptionListElement?)

Retrieves a master list of OptionList entries identified by the given id, optionally applying the provided search and filtering options.

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

#### Parameters

`id` ObjectId

  The identifier of the master list to retrieve.

`filterOption` FilterOptionListElement

  Optional filter criteria used to narrow the returned options. May be `null` to return the full list without additional filtering.

#### Returns

Task<List<OptionList>>

  A task that represents the asynchronous operation, containing the list of OptionList items that match the specified id and filter, or an empty list if no matching entries are found.

### GetMasterListByIdAndTextSearchContaining(ObjectId, string?)

Retrieves a master list of option list entries filtered by the specified identifier and an optional text search that performs a contains match.

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

#### Parameters

`id` ObjectId

  The identifier used to scope the option list entries to be returned.

`textSearch` string

  An optional text used to filter entries whose content contains the specified value; may be null to skip text-based filtering.

#### Returns

Task<List<OptionList>>

  A task representing the asynchronous operation, containing a list of OptionList entries that match the identifier and the optional text search criteria.

### GetPaginatedMasterList(PaginationFilter)

Retrieves a paginated master list using the specified pagination filter, returning a fluent queryable result.

    IFindFluent<T, T> GetPaginatedMasterList(PaginationFilter filter)

#### Parameters

`filter` PaginationFilter

  The pagination filter that defines the paging criteria applied to the master list query.

#### Returns

IFindFluent<T, T>

  An MongoDB.Driver.IFindFluent<TDocument, TProjection> that represents the paginated queryable master list.

### GetPaginatedOptions(PaginationFilter, ObjectId)

Retrieves a paginated collection of options associated with the specified list identifier, applying the provided pagination filter to control the result set.

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

#### Parameters

`filter` PaginationFilter

  The pagination filter defining page size, page number, and related pagination constraints.

`listId` ObjectId

  The unique identifier of the list whose options should be retrieved.

#### Returns

Task<List<OptionList>>

  A task representing the asynchronous operation, containing a list of OptionList items for the requested page.

### RemoveMasterListOption(ObjectId, OptionList)

Asynchronously removes the specified option from the master list associated with the given identifier.

    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 to be removed from the master list.

#### Returns

Task<bool>

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

### Update(T)

Asynchronously updates the specified collection of items.

    Task Update(T list)

#### Parameters

`list` T

  The collection of items to update.

#### Returns

Task

### UpdateFullMasterListOption(ObjectId, OptionList)

Updates an existing master list option identified by the given id with the provided data, returning the updated option or null if no matching option is found.

    Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList newOpt)

#### Parameters

`id` ObjectId

  The unique identifier of the master list option to update.

`newOpt` OptionList

  The new option data to replace the existing master list option.

#### Returns

Task<OptionList>

  A task representing the asynchronous operation, containing the updated OptionList, or null if no option with the specified id exists.

### UpdateMasterListDescription(ObjectId, string)

Asynchronously updates the description of a master list identified by the specified identifier.

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

#### Parameters

`id` ObjectId

  The unique identifier of the master list to update.

`description` string

  The new description to set for the master list.

#### 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 unique 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 updated successfully; otherwise, `false`.

### UpdateMasterListOption(ObjectId, OptionList)

Updates an existing master list option identified by the specified id with the provided new option data.

    Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList newOpt)

#### Parameters

`id` ObjectId

  The unique identifier of the master list option to update.

`newOpt` OptionList

  The new option data to apply to the existing master list option.

#### Returns

Task<OptionList>

  A task that represents the asynchronous operation, containing the updated OptionList, or `null` if no matching option was found.

### UpdateMasterListOption(ObjectId, OptionList, LocaleEnum)

Updates an existing master list option identified by the specified identifier using the provided option data and locale, returning the updated option list.

    Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList newOpt, LocaleEnum locale)

#### Parameters

`id` ObjectId

  The unique identifier of the master list option to update.

`newOpt` OptionList

  The new option list data to apply to the master list option.

`locale` LocaleEnum

  The locale used for the update operation.

#### Returns

Task<OptionList>

  A task that represents the asynchronous operation, containing the updated OptionList if found, or `null` if no matching master list option exists.

### UpdateOptionDetailsToMasterList(ObjectId, UpdateMasterListDetailsDto)

Updates the option details of an existing entry in the master list identified by the specified id.

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

#### Parameters

`id` ObjectId

  The unique identifier of the master list entry to update.

`opt` UpdateMasterListDetailsDto

  The update payload containing the new option details to apply.

#### Returns

Task<UpdateMasterListDetailsDto>

  A task that represents the asynchronous operation, containing the updated master list details, or null if no matching entry is found.