//
//  DataController.h
//  Allzic
//
//  Created by Alia Bourouis on 13/03/14.
//  Copyright (c) 2014 Alia Bourouis. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "RadioParser.h"
#import "GeonamesParser.h"
#import "AdswizzParser.h"

@class AppDelegate;

@interface DataController : NSObject <CLLocationManagerDelegate> {
    
    AppDelegate *appDelegate;
    NSUserDefaults *userPreferences;
    CLLocationManager *locationController;
    BOOL gpsEnable;
    double latitude;
    double longitude;
    RadioParser *allzicRadiosParser;
    RadioParser *categoriesParser;
    RadioParser *categoriesRadiosParser;
    RadioParser *countryRadiosParser;
    RadioParser *departmentRadiosParser;
    RadioParser *cityListParser;
    RadioParser *cityRadiosParser;
    RadioParser *aroundMeRadiosParser;
    RadioParser *randomRadiosParser;
    RadioParser *topRadiosParser;
    RadioParser *playlistParser;
    RadioParser *searchParser;
    GeonamesParser *geoParser;
    AdswizzParser *adswizzParser;
    RadioParser *updateAndRatingParser;
    NSMutableArray *lastRadioArray;
    NSArray *currentRadioArray;
    int currentRadioIndex;
    NSMutableArray *favoriteRadioArray;
    NSMutableArray *favoriteCategoryArray;
    int currentAccuracy;
}

@property(nonatomic,strong) NSUserDefaults *userPreferences;
@property(nonatomic,strong) RadioParser *allzicRadiosParser;
@property(nonatomic,strong) RadioParser *categoriesParser;
@property(nonatomic,strong) RadioParser *categoriesRadiosParser;
@property(nonatomic,strong) RadioParser *countryRadiosParser;
@property(nonatomic,strong) RadioParser *departmentRadiosParser;
@property(nonatomic,strong) RadioParser *cityListParser;
@property(nonatomic,strong) RadioParser *cityRadiosParser;
@property(nonatomic,strong) RadioParser *aroundMeRadiosParser;
@property(nonatomic,strong) RadioParser *randomRadiosParser;
@property(nonatomic,strong) RadioParser *topRadiosParser;
@property(nonatomic,strong) RadioParser *playlistParser;
@property(nonatomic,strong) RadioParser *searchParser;
@property(nonatomic,strong) AdswizzParser *adswizzParser;
@property(nonatomic,strong) RadioParser *updateAndRatingParser;
@property(nonatomic,strong) NSMutableArray *lastRadioArray;
@property(nonatomic,strong) NSArray *currentRadioArray;
@property(nonatomic) int currentRadioIndex;
@property(nonatomic,strong) NSMutableArray *favoriteRadioArray;
@property(nonatomic,strong) NSMutableArray *favoriteCategoryArray;
@property(nonatomic) int currentAccuracy;

+ (DataController *)sharedInstance;
- (void)initParsers;
- (void)parseAllzicRadios;
- (void)parseCategories;
- (void)parseRadiosWithCategory:(int)categoryId;
- (void)parseCountries;
- (void)parseRadiosWithCountry:(NSString *)countryId;
- (void)parseNationalRadios;
- (void)parseDepartmentsWithCountry:(NSString *)countryId;
- (void)parseRadiosWithDepartment:(NSString *)department;
- (void)parseCitiesWithCountry:(NSString *)countryId;
- (void)parseRadiosWithCity:(NSString *)city fromCountry:(NSString *)countryId;
- (void)parseLocationRadiosWithAccuracy:(int)accuracyType;
- (void)parseAroundMeRadios;
- (void)parseRandomRadios;
- (void)parseTopRadios;
- (void)parsePlaylist;
- (void)parseResultWithSearch:(NSString *)searchText;
- (void)parseFinished:(id)parserController;
- (void)setCurrentRadioArray:(NSArray *)radios andCurrentRadioIndex:(int)index;
- (void)addFavoriteRadio:(NSDictionary *)radio;
- (void)removeFavoriteRadioWithId:(NSString *)radioId;
- (BOOL)isFavoriteRadioWithId:(NSString *)radioId;
- (void)addFavoriteCategory:(NSDictionary *)category;
- (void)removeFavoriteCategoryWithId:(NSString *)categoryId;
- (BOOL)isFavoriteCategoryWithId:(NSString *)categoryId;
- (void)getGeonames;
- (void)parseAdswizz;
- (void)parseUpdateAndRating;

@end
