// Path: app/src/main/java/com/projects/elad/hacklist/data/api/HacklistService.java
// public interface HacklistService {
// 
//   @GET("/{YEAR}/{MONTH}.json")
//   Observable<Map<String, List<HackEvent>>> getMonthObject(@Path("YEAR") String year, @Path("MONTH") String month);
// 
// 
//   /******** Helper class that sets up new services *******/
//   class ServiceCreator {
// 
//     public static HacklistService newHacklistService() {
//       RestAdapter retrofitAdapter = new RestAdapter.Builder()
//               .setLogLevel(RestAdapter.LogLevel.FULL)
//               .setEndpoint(Constants.HACKALIST_BASE_URL)
//               .build();
// 
//       return retrofitAdapter.create(HacklistService.class);
//     }
//   }
// 
// }
// 
// Path: app/src/main/java/com/projects/elad/hacklist/data/db/BookmarkDbEntity.java
// public class BookmarkDbEntity extends RealmObject {
//     @PrimaryKey
//     private String eventTitle;
//     private String facebookUrl;
// 
// 
//     public BookmarkDbEntity() {
// 
//     }
// 
//     public BookmarkDbEntity(ListItem item) {
//         this.eventTitle = item.getTitle();
//         this.facebookUrl = item.getFacebookUrl();
//     }
// 
// 
//     public String getEventTitle() {
//         return eventTitle;
//     }
// 
//     public String getFacebookUrl() {
//         return facebookUrl;
//     }
// 
//     public void setEventTitle(String eventTitle) {
//         this.eventTitle = eventTitle;
//     }
// 
//     public void setFacebookUrl(String facebookUrl) {
//         this.facebookUrl = facebookUrl;
//     }
// }
// 
// Path: app/src/main/java/com/projects/elad/hacklist/data/db/RealmBookmarksHelper.java
// public class RealmBookmarksHelper {
//     private Realm realm;
//     private Context context;
//     @Inject
//     public RealmBookmarksHelper(Context context) {
//         Realm.init(context);
//         this.context = context;
//     }
// 
//     public void writeToRealm(BookmarkDbEntity bookmarkToSave) {
//        try {
//            realm = Realm.getDefaultInstance();
//            realm.executeTransaction(transactionRealm -> {
//                BookmarkDbEntity bookmark = findInRealm(transactionRealm, bookmarkToSave.getEventTitle());
//                if (bookmark == null)
//                    bookmark = transactionRealm.createObject(BookmarkDbEntity.class, bookmarkToSave.getEventTitle());
//                bookmark.setFacebookUrl(bookmarkToSave.getFacebookUrl());
// 
//            });
//        } finally {
//            realm.close();
//        }
//     }
// 
// 
//     public BookmarkDbEntity findInRealm(Realm realm, String title) {
//         return realm.where(BookmarkDbEntity.class).equalTo("eventTitle",title).findFirst();
//     }
// 
//     public List<BookmarkDbEntity> findAllBookmarks() {
//         realm = Realm.getDefaultInstance();
//         return realm.where(BookmarkDbEntity.class).findAll();
//     }
// 
//     public void deleteBookmark(String title) {
//         try {
//             realm = Realm.getDefaultInstance();
// 
//             realm.executeTransaction(transactionRealm -> {
//                 BookmarkDbEntity bookmark = findInRealm(transactionRealm, title);
//                 if (bookmark!=null) bookmark.deleteFromRealm();
//             });
//         } finally {
//             realm.close();
//         }
//     }
// 
//     public boolean isInDatabase(String title) {
//         realm = Realm.getDefaultInstance();
//         BookmarkDbEntity entity = realm.where(BookmarkDbEntity.class).equalTo("eventTitle", title).findFirst();
//         realm.close();
//         return entity != null;
//     }
// }
// 
// Path: app/src/main/java/com/projects/elad/hacklist/util/CurrDate.java
// public class CurrDate {
//    private  int currYearInt;
//    private  int currMonthInt;
//    private  String currentYear;
//    private  String currentMonth;
// 
//     public CurrDate() {
//          Calendar calender = Calendar.getInstance();
// 
//          currYearInt = calender.get(Calendar.YEAR);
//          currMonthInt = calender.get(Calendar.MONTH);
// 
//          currentYear = String.valueOf(currYearInt);
//          currentMonth = Utils.getStringForMonthInt(currMonthInt);
//     }
// 
//     public int getCurrYearInt() {
//         return currYearInt;
//     }
// 
//     public int getCurrMonthInt() {
//         return currMonthInt;
//     }
// 
//     public String getCurrentYear() {
//         return currentYear;
//     }
// 
//     public String getCurrentMonth() {
//         return currentMonth;
//     }
// }


import com.projects.elad.hacklist.data.api.HacklistService;
import com.projects.elad.hacklist.data.db.BookmarkDbEntity;
import com.projects.elad.hacklist.data.db.RealmBookmarksHelper;
import com.projects.elad.hacklist.util.CurrDate;
import java.util.List;
import javax.inject.Inject;
import rx.Observable;
package com.projects.elad.hacklist.data;





/**
 * Created by EladKeyshawn on 24/02/2017.
 */

public class DataManager {
    private HacklistService hacklistService;
    private CurrDate date;
    private RealmBookmarksHelper realmHelper;
    @Inject
    public DataManager(HacklistService hacklistService , CurrDate date, RealmBookmarksHelper realmBookmarksHelper) {
        this.hacklistService = hacklistService;
        this.date = date;
        this.realmHelper = realmBookmarksHelper;
    }

