package View;

import Controller.Controller;
import Model.Car;
import Model.IVehicle;
import Model.Motorcycle;
import Model.Bicycle;
import Repository.IRepository;
import Repository.VehicleRepo;

public class View {
    public static void main(String[] args) {
        IRepository repo;
        try{
            repo = new VehicleRepo(-5);
        } 
        catch(IllegalArgumentException e) {
            System.out.println(e.getMessage());
            return;
        }
        Controller controller = new Controller(repo);
        Car car = new Car("BMW", "Red");
        Motorcycle motorcycle = new Motorcycle("Honda", "Black");
        Bicycle bicycle = new Bicycle("Trek", "Blue");
        Bicycle bicycle2 = new Bicycle("Trek", "Red");
        try{
            controller.addVehicle(car);
            controller.addVehicle(motorcycle);
            controller.addVehicle(bicycle);
            controller.addVehicle(bicycle2);
        }
        catch(IllegalArgumentException e) {
            System.out.println(e.getMessage());
            return;
        }
        IVehicle[] filteredVehicles = controller.filterVehicles("Red");
        for(IVehicle vehicle : filteredVehicles) {
            System.out.println(vehicle.toString());
        }
    }
}
