// Path: app/src/main/java/eu/codlab/amiiwrite/database/controllers/AmiiboFactory.java
// public class AmiiboFactory {
//     private static AmiiboCache _amiibo_cache = new AmiiboCache();
//     private static AmiiboDescriptorCache _amiibo_descriptor_cache = new AmiiboDescriptorCache();
// 
//     @NonNull
//     public static AmiiboCache getAmiiboCache() {
//         return _amiibo_cache;
//     }
// 
//     @NonNull
//     public static AmiiboDescriptorCache getAmiiboDescriptorCache() {
//         return _amiibo_descriptor_cache;
//     }
// }
// 
// Path: app/src/main/java/eu/codlab/amiiwrite/database/models/Amiibo.java
// @Table(databaseName = Database.NAME)
// public class Amiibo extends BaseModel {
//     @Column
//     @PrimaryKey(autoincrement = true)
//     public long id;
// 
//     @Column
//     public String name;
// 
//     @Column
//     public String uuid;
// 
//     @Column
//     public String game_name;
// 
//     @Column
//     public long created_at;
// 
//     /**
//      * Identifier, it is extracted from the blob but here for clarity issue
//      */
//     @Column
//     public String amiibo_identifier;
// 
//     @Column(defaultValue = "false")
//     public boolean synced;
// 
//     @Column
//     public Blob data;
// 
//     private AmiiboDescriptor descriptor;
// 
// 
//     @Nullable
//     public AmiiboDescriptor getDescriptor() {
//         if (descriptor == null) {
//             descriptor = AmiiboFactory.getAmiiboDescriptorCache()
//                     .getFromKey(amiibo_identifier);
//         }
//         return descriptor;
//     }
// 
//     public byte[] decrypt() {
//         return AmiitoolFactory.getInstance()
//                 .unpack(this);
//     }
// }
// 
// Path: app/src/main/java/eu/codlab/amiiwrite/events/SyncResult.java
// public class SyncResult {
//     public boolean finished;
// 
//     public SyncResult(boolean finished) {
//         this.finished = finished;
//     }
// }


import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.drive.Metadata;
import java.util.List;
import de.greenrobot.event.EventBus;
import eu.codlab.amiiwrite.database.controllers.AmiiboFactory;
import eu.codlab.amiiwrite.database.models.Amiibo;
import eu.codlab.amiiwrite.events.SyncResult;
import hugo.weaving.DebugLog;
    }

    /**
     * Upload the locally unsynced files
     */
    @DebugLog
    public void upload() {
        List<Amiibo> amiibos = AmiiboFactory.getAmiiboCache()
                .getAmiibosUnsynced();

        _file_manager.pushToDrive(amiibos);
    }

    /**
     * When the files are all synced upward
     */
    @DebugLog
    public void onPushFinished() {
        _state = State.FINISHED;
        EventBus.getDefault().postSticky(new SyncResult(true));
    }

    @DebugLog
    public void onFileRead(AmiiboFile result) {
        CustomEvent event = new CustomEvent("Download");
        event.putCustomAttribute("success", result != null ? "true" : "false");
        Answers.getInstance().logCustom(event);

        if (result != null) {
            Amiibo amiibo = AmiiboFactory.getAmiiboCache().getAmiibo(result.uuid);
// Path: app/src/main/java/eu/codlab/amiiwrite/database/controllers/AmiiboFactory.java
// public class AmiiboFactory {
//     private static AmiiboCache _amiibo_cache = new AmiiboCache();
//     private static AmiiboDescriptorCache _amiibo_descriptor_cache = new AmiiboDescriptorCache();
// 
//     @NonNull
//     public static AmiiboCache getAmiiboCache() {
//         return _amiibo_cache;
//     }
// 
//     @NonNull
//     public static AmiiboDescriptorCache getAmiiboDescriptorCache() {
//         return _amiibo_descriptor_cache;
//     }
// }
// 
// Path: app/src/main/java/eu/codlab/amiiwrite/database/models/Amiibo.java
// @Table(databaseName = Database.NAME)
// public class Amiibo extends BaseModel {
//     @Column
//     @PrimaryKey(autoincrement = true)
//     public long id;
// 
//     @Column
//     public String name;
// 
//     @Column
//     public String uuid;
// 
//     @Column
//     public String game_name;
// 
//     @Column
//     public long created_at;
// 
//     /**
//      * Identifier, it is extracted from the blob but here for clarity issue
//      */
//     @Column
//     public String amiibo_identifier;
// 
//     @Column(defaultValue = "false")
//     public boolean synced;
// 
//     @Column
//     public Blob data;
// 
//     private AmiiboDescriptor descriptor;
// 
// 
//     @Nullable
//     public AmiiboDescriptor getDescriptor() {
//         if (descriptor == null) {
//             descriptor = AmiiboFactory.getAmiiboDescriptorCache()
//                     .getFromKey(amiibo_identifier);
//         }
//         return descriptor;
//     }
// 
//     public byte[] decrypt() {
//         return AmiitoolFactory.getInstance()
//                 .unpack(this);
//     }
// }
// 
// Path: app/src/main/java/eu/codlab/amiiwrite/events/SyncResult.java
// public class SyncResult {
//     public boolean finished;
// 
//     public SyncResult(boolean finished) {
//         this.finished = finished;
//     }
// }


// Path: app/src/main/java/eu/codlab/amiiwrite/sync/SyncService.java
import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.drive.Metadata;
import java.util.List;
import de.greenrobot.event.EventBus;
import eu.codlab.amiiwrite.database.controllers.AmiiboFactory;
import eu.codlab.amiiwrite.database.models.Amiibo;
import eu.codlab.amiiwrite.events.SyncResult;
import hugo.weaving.DebugLog;

    }

    /**
     * Upload the locally unsynced files
     */
    @DebugLog
    public void upload() {
        List<Amiibo> amiibos = AmiiboFactory.getAmiiboCache()
                .getAmiibosUnsynced();

        _file_manager.pushToDrive(amiibos);
    }

    /**
     * When the files are all synced upward
     */
    @DebugLog
    public void onPushFinished() {
        _state = State.FINISHED;
        EventBus.getDefault().postSticky(new SyncResult(true));
    }

    @DebugLog
    public void onFileRead(AmiiboFile result) {
        CustomEvent event = new CustomEvent("Download");
        event.putCustomAttribute("success", result != null ? "true" : "false");
        Answers.getInstance().logCustom(event);

        if (result != null) {
            Amiibo amiibo = AmiiboFactory.getAmiiboCache().getAmiibo(result.uuid);
            Amiibo to_write = result.toAmiibo();