package vehicle_rental;

import java.util.Iterator;

import javax.lang.model.element.VariableElement;

public class Run {

	public static void main(String[] args) {
		RentalDAO rentalStorage = new RentalDAO();

		Vehicle vehicle1 = new Vehicle(1, "Honda", false);
		Vehicle vehicle2 = new Vehicle(2, "Toyota", true);

		Engine engine1 = new Engine(1200);
		Car car = new Car(3, "Aion", false, engine1);

		Bike bike1 = new Bike(4, "YT", false, "enduro");

		rentalStorage.add(vehicle1);
		rentalStorage.add(vehicle2);
		rentalStorage.add(car);
		rentalStorage.add(bike1);

		// rentalStorage.forEach((n) -> {System.out.println(n);});

		for (Vehicle v : rentalStorage.getStorage()) {
			System.out.println(v);
		}
		
		System.out.println();
		
		for (Vehicle v : rentalStorage.getStorage()) {
			v.drive();
		}

		System.out.println();
		try {
			vehicle1.rent();
		} catch (VehicleAlreadyRentedException e) {
			e.printStackTrace();
		} finally {
			System.out.println(vehicle1);
		}

		System.out.println();
		try {
			vehicle1.rent();
		} catch (VehicleAlreadyRentedException e) {
			e.printStackTrace();
		} finally {
			System.out.println(vehicle1);
		}
	}
}