package models;

import exceptions.FailToParkException;
import exceptions.FailToPickException;
import strategies.IdealParkingLotStrategy;
import strategies.MoreEmptySpacesStrategy;

import java.util.UUID;

public class SmartParkingBoy {
    private final ParkingLot[] parkingLots;
    private final IdealParkingLotStrategy strategy;

    public SmartParkingBoy(ParkingLot... parkingLots) {
        this.parkingLots = parkingLots;
        this.strategy = new MoreEmptySpacesStrategy();
    }

    public UUID park(Car car) throws FailToParkException {
        return strategy.getIdealParkingLot(parkingLots).park(car);
    }

    public Car pick(UUID token) throws FailToPickException {
        for (ParkingLot parkingLot : parkingLots) {
            if (parkingLot.contains(token)) {
                return parkingLot.pick(token);
            }
        }
        throw new FailToPickException();
    }
}

@@ -14,129 +14,8 @@
 s;%0A%0A
-import exceptions.FailToParkException;%0Aimport exceptions.FailToPickException;%0Aimport strategies.IdealParkingLotStrategy;%0A
 impo
@@ -58,32 +58,8 @@
 y;%0A%0A
-import java.util.UUID;%0A%0A
 publ
@@ -87,666 +87,134 @@
 Boy 
-%7B%0A    private final ParkingLot%5B%5D parkingLots;%0A    private final IdealParkingLotStrategy strategy;%0A%0A    public SmartParkingBoy(ParkingLot... parkingLots) %7B%0A        this.parkingLots = parkingLots;%0A        this.strategy = new MoreEmptySpacesStrategy();%0A    %7D%0A%0A    public UUID park(Car car) throws FailToParkException %7B%0A        return strategy.getIdealParkingLot(parkingLots).park(car);%0A    %7D%0A%0A    public Car pick(UUID token) throws FailToPickException %7B%0A        for (ParkingLot parkingLot : parkingLots) %7B%0A            if (parkingLot.contains(token)) %7B%0A                return parkingLot.pick(token);%0A            %7D%0A        %7D%0A        throw new FailToPickException(
+extends Boy %7B%0A    public SmartParkingBoy(ParkingLot... parkingLots) %7B%0A        super(new MoreEmptySpacesStrategy(), parkingLots
 );%0A 

refactor SmartParkingBoy to extend Boy.