    public HacklistService getHacklistService() {
        return hacklistService;
    }

// Path: app/src/main/java/com/projects/elad/hacklist/data/api/HacklistService.java
// public interface HacklistService {
// 
//   @GET("/{YEAR}/{MONTH}.json")
//   Observable<Map<String, List<HackEvent>>> getMonthObject(@Path("YEAR") String year, @Path("MONTH") String month);
// 
// 
//   /******** Helper class that sets up new services *******/
//   class ServiceCreator {
// 
//     public static HacklistService newHacklistService() {
//       RestAdapter retrofitAdapter = new RestAdapter.Builder()
//               .setLogLevel(RestAdapter.LogLevel.FULL)
//               .setEndpoint(Constants.HACKALIST_BASE_URL)
//               .build();
// 
//       return retrofitAdapter.create(HacklistService.class);
//     }
//   }
// 
// }
// 
// Path: app/src/main/java/com/projects/elad/hacklist/data/db/BookmarkDbEntity.java
// public class BookmarkDbEntity extends RealmObject {
//     @PrimaryKey
//     private String eventTitle;
//     private String facebookUrl;
// 
// 
//     public BookmarkDbEntity() {
// 
//     }
// 
//     public BookmarkDbEntity(ListItem item) {
//         this.eventTitle = item.getTitle();
//         this.facebookUrl = item.getFacebookUrl();
//     }
// 
// 
//     public String getEventTitle() {
//         return eventTitle;
//     }
// 
//     public String getFacebookUrl() {
//         return facebookUrl;
//     }
// 
//     public void setEventTitle(String eventTitle) {
//         this.eventTitle = eventTitle;
//     }
// 
//     public void setFacebookUrl(String facebookUrl) {
//         this.facebookUrl = facebookUrl;
//     }
// }
// 
// Path: app/src/main/java/com/projects/elad/hacklist/data/db/RealmBookmarksHelper.java
// public class RealmBookmarksHelper {
//     private Realm realm;
//     private Context context;
//     @Inject
//     public RealmBookmarksHelper(Context context) {
//         Realm.init(context);
//         this.context = context;
//     }
// 
//     public void writeToRealm(BookmarkDbEntity bookmarkToSave) {
//        try {
//            realm = Realm.getDefaultInstance();
//            realm.executeTransaction(transactionRealm -> {
//                BookmarkDbEntity bookmark = findInRealm(transactionRealm, bookmarkToSave.getEventTitle());
//                if (bookmark == null)
//                    bookmark = transactionRealm.createObject(BookmarkDbEntity.class, bookmarkToSave.getEventTitle());
//                bookmark.setFacebookUrl(bookmarkToSave.getFacebookUrl());
// 
//            });
//        } finally {
//            realm.close();
//        }
//     }
// 
// 
//     public BookmarkDbEntity findInRealm(Realm realm, String title) {
//         return realm.where(BookmarkDbEntity.class).equalTo("eventTitle",title).findFirst();
//     }
// 
//     public List<BookmarkDbEntity> findAllBookmarks() {
//         realm = Realm.getDefaultInstance();
//         return realm.where(BookmarkDbEntity.class).findAll();
//     }
// 
//     public void deleteBookmark(String title) {
//         try {
//             realm = Realm.getDefaultInstance();
// 
//             realm.executeTransaction(transactionRealm -> {
//                 BookmarkDbEntity bookmark = findInRealm(transactionRealm, title);
//                 if (bookmark!=null) bookmark.deleteFromRealm();
//             });
//         } finally {
//             realm.close();
//         }
//     }
// 
//     public boolean isInDatabase(String title) {
//         realm = Realm.getDefaultInstance();
//         BookmarkDbEntity entity = realm.where(BookmarkDbEntity.class).equalTo("eventTitle", title).findFirst();
//         realm.close();
//         return entity != null;
//     }
// }
// 
// Path: app/src/main/java/com/projects/elad/hacklist/util/CurrDate.java
// public class CurrDate {
//    private  int currYearInt;
//    private  int currMonthInt;
//    private  String currentYear;
//    private  String currentMonth;
// 
//     public CurrDate() {
//          Calendar calender = Calendar.getInstance();
// 
//          currYearInt = calender.get(Calendar.YEAR);
//          currMonthInt = calender.get(Calendar.MONTH);
// 
//          currentYear = String.valueOf(currYearInt);
//          currentMonth = Utils.getStringForMonthInt(currMonthInt);
//     }
// 
//     public int getCurrYearInt() {
//         return currYearInt;
//     }
// 
//     public int getCurrMonthInt() {
//         return currMonthInt;
//     }
// 
//     public String getCurrentYear() {
//         return currentYear;
//     }
// 
//     public String getCurrentMonth() {
//         return currentMonth;
//     }
// }


// Path: app/src/main/java/com/projects/elad/hacklist/data/DataManager.java
import com.projects.elad.hacklist.data.api.HacklistService;
import com.projects.elad.hacklist.data.db.BookmarkDbEntity;
import com.projects.elad.hacklist.data.db.RealmBookmarksHelper;
import com.projects.elad.hacklist.util.CurrDate;
import java.util.List;
import javax.inject.Inject;
import rx.Observable;

package com.projects.elad.hacklist.data;





/**
 * Created by EladKeyshawn on 24/02/2017.
 */

public class DataManager {
    private HacklistService hacklistService;
    private CurrDate date;
    private RealmBookmarksHelper realmHelper;
    @Inject
    public DataManager(HacklistService hacklistService , CurrDate date, RealmBookmarksHelper realmBookmarksHelper) {
        this.hacklistService = hacklistService;
        this.date = date;
        this.realmHelper = realmBookmarksHelper;
    }

    public HacklistService getHacklistService() {
        return hacklistService;
    }

    public CurrDate getDate() {