package net.dean.jraw.models;

import com.google.auto.value.AutoValue;
import org.jetbrains.annotations.Nullable;

/**
 * The main function of an AccountQuery is to store the status of an account. If an account exists and is not suspended,
 * then the {@link Account} object can be used normally.
 */
@AutoValue
public abstract class AccountQuery {
    /** The reddit username being queried */
    public abstract String getName();

    public abstract AccountStatus getStatus();

    /** The account data. Only non-null when the status is {@link AccountStatus#EXISTS}. */
    @Nullable public abstract Account getAccount();

    public static AccountQuery create(String name, AccountStatus status) {
        return create(name, status, null);
    }

    public static AccountQuery create(String name, AccountStatus status, @Nullable Account data) {
        return new AutoValue_AccountQuery(name, status, data);
    }
}

@@ -108,16 +108,46 @@
 lable;%0A%0A
+import java.io.Serializable;%0A%0A
 /**%0A * T
@@ -370,16 +370,40 @@
 ntQuery 
+implements Serializable 
 %7B%0A    /*

Make AccountQuery serializable