package com.vimeo.networking.model;

import com.google.gson.annotations.SerializedName;

import org.jetbrains.annotations.NotNull;

import java.io.Serializable;

/**
 * An object that is used to patch video addition updates to an Album.
 */
@SuppressWarnings("unused")
public class AddVideoToAlbum implements Serializable {

    private static final long serialVersionUID = -855083653273120166L;

    @NotNull
    @SerializedName("uri")
    private final String mUri;

    @SerializedName("position")
    private final int mPosition;

    public AddVideoToAlbum(@NotNull String uri, int position) {
        mUri = uri;
        mPosition = position;
    }

    /**
     * @return The uri for the video to be added to the album.
     */
    @NotNull
    public String getUri() {
        return mUri;
    }

    /**
     * @return The position in the album where the video should be added.
     */
    public int getPosition() {
        return mPosition;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) { return true; }
        if (o == null || !getClass().equals(o.getClass())) { return false; }

        final AddVideoToAlbum that = (AddVideoToAlbum) o;

        if (mPosition != that.mPosition) { return false; }
        return mUri.equals(that.mUri);
    }

    @Override
    public int hashCode() {
        int result = mUri.hashCode();
        result = 31 * result + mPosition;
        return result;
    }
}

@@ -123,16 +123,59 @@
 NotNull;
+%0Aimport org.jetbrains.annotations.Nullable;
 %0A%0Aimport
@@ -505,16 +505,30 @@
  mUri;%0A%0A
+    @Nullable%0A
     @Ser
@@ -569,19 +569,23 @@
 e final 
-i
+I
 nt
+eger
  mPositi
@@ -637,19 +637,33 @@
 ng uri, 
-int
+@Nullable Integer
  positio
@@ -959,24 +959,38 @@
 ed.%0A     */%0A
+    @Nullable%0A
     public i
@@ -988,19 +988,23 @@
  public 
-i
+I
 nt
+eger
  getPosi
@@ -1290,35 +1290,31 @@
 if (
-mPosition != that.mPosition
+!mUri.equals(that.mUri)
 ) %7B 
@@ -1345,37 +1345,92 @@
 return m
-Uri.equals(that.mUri)
+Position != null ? mPosition.equals(that.mPosition) : that.mPosition == null
 ;%0A    %7D%0A
@@ -1541,16 +1541,17 @@
 esult + 
+(
 mPositio
@@ -1547,24 +1547,60 @@
 + (mPosition
+ != null ? mPosition.hashCode() : 0)
 ;%0A        re

converting position to Integer