package org.rakam.plugin.user;

import com.fasterxml.jackson.annotation.JsonCreator;
import org.rakam.server.http.annotations.ApiParam;

import java.util.Map;


public class User {
    public final Object id;
    public final Map<String, Object> properties;
    public final UserContext api;

    @JsonCreator
    public User(@ApiParam("id") Object id,
                @ApiParam("api") UserContext api,
                @ApiParam("properties") Map<String, Object> properties) {
        this.id = id;
        this.api = api;
        this.properties = properties;
    }

    public static class UserContext {
        public final String apiLibrary;
        public final String apiVersion;
        public final String apiKey;

        @JsonCreator
        public UserContext(@ApiParam("api_key") String apiKey,
                           @ApiParam("writeKey") String writeKey,
                           @ApiParam("api_library") String apiLibrary,
                           @ApiParam("api_version") String apiVersion) {
            this.apiLibrary = apiKey != null ? apiKey : apiLibrary;
            this.apiKey = writeKey;
            this.apiVersion = apiVersion;
        }
    }
}

@@ -837,16 +837,24 @@
 piParam(
+value = 
 %22writeKe
@@ -855,16 +855,37 @@
 riteKey%22
+, access = %22internal%22
 ) String
@@ -1059,22 +1059,18 @@
 this.api
-Librar
+Ke
 y = apiK
@@ -1091,25 +1091,23 @@
 piKey : 
-apiLibrar
+writeKe
 y;%0A     
@@ -1125,21 +1125,27 @@
 .api
-Key = writeKe
+Library = apiLibrar
 y;%0A 

fix bug in User class