#import <Foundation/Foundation.h>
#import "CNConnatixPlayer+CNEventTypeMapper.h"

@implementation CNConnatixPlayer (CNEventTypeMapper)

+ (CNEventType)mapStringToEventType:(NSString *)event {
    if ([event isEqualToString:@"ready"]) {
        return CNEventTypeReady;
    } else if ([event isEqualToString:@"adClick"]) {
        return CNEventTypeAdClick;
    } else if ([event isEqualToString:@"adPlay"]) {
        return CNEventTypeAdPlay;
    } else if ([event isEqualToString:@"adPause"]) {
        return CNEventTypeAdPause;
    } else if ([event isEqualToString:@"adImpression"]) {
        return CNEventTypeAdImpression;
    } else if ([event isEqualToString:@"adCompleted25"]) {
        return CNEventTypeAdCompleted25;
    } else if ([event isEqualToString:@"adCompleted50"]) {
        return CNEventTypeAdCompleted50;
    } else if ([event isEqualToString:@"adCompleted75"]) {
        return CNEventTypeAdCompleted75;
    } else if ([event isEqualToString:@"adCompleted100"]) {
        return CNEventTypeAdCompleted100;
    } else if ([event isEqualToString:@"adSkipped"]) {
        return CNEventTypeAdSkipped;
    } else if ([event isEqualToString:@"adStopped"]) {
        return CNEventTypeAdStopped;
    } else if ([event isEqualToString:@"adCompanion"]) {
        return CNEventTypeAdCompanion;
    } else if ([event isEqualToString:@"videoStarted"]) {
        return CNEventTypeVideoStarted;
    } else if ([event isEqualToString:@"videoCompleted25"]) {
        return CNEventTypeVideoCompleted25;
    } else if ([event isEqualToString:@"videoCompleted50"]) {
        return CNEventTypeAdCompleted50;
    } else if ([event isEqualToString:@"videoCompleted75"]) {
        return CNEventTypeVideoCompleted75;
    } else if ([event isEqualToString:@"videoCompleted100"]) {
        return CNEventTypeVideoCompleted100;
    } else if ([event isEqualToString:@"isViewable"]) {
        return CNEventTypeIsViewable;
    } else if ([event isEqualToString:@"OmidViewabilityThreshold"]) {
        return CNEventTypeOmidViewabilityThreshold;
    } else if ([event isEqualToString:@"play"]) {
        return CNEventTypePlay;
    } else if ([event isEqualToString:@"pause"]) {
        return CNEventTypePause;
    } else if ([event isEqualToString:@"volumeChanged"]) {
        return CNEventTypeVolumeChanged;
    } else if ([event isEqualToString:@"fullscreenChanged"]) {
        return CNEventTypeFullscreenChanged;
    } else if ([event isEqualToString:@"qualityChanged"]) {
        return CNEventTypeQualityChanged;
    } else if ([event isEqualToString:@"subtitlesVisibilityChanged"]) {
        return CNEventTypeSubtitlesVisibilityChanged;
    } else if ([event isEqualToString:@"playerClicked"]) {
        return CNEventTypePlayerClicked;
    } else if ([event isEqualToString:@"setupError"]) {
        return CNEventTypeSetupError;
    } else if ([event isEqualToString:@"playError"]) {
        return CNEventTypePlayError;
    } else if ([event isEqualToString:@"adError"]) {
        return CNEventTypeAdError;
    } else if ([event isEqualToString:@"contentStart"]) {
        return CNEventTypeContentStart;
    } else if ([event isEqualToString:@"changeSlide"]) {
        return CNEventTypeChangeSlide;
    } else if ([event isEqualToString:@"contentComplete"]) {
        return CNEventTypeContentComplete;
    } else if ([event isEqualToString:@"progressBarItemClicked"]) {
        return CNEventTypeProgressBarItemClicked;
    } else if ([event isEqualToString:@"callToAction"]) {
        return CNEventTypeCallToAction;
    } else if ([event isEqualToString:@"brandingClicked"]) {
        return CNEventTypeBrandingClicked;
    } else if ([event isEqualToString:@"layoutChanged"]) {
        return CNEventTypeLayoutChanged;
    } else {
        [NSException raise:@"Invalid event value" format:@"Could not cast event %@ to CNEventType", event];
        return -1;
    }
}

@end
