package com.vimeo.networking.model;

import com.vimeo.stag.GsonAdapterKey;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.Serializable;

/**
 * A model that contains recommendations for a User to follow.
 * A recommendation can either be a {@link User} or {@link Channel}
 * <p/>
 * Created by zetterstromk on 8/15/16.
 */
public class Recommendation implements Serializable {

    private static final long serialVersionUID = -1451431453348153582L;

    static final String TYPE_CHANNEL = "channel";
    static final String TYPE_USER = "user";

    public enum RecommendationType {
        NONE,
        CHANNEL,
        USER
    }

    /**
     * Null if not recommended by a category
     */
    @Nullable
    @GsonAdapterKey("category")
    public Category mCategory;

    @Nullable
    @GsonAdapterKey("type")
    public String mRecommendationType;

    /**
     * Null if type is not user
     */
    @Nullable
    @GsonAdapterKey("user")
    public User mUser;

    /**
     * Null if type is not channel
     */
    @Nullable
    @GsonAdapterKey("channel")
    public Channel mChannel;

    @Nullable
    @GsonAdapterKey("description")
    public String mDescription;

    @Nullable
    @GsonAdapterKey("resource_key")
    public String mResourceKey;

    @NotNull
    public RecommendationType getRecommendationType() {
        if (TYPE_CHANNEL.equals(mRecommendationType)) {
            return RecommendationType.CHANNEL;
        } else if (TYPE_USER.equals(mRecommendationType)) {
            return RecommendationType.USER;
        } else {
            return RecommendationType.NONE;
        }
    }

}

@@ -1304,24 +1304,701 @@
 sourceKey;%0A%0A
+    // -----------------------------------------------------------------------------------------------------%0A    // Getters%0A    // -----------------------------------------------------------------------------------------------------%0A    // %3Ceditor-fold desc=%22Getters%22%3E%0A    @Nullable%0A    public Category getCategory() %7B%0A        return mCategory;%0A    %7D%0A%0A    @Nullable%0A    public User getUser() %7B%0A        return mUser;%0A    %7D%0A%0A    @Nullable%0A    public Channel getChannel() %7B%0A        return mChannel;%0A    %7D%0A%0A    @Nullable%0A    public String getDescription() %7B%0A        return mDescription;%0A    %7D%0A%0A    @Nullable%0A    public String getResourceKey() %7B%0A        return mResourceKey;%0A    %7D%0A%0A
     @NotNull
@@ -2337,12 +2337,34 @@
  %7D%0A    %7D
+%0A    // %3C/editor-fold%3E
 %0A%0A%7D%0A

add getters