package marketing.heyday.hartmann.fotodocumentation.rest.vo;

import java.util.List;

import io.swagger.v3.oas.annotations.media.Schema;
import marketing.heyday.hartmann.fotodocumentation.core.model.Customer;

/**
 * 
 * <p>Copyright: Copyright (c) 2024</p>
 * <p>Company: heyday Marketing GmbH</p>
 * @author <a href="mailto:p.verboom@heyday.marketing">Patrick Verboom</a>
 * @version 1.0
 * 
 * created: 22 Jan 2026
 */
@Schema(name = "Customer")
public record CustomerValue(Long id, String name, String customerNumber, List<PictureValue> pictures) {

	public static CustomerValue builder(Customer customer) {
		if (customer == null) {
			return null;
		}
		List<PictureValue> pictures = customer.getPictures().parallelStream().map(PictureValue::builder).filter(p -> p != null).toList();
		return new CustomerValue(customer.getCustomerId(), customer.getName(), customer.getCustomerNumber(), pictures);
	}
}