/** filename: com/{{&sdknameLower}}/CachePolicy.java **/
package com.{{&sdknameLower}};

public class CachePolicy {

    public enum Type {
        NotSet,
        NoCache,
        CacheElseNetwork,
        NetworkElseCache,
        CacheThenNetwork,
        CacheOnly,
        NetworkOnly
    }

    private Type type;
    private long durationMS;

    public CachePolicy(Type type, long durationMS) {
        this.type = type;
        this.durationMS = durationMS;
    }

    public CachePolicy(Type type) {
        this(type, 0);
    }

    public Type getType() {
        return type;
    }

    public long getDurationMS() {
        if (durationMS <= 0) {
            return 60 * 60 * 1000;
        }
        return durationMS;
    }

}