# Interface ModernMaterialStore

All Superinterfaces:
  `MaterialStore`

public interface ModernMaterialStore extends MaterialStore
Modern interface for polymorphic material store with async operations. Extends the base MaterialStore with modern Java features.

Since:
  2024-09-15
Version:
  4.0
Author:
  Navid Mohaghegh

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static final record`
  `ModernMaterialStore.BatchOperationResult`
  Batch operation result record.
  `static final record`
  `ModernMaterialStore.ModernInventoryStats`
  Modern InventoryStats using Java record for immutability.
  `static final record`
  `ModernMaterialStore.SearchCriteria`
  Search criteria record for complex searches.

  ### Nested classes/interfaces inherited from interface com.university.bookstore.api.MaterialStore

  `MaterialStore.InventoryStats`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CompletableFuture<Boolean>`
  `addMaterialAsync(Material material)`
  Adds material asynchronously.
  `CompletableFuture<ModernMaterialStore.BatchOperationResult>`
  `addMaterialsBatchAsync(List<Material> materials)`
  Adds multiple materials in batch.
  `CompletableFuture<List<Material>>`
  `advancedSearchAsync(ModernMaterialStore.SearchCriteria criteria)`
  Performs advanced search with multiple criteria.
  `CompletableFuture<Optional<Material>>`
  `findByIdAsync(String id)`
  Finds material by ID asynchronously.
  `CompletableFuture<ModernMaterialStore.ModernInventoryStats>`
  `getModernInventoryStatsAsync()`
  Gets inventory statistics asynchronously.
  `CompletableFuture<ModernMaterialStore.BatchOperationResult>`
  `removeMaterialsBatchAsync(List<String> ids)`
  Removes multiple materials in batch.
  `CompletableFuture<List<Material>>`
  `searchByTitleAsync(String title)`
  Searches by title asynchronously.

  ### Methods inherited from interface com.university.bookstore.api.MaterialStore

  `addMaterial, clearInventory, filterMaterials, findByCreators, findById, findRecentMaterials, findWithPredicate, getAllMaterials, getAllMaterialsSorted, getInventoryStats, getMaterialsByPriceRange, getMaterialsByType, getMaterialsByYear, getMediaMaterials, getSorted, getTotalDiscountedValue, getTotalInventoryValue, isEmpty, removeMaterial, searchByCreator, searchByTitle, size`

- ## Method Details

  - ### addMaterialAsync

    CompletableFuture<Boolean> addMaterialAsync(Material material)
    Adds material asynchronously.
    Parameters:
      `material` - the material to add
    Returns:
      CompletableFuture with the result

  - ### findByIdAsync

    CompletableFuture<Optional<Material>> findByIdAsync(String id)
    Finds material by ID asynchronously.
    Parameters:
      `id` - the material ID
    Returns:
      CompletableFuture with the result

  - ### searchByTitleAsync

    CompletableFuture<List<Material>> searchByTitleAsync(String title)
    Searches by title asynchronously.
    Parameters:
      `title` - the title to search for
    Returns:
      CompletableFuture with the results

  - ### getModernInventoryStatsAsync

    CompletableFuture<ModernMaterialStore.ModernInventoryStats> getModernInventoryStatsAsync()
    Gets inventory statistics asynchronously.
    Returns:
      CompletableFuture with the statistics

  - ### advancedSearchAsync

    CompletableFuture<List<Material>> advancedSearchAsync(ModernMaterialStore.SearchCriteria criteria)
    Performs advanced search with multiple criteria.
    Parameters:
      `criteria` - the search criteria
    Returns:
      CompletableFuture with matching materials

  - ### addMaterialsBatchAsync

    CompletableFuture<ModernMaterialStore.BatchOperationResult> addMaterialsBatchAsync(List<Material> materials)
    Adds multiple materials in batch.
    Parameters:
      `materials` - collection of materials to add
    Returns:
      CompletableFuture with batch operation result

  - ### removeMaterialsBatchAsync

    CompletableFuture<ModernMaterialStore.BatchOperationResult> removeMaterialsBatchAsync(List<String> ids)
    Removes multiple materials in batch.
    Parameters:
      `ids` - collection of IDs to remove
    Returns:
      CompletableFuture with batch operation result