 import Foundation
-
-
-
-
-//private static final String EVENT_LOAD = "lo";
-//private static final String EVENT_PLAY = "pl";
-//private static final String EVENT_PAUSE = "pa";
-//private static final String EVENT_ONLINE = "on";
-//private static final String EVENT_COMPLETE = "co";
 
 class TrackingLive: NSObject, Tracking {
 

    func onLoadPlugin(with player: SambaPlayer) {
        self.player = player

        player.delegate = self
    }
    
    
    func onDestroyPlugin() {
        
    }
    
}

class STTM2 {
    
    fileprivate static let EVENT_LOAD = "lo"
    fileprivate static let EVENT_PLAY = "pl"
    fileprivate static let EVENT_PAUSE = "pa"
    fileprivate static let EVENT_ONLINE = "on"
    
	private var _media: SambaMediaConfig
	private var _timer: Timer?

    func cancelOnEventTask() {
        guard let mTimer = _timer else {return}
        mTimer.invalidate()
        _timer = nil
        isEventTimerTaskRunning = false
    }
    
    func trackPlayAndONEvent() {
        sendEvents(.play, .online)
    }
    
    func trackPauseEvent() {
        sendEvents(.pause)
    }
    
    func trackLoadEvent() {
        sendEvents(.load)
    }
    
    func trackOnEvent() {
        sendEvents(.online)
    }
    
    func sendEvents(_ events: STTM2Event...) {
        
        var finalEvent: String?
        
        if events.count > 1 {
            finalEvent = events.map{$0.rawValue}.joined(separator: ",")
        } else {
            finalEvent = events[0].rawValue
        }
        
        
