// Path: app/src/main/java/com/zulip/android/models/Reaction.java
// @DatabaseTable(tableName = "reactions")
// public class Reaction {
//     private static final String ID_FIELD = "id";
//     private static final String NAME_FIELD = "name";
//     private static final String USER_FIELD = "user";
//     private static final String MESSAGE_FIELD = "message";
// 
// 
//     @SerializedName("emoji_name")
//     @DatabaseField(columnName = NAME_FIELD)
//     private String emojiName;
// 
//     @SerializedName("user")
//     @DatabaseField(foreign = true, columnName = USER_FIELD)
//     private UserReaction user;
// 
//     @DatabaseField(foreign = true, foreignAutoRefresh = true, columnName = MESSAGE_FIELD)
//     private Message message;
// 
// 
//     /**
//      * Construct an empty Reaction object.
//      */
//     public Reaction() {
// 
//     }
// 
//     public String getEmoji() {
//         return this.emojiName;
//     }
// 
//     public void setEmoji(String name) {
//         this.emojiName = name;
//     }
// 
//     public UserReaction getUser() {
//         return this.user;
//     }
// 
//     public void setUser(UserReaction user) {
//         this.user = user;
//     }
// 
//     @Override
//     public String toString() {
//         return ":" + getEmoji() + ":";
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj instanceof Reaction) {
//             Reaction reaction = (Reaction) obj;
//             return this.emojiName.equals(reaction.emojiName) && this.user.equals(reaction.user);
//         } else {
//             return false;
//         }
//     }
// }
// 
// Path: app/src/main/java/com/zulip/android/models/UserReaction.java
// @DatabaseTable(tableName = "reactions_user")
// public class UserReaction {
//     private static final String ID_FIELD = "id";
//     private static final String NAME_FIELD = "name";
//     private static final String EMAIL_FIELD = "email";
// 
//     @SerializedName("id")
//     @DatabaseField(id = true, columnName = ID_FIELD)
//     private int id;
// 
//     @SerializedName("full_name")
//     @DatabaseField(columnName = NAME_FIELD)
//     private String name;
// 
//     @SerializedName("email")
//     @DatabaseField(columnName = EMAIL_FIELD)
//     private String email;
// 
//     /**
//      * Used in reaction type event {@link com.zulip.android.networking.response.events.ReactionWrapper}
//      */
//     @SerializedName("user_id")
//     private int alternateId;
// 
//     /**
//      * Construct an empty User object.
//      */
//     public UserReaction() {
// 
//     }
// 
// 
//     public int getId() {
//         return this.id;
//     }
// 
//     public String getName() {
//         return this.name;
//     }
// 
//     public String getEmail() {
//         return this.email;
//     }
// 
//     public int getAlternateId() {
//         return this.alternateId;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj instanceof UserReaction) {
//             UserReaction user = (UserReaction) obj;
//             return this.getId() == user.getId();
//         } else {
//             return false;
//         }
//     }
// }


import com.google.gson.annotations.SerializedName;
import com.zulip.android.models.Reaction;
import com.zulip.android.models.UserReaction;
package com.zulip.android.networking.response.events;


/**
 * This class is used to deserialize the reaction type event {@link EventsBranch.BranchType#REACTION}
 * example: {"emoji_name":"alarm_clock","id":54,"user":{"user_id":346,"email":"abc@gmail.com","full_name":"anonymous user"},"type":"reaction","message_id":163213,"op":"add"}
 * {"emoji_name":"alarm_clock","id":72,"user":{"user_id":346,"email":"abc@gmail.com","full_name":"anonymous user"},"type":"reaction","message_id":163213,"op":"remove"}
 */

public class ReactionWrapper extends EventsBranch {
    public static final String OPERATION_ADD = "add";
    public static final String OPERATION_REMOVE = "remove";

    @SerializedName("emoji_name")
    private String emoji;

    @SerializedName("user")
    private UserReaction user;

    @SerializedName("message_id")
    private int messageId;

    @SerializedName("op")
    private String operation;

    public ReactionWrapper() {
    }

    public int getMessageId() {
        return this.messageId;
    }

    public Reaction getReaction() {
        // correctly initialize User object
        if (this.user != null) {
            this.user.setId(this.user.getAlternateId());
        }

// Path: app/src/main/java/com/zulip/android/models/Reaction.java
// @DatabaseTable(tableName = "reactions")
// public class Reaction {
//     private static final String ID_FIELD = "id";
//     private static final String NAME_FIELD = "name";
//     private static final String USER_FIELD = "user";
//     private static final String MESSAGE_FIELD = "message";
// 
// 
//     @SerializedName("emoji_name")
//     @DatabaseField(columnName = NAME_FIELD)
//     private String emojiName;
// 
//     @SerializedName("user")
//     @DatabaseField(foreign = true, columnName = USER_FIELD)
//     private UserReaction user;
// 
//     @DatabaseField(foreign = true, foreignAutoRefresh = true, columnName = MESSAGE_FIELD)
//     private Message message;
// 
// 
//     /**
//      * Construct an empty Reaction object.
//      */
//     public Reaction() {
// 
//     }
// 
//     public String getEmoji() {
//         return this.emojiName;
//     }
// 
//     public void setEmoji(String name) {
//         this.emojiName = name;
//     }
// 
//     public UserReaction getUser() {
//         return this.user;
//     }
// 
//     public void setUser(UserReaction user) {
//         this.user = user;
//     }
// 
//     @Override
//     public String toString() {
//         return ":" + getEmoji() + ":";
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj instanceof Reaction) {
//             Reaction reaction = (Reaction) obj;
//             return this.emojiName.equals(reaction.emojiName) && this.user.equals(reaction.user);
//         } else {
//             return false;
//         }
//     }
// }
// 
// Path: app/src/main/java/com/zulip/android/models/UserReaction.java
// @DatabaseTable(tableName = "reactions_user")
// public class UserReaction {
//     private static final String ID_FIELD = "id";
//     private static final String NAME_FIELD = "name";
//     private static final String EMAIL_FIELD = "email";
// 
//     @SerializedName("id")
//     @DatabaseField(id = true, columnName = ID_FIELD)
//     private int id;
// 
//     @SerializedName("full_name")
//     @DatabaseField(columnName = NAME_FIELD)
//     private String name;
// 
//     @SerializedName("email")
//     @DatabaseField(columnName = EMAIL_FIELD)
//     private String email;
// 
//     /**
//      * Used in reaction type event {@link com.zulip.android.networking.response.events.ReactionWrapper}
//      */
//     @SerializedName("user_id")
//     private int alternateId;
// 
//     /**
//      * Construct an empty User object.
//      */
//     public UserReaction() {
// 
//     }
// 
// 
//     public int getId() {
//         return this.id;
//     }
// 
//     public String getName() {
//         return this.name;
//     }
// 
//     public String getEmail() {
//         return this.email;
//     }
// 
//     public int getAlternateId() {
//         return this.alternateId;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj instanceof UserReaction) {
//             UserReaction user = (UserReaction) obj;
//             return this.getId() == user.getId();
//         } else {
//             return false;
//         }
//     }
// }


// Path: app/src/main/java/com/zulip/android/networking/response/events/ReactionWrapper.java
import com.google.gson.annotations.SerializedName;
import com.zulip.android.models.Reaction;
import com.zulip.android.models.UserReaction;

package com.zulip.android.networking.response.events;


/**
 * This class is used to deserialize the reaction type event {@link EventsBranch.BranchType#REACTION}
 * example: {"emoji_name":"alarm_clock","id":54,"user":{"user_id":346,"email":"abc@gmail.com","full_name":"anonymous user"},"type":"reaction","message_id":163213,"op":"add"}
 * {"emoji_name":"alarm_clock","id":72,"user":{"user_id":346,"email":"abc@gmail.com","full_name":"anonymous user"},"type":"reaction","message_id":163213,"op":"remove"}
 */

public class ReactionWrapper extends EventsBranch {
    public static final String OPERATION_ADD = "add";
    public static final String OPERATION_REMOVE = "remove";

    @SerializedName("emoji_name")
    private String emoji;

    @SerializedName("user")
    private UserReaction user;

    @SerializedName("message_id")
    private int messageId;

    @SerializedName("op")
    private String operation;

    public ReactionWrapper() {
    }

    public int getMessageId() {
        return this.messageId;
    }

    public Reaction getReaction() {
        // correctly initialize User object
        if (this.user != null) {
            this.user.setId(this.user.getAlternateId());
        }

        Reaction retVal = new Reaction();