/*
 * Copyright (c) 2017, University of Oslo
 *
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 * Neither the name of the HISP project nor the names of its contributors may
 * be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.hisp.dhis.android.core.user;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;

import org.hisp.dhis.android.core.common.BaseIdentifiableObject;
import org.hisp.dhis.android.core.data.api.Field;

import java.util.Date;

@AutoValue
public abstract class UserRole extends BaseIdentifiableObject {

    public static final Field<UserRole, String> uid = Field.create(UID);
    public static final Field<UserRole, String> code = Field.create(CODE);
    public static final Field<UserRole, String> name = Field.create(NAME);
    public static final Field<UserRole, String> displayName = Field.create(DISPLAY_NAME);
    public static final Field<UserRole, String> created = Field.create(CREATED);
    public static final Field<UserRole, String> lastUpdated = Field.create(LAST_UPDATED);
    public static final Field<UserRole, Boolean> deleted = Field.create(DELETED);

    @JsonCreator
    public static UserRole create(
            @JsonProperty(UID) String uid,
            @JsonProperty(CODE) String code,
            @JsonProperty(NAME) String name,
            @JsonProperty(DISPLAY_NAME) String displayName,
            @JsonProperty(CREATED) Date created,
            @JsonProperty(LAST_UPDATED) Date lastUpdated,
            @JsonProperty(DELETED) Boolean deleted) {

        return new AutoValue_UserRole(uid, code, name, displayName, created, lastUpdated, deleted);
    }
}
@@ -1588,16 +1588,49 @@
 .user;%0A%0A
+import android.database.Cursor;%0A%0A
 import c
@@ -1642,32 +1642,41 @@
 sterxml.jackson.
+databind.
 annotation.JsonC
@@ -1674,23 +1674,27 @@
 ion.Json
-Creator
+Deserialize
 ;%0Aimport
@@ -1716,16 +1716,25 @@
 jackson.
+databind.
 annotati
@@ -1741,23 +1741,26 @@
 on.JsonP
-roperty
+OJOBuilder
 ;%0Aimport
@@ -1897,456 +1897,285 @@
 ore.
-data.api.Fi
+common.Mod
 el
-d
 ;%0A%0A
-import java.util.Date;%0A%0A@AutoValue%0Apublic abstract class UserRole extends BaseIdentifiableObject %7B%0A%0A    public static final Field%3CUserRole, String%3E uid = Field.create(UID);%0A    public static final Field%3CUserRole, String%3E code = Field.create(CODE);%0A    public static final Field%3CUserRole, String%3E name = Field.create(NAME);%0A    public static final Field%3CUserRole, String%3E displayName = Field.create(DISPLAY_NAME
+@AutoValue%0A@JsonDeserialize(builder = AutoValue_UserRole.Builder.class)%0Apublic abstract class UserRole extends BaseIdentifiableObject implements Model %7B%0A%0A%0A    public static Builder builder() %7B%0A        return new $$AutoValue_UserRole.Builder(
 );%0A    
-public
+%7D%0A%0A   
  static 
 fina
@@ -2174,748 +2174,387 @@
 tic 
-final Field%3CUserRole, String%3E created = Field.create(CREATED);%0A    public static final Field%3CUserRole, String%3E lastUpdated = Field.create(LAST_UPDATED);%0A    public static final Field%3CUserRole, Boolean%3E deleted = Field.create(DELETED
+UserRole create(Cursor cursor) %7B%0A        return $AutoValue_userRole.createFromCursor(cursor
 );%0A
-%0A
     
-@JsonCreator%0A    public static UserRole create(%0A            @JsonProperty(UID) String uid,%0A            @JsonProperty(CODE) String code,%0A            @JsonProperty(NAME) String name,%0A            @JsonProperty(DISPLAY_NAME) String displayName,%0A            @JsonProperty(CREATED) Date created,%0A            @JsonProperty(LAST_UPDATED) Date lastUpdated,%0A            @JsonProperty(DELETED) Boolean deleted) %7B%0A%0A        return new AutoValue_UserRole(uid, code, name, displayName, created, lastUpdated, deleted
+%7D%0A%0A    public abstract Builder toBuilder();%0A%0A    @AutoValue.Builder%0A    @JsonPOJOBuilder(withPrefix = %22%22)%0A    public abstract static class Builder extends BaseIdentifiableObject.Builder%3CBuilder%3E%7B%0A        public abstract Builder id(Long id);%0A%0A        public abstract UserRole build(
 );%0A 

Unify UserRole