/**
 * Copyright (C) 2014-2016 Open Whisper Systems
 *
 * Licensed according to the LICENSE file in this repository.
 */

syntax = "proto3";

package signal;

option java_package = "org.thoughtcrime.securesms.keyvalue.protos";


message LeastActiveLinkedDevice {
    string name = 1;
    uint64 lastActiveTimestamp = 2;
}

message ArchiveUploadProgressState {
    enum State {
        None = 0;
        Export = 1;
        UploadBackupFile = 2;
        UploadMedia = 3;
        UserCanceled = 4;
    }

    /**
     * Describes the current phase the backup is in when we are exporting the database
     * to the temporary file.
     */
    enum BackupPhase {
        BackupPhaseNone = 0;
        Account = 1;
        Recipient = 2;
        Thread = 3;
        Call = 4;
        Sticker = 5;
        Message = 6;
        NotificationProfile = 7;
        ChatFolder = 8;
    }

    State state = 1;
    BackupPhase backupPhase = 2;
    uint64 frameExportCount = 3;
    uint64 frameTotalCount = 4;
    uint64 backupFileUploadedBytes = 5;
    uint64 backupFileTotalBytes = 6;
    uint64 mediaUploadedBytes = 7;
    uint64 mediaTotalBytes = 8;
}

message LocalBackupCreationProgress {
    message Idle {}
    message Canceled {}
    message Succeeded {}
    message Failed {}

    message Exporting {
        ExportPhase phase = 1;
        uint64 frameExportCount = 2;
        uint64 frameTotalCount = 3;
    }

    message Transferring {
        uint64 completed = 1;
        uint64 total = 2;
        bool mediaPhase = 3;
    }

    enum ExportPhase {
        NONE = 0;
        INITIALIZING = 1;
        ACCOUNT = 2;
        RECIPIENT = 3;
        THREAD = 4;
        CALL = 5;
        STICKER = 6;
        NOTIFICATION_PROFILE = 7;
        CHAT_FOLDER = 8;
        MESSAGE = 9;
        FINALIZING = 10;
    }

    oneof state {
        Idle idle = 1;
        Canceled canceled = 2;
        Exporting exporting = 3;
        Transferring transferring = 4;
        Succeeded succeeded = 5;
        Failed failed = 6;
    }
}

message BackupDownloadNotifierState {
    enum Type {
      SHEET = 0;
      DIALOG = 1;
    }

    uint64 entitlementExpirationSeconds = 1;
    uint64 lastSheetDisplaySeconds = 2;
    uint64 intervalSeconds = 3;
    Type type = 4;
}