package org.atlasapi.model.translators;

import org.atlasapi.application.SourceStatus;

public class SourceStatusModelTranslator {
    public static SourceStatus transform3To4(org.atlasapi.application.v3.SourceStatus sourceStatus) {
    	return new SourceStatus(transform3To4(sourceStatus.getState()), sourceStatus.isEnabled());
    }
    
    public static SourceStatus.SourceState transform3To4(org.atlasapi.application.v3.SourceStatus.SourceState sourceState) {
    	return SourceStatus.SourceState.valueOf(sourceState.name().toString());
    }
    
    public static org.atlasapi.application.v3.SourceStatus transform4To3(SourceStatus sourceStatus) {
    	org.atlasapi.application.v3.SourceStatus v3Status = org.atlasapi.application.v3.SourceStatus.UNAVAILABLE.copyWithState(transform4To3(sourceStatus.getState()));
    	if (sourceStatus.isEnabled()) {
    		return v3Status.enable();
    	} else {
    		return v3Status.disable();
    	}
    }
    
    public static org.atlasapi.application.v3.SourceStatus.SourceState transform4To3(SourceStatus.SourceState sourceState) {
    	return org.atlasapi.application.v3.SourceStatus.SourceState.valueOf(sourceState.name());
    }
}

@@ -745,16 +745,24 @@
 ceStatus
+%0A    %09%09%09
 .UNAVAIL
@@ -829,16 +829,85 @@
     %09if 
+(sourceStatus.equals(SourceStatus.SourceState.AVAILABLE)) %7B%0A    %09%09if 
 (sourceS
@@ -927,24 +927,28 @@
 ed()) %7B%0A    
+   
+ 
 %09%09return v3S
@@ -959,24 +959,28 @@
 s.enable();%0A
+    
     %09%7D else 
@@ -981,16 +981,20 @@
  else %7B%0A
+    
     %09%09re
@@ -1022,18 +1022,71 @@
 ();%0A    
+    %09%7D%0A    %09%7D else %7B%0A    %09%09return v3Status;%0A    %09%7D    
 %09
-%7D
 %0A    %7D%0A 

Fix deserialisation of SourceStatus