package com.amazon.ads.ema.api.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Options for cache clearing operation
 */
public class CacheClearOptions implements Parcelable {
    public static final Creator<CacheClearOptions> CREATOR = new Creator<>() {
        @Override
        public CacheClearOptions createFromParcel(Parcel in) {
            return new CacheClearOptions(in);
        }

        @Override
        public CacheClearOptions[] newArray(int size) {
            return new CacheClearOptions[size];
        }
    };
    public boolean systemCache;     // Clear system cache
    public boolean appCache;        // Clear all app caches
    public String[] packageNames;   // Specific packages (null for all)

    public CacheClearOptions() {
    }

    protected CacheClearOptions(Parcel in) {
        systemCache = in.readByte() != 0;
        appCache = in.readByte() != 0;
        packageNames = in.createStringArray();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte((byte) (systemCache ? 1 : 0));
        dest.writeByte((byte) (appCache ? 1 : 0));
        dest.writeStringArray(packageNames);
    }

    @Override
    public int describeContents() {
        return 0;
    }
}
