package com.path.android.jobqueue;

/**
 * BaseJob builder object to have a more readable design.
 * Methods can be chained to have more readable code.
 */
public class Params {
    private boolean requiresNetwork = false;
    private String groupId = null;
    private boolean persistent = false;
    private int priority;
    private long delayMs;

    /**
     *
     * @param priority higher = better
     */
    public Params(int priority) {
        this.priority = priority;
    }

    /**
     * Sets the Job as requiring network
     * @return this
     */
    public Params requireNetwork() {
        requiresNetwork = true;
        return this;
    }

    /**
     * Sets the group id. Jobs in the same group are guaranteed to execute sequentially.
     * @param groupId which group this job belongs (can be null of course)
     * @return this
     */
    public Params groupBy(String groupId) {
        this.groupId = groupId;
        return this;
    }

    /**
     * Marks the job as persistent. Make sure your job is serializable.
     * @return this
     */
    public Params persist() {
        this.persistent = true;
        return this;
    }

    /**
     * Delays the job in given ms.
     * @param delayMs .
     * @return this
     */
    public Params delayInMs(long delayMs) {
        this.delayMs = delayMs;
        return this;
    }

    /**
     * convenience method to set network requirement
     * @param requiresNetwork true|false
     * @return this
     */
    public Params setRequiresNetwork(boolean requiresNetwork) {
        this.requiresNetwork = requiresNetwork;
        return this;
    }

    /**
     * convenience method to set group id.
     * @param groupId
     * @return this
     */
    public Params setGroupId(String groupId) {
        this.groupId = groupId;
        return this;
    }

    /**
     * convenience method to set whether {@link JobManager} should persist this job or not.
     * @param persistent true|false
     * @return this
     */
    public Params setPersistent(boolean persistent) {
        this.persistent = persistent;
        return this;
    }

    /**
     * convenience method to set delay
     * @param delayMs in ms
     * @return this
     */
    public Params setDelayMs(long delayMs) {
        this.delayMs = delayMs;
        return this;
    }

    boolean doesRequireNetwork() {
        return requiresNetwork;
    }

    String getGroupId() {
        return groupId;
    }

    boolean isPersistent() {
        return persistent;
    }

    int getPriority() {
        return priority;
    }

    long getDelayMs() {
        return delayMs;
    }
}

@@ -2322,32 +2322,39 @@
 his;%0A    %7D%0A%0A    
+public 
 boolean doesRequ
@@ -2411,16 +2411,23 @@
  %7D%0A%0A    
+public 
 String g
@@ -2475,16 +2475,23 @@
  %7D%0A%0A    
+public 
 boolean 
@@ -2545,16 +2545,23 @@
  %7D%0A%0A    
+public 
 int getP
@@ -2608,16 +2608,23 @@
  %7D%0A%0A    
+public 
 long get

make params getters public. #27