package controllers;

import java.rmi.ServerException;
import java.util.Date;

import repositoryMem.GroupRepository;
import repositoryMem.ProfileRepository;
import repositoryMem.TripRepository;
import domain.ControllerNotLoadedException;
import domain.GroupNameAlreadyExistsException;
import domain.SessionNotActiveException;
import domain.UserNameAlreadyExistsException;

public class DEMO {

    public static void main(String[] args) throws SessionNotActiveException, ControllerNotLoadedException, GroupNameAlreadyExistsException {
        Application app = Application.getInstance();
        Session session = Session.getInstance();
        TripRepository tripRepo = new TripRepository(null, null);
        GroupRepository groupRepo = new GroupRepository(null, null);
        ProfileRepository userRepo = new ProfileRepository(null, null);
        CollectionAndSearchController searchRepo = new CollectionAndSearchController(userRepo, groupRepo, tripRepo);

        try {

            app.registerUser("naty", "natalia", "navas", new Date(1994, 3, 13), true, "agua", "lkj", "lkj@gmail.com");
            app.registerUser("nacho", "ignacio", "cifuentes", new Date(1994, 3, 13), false, "agua", "lkj", "lkj@gmail.com");
            System.out.println("SE CREO A NATY");
            session.logIn("naty", "agua");
            System.out.println(session.getUserName());


            CurrentProfileController naty = app.getCurrentProfileController();
            //ProfileController nacho = app.getAProfileController(profile);


            System.out.println("se levanta user: " + naty.getUsername());
            MyGroupController group1 = app.registerGroup("groupName", naty, 3, 3, "ciudad");




        } catch (ServerException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (UserNameAlreadyExistsException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

@@ -642,324 +642,8 @@
     
-TripRepository tripRepo = new TripRepository(null, null);%0A        GroupRepository groupRepo = new GroupRepository(null, null);%0A        ProfileRepository userRepo = new ProfileRepository(null, null);%0A        CollectionAndSearchController searchRepo = new CollectionAndSearchController(userRepo, groupRepo, tripRepo);%0A
 %0A   
@@ -890,32 +890,45 @@
 kj@gmail.com%22);%0A
+            %0A
             Syst
@@ -1020,43 +1020,280 @@
     
-System.out.println(session.getUserN
+CollectionAndSearchController searchContr = app.getCollectionController();%0A%0A            //ProfileController nacho = searchRepo.getProfileControllerByUsername(%22nacho%22);%0A            //System.out.println(session.getUserName());%0A            //System.out.println(nacho.getUsern
 ame(
@@ -1310,16 +1310,18 @@
         
+//
 CurrentP
@@ -1461,32 +1461,34 @@
 ;%0A%0A%0A            
+//
 System.out.print
@@ -1545,16 +1545,18 @@
         
+//
 MyGroupC

update demo con lo de collection