// Path: src/main/java/com/edwise/completespring/entities/Book.java
// @Document(collection = "books")
// @ApiModel(value = "Book entity", description = "Complete info of a entity book")
// @Data
// @Accessors(chain = true)
// @EqualsAndHashCode(exclude = {"id"}, doNotUseGetters = true)
// @ToString(doNotUseGetters = true)
// public class Book {
// 
//     @ApiModelProperty(value = "The id of the book")
//     @Id
//     private Long id;
// 
//     @ApiModelProperty(value = "The title of the book", required = true)
//     @NotEmpty
//     private String title;
// 
//     @ApiModelProperty(value = "The authors of the book", required = true)
//     @Valid
//     private List<Author> authors;
// 
//     @ApiModelProperty(value = "The isbn of the book", required = true)
//     @NotEmpty
//     private String isbn;
// 
//     @ApiModelProperty(value = "The release date of the book", required = true, dataType = "LocalDate")
//     @NotNull
//     private LocalDate releaseDate;
// 
//     @ApiModelProperty(value = "The publisher of the book", required = true)
//     @Valid
//     @NotNull
//     private Publisher publisher;
// 
//     public Book copyFrom(Book other) {
//         this.title = other.title;
//         if (other.authors != null) {
//             this.authors = new ArrayList<>();
//             this.authors.addAll(other.authors.stream().map(new Author()::copyFrom).collect(Collectors.toList()));
//         }
//         this.isbn = other.isbn;
//         this.releaseDate = other.releaseDate;
//         if (other.publisher != null) {
//             this.publisher = new Publisher().copyFrom(other.publisher);
//         }
// 
//         return this;
//     }
// }
// 
// Path: src/main/java/com/edwise/completespring/exceptions/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// 
//     public NotFoundException(String msg) {
//         super(msg);
//     }
// }
// 
// 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/services/BookService.java
// public interface BookService extends Service<Book, Long> {
// 
//     List<Book> findByTitle(String title);
// 
//     List<Book> findByReleaseDate(LocalDate releaseDate);
// 
//     Book create(Book book);
// }


import com.edwise.completespring.entities.Book;
import com.edwise.completespring.exceptions.NotFoundException;
import com.edwise.completespring.repositories.BookRepository;
import com.edwise.completespring.repositories.SequenceIdRepository;
import com.edwise.completespring.services.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
package com.edwise.completespring.services.impl;



@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
// Path: src/main/java/com/edwise/completespring/entities/Book.java
// @Document(collection = "books")
// @ApiModel(value = "Book entity", description = "Complete info of a entity book")
// @Data
// @Accessors(chain = true)
// @EqualsAndHashCode(exclude = {"id"}, doNotUseGetters = true)
// @ToString(doNotUseGetters = true)
// public class Book {
// 
//     @ApiModelProperty(value = "The id of the book")
//     @Id
//     private Long id;
// 
//     @ApiModelProperty(value = "The title of the book", required = true)
//     @NotEmpty
//     private String title;
// 
//     @ApiModelProperty(value = "The authors of the book", required = true)
//     @Valid
//     private List<Author> authors;
// 
//     @ApiModelProperty(value = "The isbn of the book", required = true)
//     @NotEmpty
//     private String isbn;
// 
//     @ApiModelProperty(value = "The release date of the book", required = true, dataType = "LocalDate")
//     @NotNull
//     private LocalDate releaseDate;
// 
//     @ApiModelProperty(value = "The publisher of the book", required = true)
//     @Valid
//     @NotNull
//     private Publisher publisher;
// 
//     public Book copyFrom(Book other) {
//         this.title = other.title;
//         if (other.authors != null) {
//             this.authors = new ArrayList<>();
//             this.authors.addAll(other.authors.stream().map(new Author()::copyFrom).collect(Collectors.toList()));
//         }
//         this.isbn = other.isbn;
//         this.releaseDate = other.releaseDate;
//         if (other.publisher != null) {
//             this.publisher = new Publisher().copyFrom(other.publisher);
//         }
// 
//         return this;
//     }
// }
// 
// Path: src/main/java/com/edwise/completespring/exceptions/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// 
//     public NotFoundException(String msg) {
//         super(msg);
//     }
// }
// 
// 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/services/BookService.java
// public interface BookService extends Service<Book, Long> {
// 
//     List<Book> findByTitle(String title);
// 
//     List<Book> findByReleaseDate(LocalDate releaseDate);
// 
//     Book create(Book book);
// }


// Path: src/main/java/com/edwise/completespring/services/impl/BookServiceImpl.java
import com.edwise.completespring.entities.Book;
import com.edwise.completespring.exceptions.NotFoundException;
import com.edwise.completespring.repositories.BookRepository;
import com.edwise.completespring.repositories.SequenceIdRepository;
import com.edwise.completespring.services.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
import java.util.Optional;

package com.edwise.completespring.services.impl;



@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;