package com.bookshop.solid.srp;
import com.bookshop.domain.Book;
import com.bookshop.domain.Customer;
import java.math.BigDecimal;
import java.util.List;
/** Responsibility 1: what was bought and what it adds up to. Nothing else. */
public record Receipt(Customer customer, List<Book> books) {
public BigDecimal total() {
return books.stream().map(Book::price).reduce(BigDecimal.ZERO, BigDecimal::add);
}
}