     // Endpoints for the push server
     private let ENDPOINT_PUSH_STAGING : String = "https://staging-push.moj.io/v2/"
     private let ENDPOINT_PUSH : String = "https://push.moj.io/v2/"
+    
+    // Endpoints for My Mojio
+    private let MY_MOJIO_STAGING : String = "https://staging-my.moj.io/"
+    private let MY_MOJIO_PRODUCTION : String = "https://my.moj.io/"
+    
+    //Endpoints for the push server
+    private let PUSH_PRODUCTION : String = "https://push.moj.io"
+    private let PUSH_STAGING : String = "https://staging-push.moj.io"
+    
+    // Endpoints for accounts
+    private let ACCOUNTS_PRODUCTION : String = ""
+    private let ACCOUNTS_STAGING : String = ""
+    private let ACCOUNTS_PRODUCTION_EU : String = ""
+    
+    
+    private var apiEndpoint : String = ""
+    private var pushEndpoint : String = ""
+    private var myMojioEndpoint : String = ""
+    private var accountsEndpoint : String = ""
+    
+    init () {
+        if self.environment == nil {
+            self.setDefaultEnvironment()
+        }
+    }
 
+    /*
+        The user is deemed to be in Europe if the locale of the device is set to one of the countries in the EU. Otherwise, the app will connect to the North American endpoint
+    */
     private func isUserInEU () -> Bool {
         
         let euCountrySet : NSSet = NSSet(array: ["AL", "AD", "AM", "AT", "BY", "BE", "BA", "BG", "CH", "CY", "CZ", "DE",


import UIKit

class MojioClientEnvironment {
    
    // making the SDK environment a singleton
    static let clientEnvironment = MojioClientEnvironment()
    
    private let ENDPOINT_PRODUCTION : String = "https://api.moj.io/v2/"
    private let ENDPOINT_PRODUCTION_EU : String = "https://cz-api.moj.io/v2/"

        return false
    }
    
    /**
        Letting an app developer ovveride the default environment. This should be used only for development purposes to test the functionality of the app in different continents
     */
    func setEnvironment (environment : Environment) {
        self.environment = environment
        
        switch environment {
            
        case Environment.AMERICA_PRODUCTION:
            self.apiEndpoint = self.ENDPOINT_PRODUCTION
            self.pushEndpoint = self.PUSH_PRODUCTION
            self.myMojioEndpoint = self.MY_MOJIO_PRODUCTION
            
        case Environment.AMERICA_STAGING:
            self.apiEndpoint = self.ENDPOINT_STAGING
            self.pushEndpoint = self.PUSH_STAGING
            self.myMojioEndpoint = self.MY_MOJIO_STAGING
        
        
        case Environment.AMERICA_DEVELOP:
            self.apiEndpoint = self.ENDPOINT_DEVELOP
        
        case Environment.EU_PRODUCTION:
            self.apiEndpoint = self.ENDPOINT_PRODUCTION_EU
        }
    }
    
    func getDefaultEnvironment () -> Environment {
        if self.isUserInEU () {
            return Environment.EU_PRODUCTION
        }
        else {
            return Environment.AMERICA_PRODUCTION
        }
    }
    
    func setDefaultEnvironment () {
        if self.isUserInEU() {
            self.setEnvironment(Environment.EU_PRODUCTION)
        }
        else {
            self.setEnvironment(Environment.AMERICA_PRODUCTION)
        }
    }
    
    func getEnvironment () -> Environment {
        if self.environment != nil {
            return self.environment!
        }
        return self.getDefaultEnvironment()
    }
    
    func getApiEndpoint () -> String {
        let currentEnvironment : Environment = self.getEnvironment()
        switch currentEnvironment {
            
        case Environment.AMERICA_PRODUCTION:
            return self.ENDPOINT_PRODUCTION
        
        case Environment.AMERICA_STAGING:
            return self.ENDPOINT_STAGING
            
        case Environment.AMERICA_DEVELOP:
            return self.ENDPOINT_DEVELOP
            
        case Environment.EU_PRODUCTION:
            return ENDPOINT_PRODUCTION_EU
        }
    }
}
