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

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

/**
 * Cache clear operation result data
 */
public class CacheClearData implements Parcelable {
    public static final Creator<CacheClearData> CREATOR = new Creator<>() {
        @Override
        public CacheClearData createFromParcel(Parcel in) {
            return new CacheClearData(in);
        }

        @Override
        public CacheClearData[] newArray(int size) {
            return new CacheClearData[size];
        }
    };
    public long systemCacheFreedMB;     // System cache freed in MB
    public long appCacheFreedMB;        // App cache freed in MB
    public int appsProcessed;           // Number of apps processed
    public long totalFreedMB;           // Total freed space in MB
    public long durationMs;             // Operation duration in milliseconds

    public CacheClearData() {
    }

    protected CacheClearData(Parcel in) {
        systemCacheFreedMB = in.readLong();
        appCacheFreedMB = in.readLong();
        appsProcessed = in.readInt();
        totalFreedMB = in.readLong();
        durationMs = in.readLong();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(systemCacheFreedMB);
        dest.writeLong(appCacheFreedMB);
        dest.writeInt(appsProcessed);
        dest.writeLong(totalFreedMB);
        dest.writeLong(durationMs);
    }

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