package com.mzh.library.dao;

import com.mzh.library.entity.Book;
import com.mzh.library.entity.BookCategory;
import com.mzh.library.entity.BookSearchCriteria;

import java.util.List;
import java.util.Optional;

public interface BookDao {
    List<BookCategory> findAllCategories();

    Optional<BookCategory> findCategoryById(long id);

    Optional<BookCategory> findCategoryByName(String name);

    long createCategory(BookCategory category);

    boolean updateCategory(BookCategory category);

    boolean deleteCategory(long id);

    int countBooksByCategoryId(long categoryId);

    List<Book> search(BookSearchCriteria criteria);

    Optional<Book> findById(long id);

    Optional<Book> findByIdentifier(String identifier);

    long create(Book book);

    boolean update(Book book);

    boolean delete(long id);
}
