// Path: src/main/java/com/edwise/completespring/repositories/BookRepository.java
// public interface BookRepository extends MongoRepository<Book, Long> {
// 
//     List<Book> findByTitle(String title);
//     List<Book> findByReleaseDate(LocalDate releaseDate);
// 
// }
// 
// Path: src/main/java/com/edwise/completespring/repositories/SequenceIdRepository.java
// public interface SequenceIdRepository {
//     void save(SequenceId sequenceId);
// 
//     long getNextSequenceId(String key);
// }
// 
// Path: src/main/java/com/edwise/completespring/repositories/UserAccountRepository.java
// public interface UserAccountRepository extends MongoRepository<UserAccount, Long> {
// 
//     UserAccount findByUsername(String username);
// }
// 
// Path: src/main/java/com/edwise/completespring/services/impl/BookServiceImpl.java
// @Service
// public class BookServiceImpl implements BookService {
//     public static final String BOOK_COLLECTION = "books";
//     private static final String BOOK_NOT_FOUND_MSG = "Book not found";
// 
//     @Autowired
//     private BookRepository bookRepository;
// 
//     @Autowired
//     private SequenceIdRepository sequenceIdRepository;
// 
//     @Override
//     public List<Book> findAll() {
//         return bookRepository.findAll();
//     }
// 
//     @Override
//     public Book save(Book book) {
//         return bookRepository.save(book);
//     }
// 
//     @Override
//     public Book findOne(Long id) {
//         Optional<Book> result = bookRepository.findById(id);
//         if (!result.isPresent()) {
//             throw new NotFoundException(BOOK_NOT_FOUND_MSG);
//         }
//         return result.get();
//     }
// 
//     @Override
//     public void delete(Long id) {
//         bookRepository.deleteById(id);
//     }
// 
//     @Override
//     public Book create(Book book) {
//         Long id = sequenceIdRepository.getNextSequenceId(BOOK_COLLECTION);
//         book.setId(id);
// 
//         return bookRepository.save(book);
//     }
// 
//     @Override
//     public List<Book> findByTitle(String title) {
//         return bookRepository.findByTitle(title);
//     }
// 
//     @Override
//     public List<Book> findByReleaseDate(LocalDate releaseDate) {
//         return bookRepository.findByReleaseDate(releaseDate);
//     }
// }


import com.edwise.completespring.entities.*;
import com.edwise.completespring.repositories.BookRepository;
import com.edwise.completespring.repositories.SequenceIdRepository;
import com.edwise.completespring.repositories.UserAccountRepository;
import com.edwise.completespring.services.impl.BookServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Collections;
package com.edwise.completespring.dbutils;



@Slf4j
@Component
public class DataLoader {
    private static final String USERACCOUNTS_COLLECTION = "users";
    private static final Long BOOKS_INITIAL_SEQUENCE = 4L;
    private static final Long USERACCOUNTS_INITIAL_SEQUENCE = 3L;
    public static final Long BOOK_ID_1 = 1L;
    public static final Long BOOK_ID_2 = 2L;
    public static final Long BOOK_ID_3 = 3L;
    private static final Long BOOK_ID_4 = 4L;
    private static final Long USER_ID_1 = 1L;
    private static final Long USER_ID_2 = 2L;
    public static final String USER = "user1";
    public static final String PASSWORD_USER = "password1";
    public static final String ADMIN = "admin";
    public static final String PASSWORD_ADMIN = "password1234";

    @Autowired
    private BookRepository bookRepository;

    @Autowired
    private UserAccountRepository userAccountRepository;

    @Autowired
// Path: src/main/java/com/edwise/completespring/repositories/BookRepository.java
// public interface BookRepository extends MongoRepository<Book, Long> {
// 
//     List<Book> findByTitle(String title);
//     List<Book> findByReleaseDate(LocalDate releaseDate);
// 
// }
// 
// Path: src/main/java/com/edwise/completespring/repositories/SequenceIdRepository.java
// public interface SequenceIdRepository {
//     void save(SequenceId sequenceId);
// 
//     long getNextSequenceId(String key);
// }
// 
// Path: src/main/java/com/edwise/completespring/repositories/UserAccountRepository.java
// public interface UserAccountRepository extends MongoRepository<UserAccount, Long> {
// 
//     UserAccount findByUsername(String username);
// }
// 
// Path: src/main/java/com/edwise/completespring/services/impl/BookServiceImpl.java
// @Service
// public class BookServiceImpl implements BookService {
//     public static final String BOOK_COLLECTION = "books";
//     private static final String BOOK_NOT_FOUND_MSG = "Book not found";
// 
//     @Autowired
//     private BookRepository bookRepository;
// 
//     @Autowired
//     private SequenceIdRepository sequenceIdRepository;
// 
//     @Override
//     public List<Book> findAll() {
//         return bookRepository.findAll();
//     }
// 
//     @Override
//     public Book save(Book book) {
//         return bookRepository.save(book);
//     }
// 
//     @Override
//     public Book findOne(Long id) {
//         Optional<Book> result = bookRepository.findById(id);
//         if (!result.isPresent()) {
//             throw new NotFoundException(BOOK_NOT_FOUND_MSG);
//         }
//         return result.get();
//     }
// 
//     @Override
//     public void delete(Long id) {
//         bookRepository.deleteById(id);
//     }
// 
//     @Override
//     public Book create(Book book) {
//         Long id = sequenceIdRepository.getNextSequenceId(BOOK_COLLECTION);
//         book.setId(id);
// 
//         return bookRepository.save(book);
//     }
// 
//     @Override
//     public List<Book> findByTitle(String title) {
//         return bookRepository.findByTitle(title);
//     }
// 
//     @Override
//     public List<Book> findByReleaseDate(LocalDate releaseDate) {
//         return bookRepository.findByReleaseDate(releaseDate);
//     }
// }


// Path: src/main/java/com/edwise/completespring/dbutils/DataLoader.java
import com.edwise.completespring.entities.*;
import com.edwise.completespring.repositories.BookRepository;
import com.edwise.completespring.repositories.SequenceIdRepository;
import com.edwise.completespring.repositories.UserAccountRepository;
import com.edwise.completespring.services.impl.BookServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Collections;

package com.edwise.completespring.dbutils;



@Slf4j
@Component
public class DataLoader {
    private static final String USERACCOUNTS_COLLECTION = "users";
    private static final Long BOOKS_INITIAL_SEQUENCE = 4L;
    private static final Long USERACCOUNTS_INITIAL_SEQUENCE = 3L;
    public static final Long BOOK_ID_1 = 1L;
    public static final Long BOOK_ID_2 = 2L;
    public static final Long BOOK_ID_3 = 3L;
    private static final Long BOOK_ID_4 = 4L;
    private static final Long USER_ID_1 = 1L;
    private static final Long USER_ID_2 = 2L;
    public static final String USER = "user1";
    public static final String PASSWORD_USER = "password1";
    public static final String ADMIN = "admin";
    public static final String PASSWORD_ADMIN = "password1234";

    @Autowired
    private BookRepository bookRepository;

    @Autowired
    private UserAccountRepository userAccountRepository;

    @Autowired
    private SequenceIdRepository sequenceRepository;