// Path: warehouse-model/src/main/java/warehouse/BoxLabel.java
// @Value
// public class BoxLabel {
//     private final String refNo;
//     private final int quantity;
//     private final String boxType;
// }
// 
// Path: warehouse-model/src/main/java/warehouse/PaletteLabel.java
// @Value
// public class PaletteLabel {
//     private final String id;
//     private final String refNo;
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }
// 
// Path: warehouse-model/src/main/java/warehouse/locations/BasicLocationPicker.java
// @AllArgsConstructor
// public class BasicLocationPicker implements PreferredLocationPicker {
//     private final Map<String, Location> perRefNo;
//     private final Location def = Location.unknown();
// 
//     @Override
//     public Location suggestFor(String refNo) {
//         return perRefNo.getOrDefault(refNo, def);
//     }
// }
// 
// Path: warehouse-model/src/main/java/warehouse/locations/Location.java
// @Value
// public class Location {
//     private final String location;
// 
//     public static Location production() {
//         return new Location("production");
//     }
// 
//     public static Location quarantine() {
//         return new Location("quarantine");
//     }
// 
//     public static Location onTheMove(String user) {
//         return new Location("picked by " + user);
//     }
// 
//     public static Location unknown() {
//         return new Location("<unknown>");
//     }
// }
// 
// Path: warehouse-model/src/main/java/warehouse/locations/PreferredLocationPicker.java
// public interface PreferredLocationPicker {
//     Location suggestFor(String refNo);
// }


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import warehouse.BoxLabel;
import warehouse.PaletteLabel;
import warehouse.locations.BasicLocationPicker;
import warehouse.locations.Location;
import warehouse.locations.PreferredLocationPicker;
import java.time.Clock;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
package warehouse.products;



/**
 * Created by michal on 15.07.2016.
 */
@Setter
@Accessors(fluent = true)
public class ProductStockBuilder {

    private final String refNo;
    private PreferredLocationPicker locationsPicker = new BasicLocationPicker(Collections.emptyMap());
    private EventsAssert events = new EventsAssert();
    private Clock clock = Clock.systemDefaultZone();
    private PaletteValidator validator = new PaletteValidator();

    public static ProductStockBuilder forRefNo(String refNo) {
        return new ProductStockBuilder(refNo);
    }

    public static RefNoLocation l(String refNo, Location location) {
        return new RefNoLocation(refNo, location);
    }

    public ProductStock build() {
        return new ProductStock(refNo, locationsPicker, validator, events, clock);
    }

    public ProductStockBuilder locationsPicker(RefNoLocation... locations) {
// Path: warehouse-model/src/main/java/warehouse/BoxLabel.java
// @Value
// public class BoxLabel {
//     private final String refNo;
//     private final int quantity;
//     private final String boxType;
// }
// 
// Path: warehouse-model/src/main/java/warehouse/PaletteLabel.java
// @Value
// public class PaletteLabel {
//     private final String id;
//     private final String refNo;
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }
// 
// Path: warehouse-model/src/main/java/warehouse/locations/BasicLocationPicker.java
// @AllArgsConstructor
// public class BasicLocationPicker implements PreferredLocationPicker {
//     private final Map<String, Location> perRefNo;
//     private final Location def = Location.unknown();
// 
//     @Override
//     public Location suggestFor(String refNo) {
//         return perRefNo.getOrDefault(refNo, def);
//     }
// }
// 
// Path: warehouse-model/src/main/java/warehouse/locations/Location.java
// @Value
// public class Location {
//     private final String location;
// 
//     public static Location production() {
//         return new Location("production");
//     }
// 
//     public static Location quarantine() {
//         return new Location("quarantine");
//     }
// 
//     public static Location onTheMove(String user) {
//         return new Location("picked by " + user);
//     }
// 
//     public static Location unknown() {
//         return new Location("<unknown>");
//     }
// }
// 
// Path: warehouse-model/src/main/java/warehouse/locations/PreferredLocationPicker.java
// public interface PreferredLocationPicker {
//     Location suggestFor(String refNo);
// }


// Path: warehouse-model/src/test/java/warehouse/products/ProductStockBuilder.java
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import warehouse.BoxLabel;
import warehouse.PaletteLabel;
import warehouse.locations.BasicLocationPicker;
import warehouse.locations.Location;
import warehouse.locations.PreferredLocationPicker;
import java.time.Clock;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

package warehouse.products;



/**
 * Created by michal on 15.07.2016.
 */
@Setter
@Accessors(fluent = true)
public class ProductStockBuilder {

    private final String refNo;
    private PreferredLocationPicker locationsPicker = new BasicLocationPicker(Collections.emptyMap());
    private EventsAssert events = new EventsAssert();
    private Clock clock = Clock.systemDefaultZone();
    private PaletteValidator validator = new PaletteValidator();

    public static ProductStockBuilder forRefNo(String refNo) {
        return new ProductStockBuilder(refNo);
    }

    public static RefNoLocation l(String refNo, Location location) {
        return new RefNoLocation(refNo, location);
    }

    public ProductStock build() {
        return new ProductStock(refNo, locationsPicker, validator, events, clock);
    }

    public ProductStockBuilder locationsPicker(RefNoLocation... locations) {
        locationsPicker = new BasicLocationPicker(Stream.of(locations)