/**
 * 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.database.model.databaseprotos";
option java_multiple_files = true;

// DEPRECATED -- only here for database migrations
message ReactionList {
    option deprecated = true;

    message Reaction {
        string emoji        = 1;
        uint64 author       = 2;
        uint64 sentTime     = 3;
        uint64 receivedTime = 4;
    }

    repeated Reaction reactions = 1;
}

message BadgeList {
    message Badge {
        string   id           = 1;
        string   category     = 2;
        string   name         = 3;
        string   description  = 4;
        string   imageUrl     = 5;
        uint64   expiration   = 6;
        bool     visible      = 7;
        string   imageDensity = 8;
    }

    repeated Badge badges = 1;
}


import "SignalService.proto";
import "DecryptedGroups.proto";

message DecryptedGroupV2Context {
    signalservice.GroupContextV2 context            = 1;
    DecryptedGroupChange         change             = 2;
    DecryptedGroup               groupState         = 3;
    DecryptedGroup               previousGroupState = 4;
}

message TemporalAuthCredentialResponse {
    int32 date                   = 1;
    bytes authCredentialResponse = 2;
}

message TemporalAuthCredentialResponses {
    repeated TemporalAuthCredentialResponse credentialResponse = 1;
}

message AudioWaveFormData {
    int64 durationUs = 1;
    bytes waveForm   = 2;
}

message ProfileChangeDetails {
    message StringChange {
        string previous = 1;
        string new      = 2;
    }

    StringChange profileNameChange = 1;
}

message BodyRangeList {
    message BodyRange {
        enum Style {
            BOLD   = 0;
            ITALIC = 1;
        }

        message Button {
            string label  = 1;
            string action = 2;
        }

        int32 start  = 1;
        int32 length = 2;

        oneof associatedValue {
            string mentionUuid = 3;
            Style  style       = 4;
            string link        = 5;
            Button button      = 6;
        }
    }

    repeated BodyRange ranges = 1;
}

message CryptoValue {
  oneof Value {
    MobileCoinValue mobileCoinValue = 1;
  }

  message MobileCoinValue {
    string picoMobileCoin = 1;
  }
}

message GroupCallUpdateDetails {
             string eraId                = 1;
             string startedCallUuid      = 2;
             int64  startedCallTimestamp = 3;
    repeated string inCallUuids          = 4;
             bool   isCallFull           = 5;
}

message ProfileKeyCredentialColumnData {
    bytes profileKey           = 1;
    bytes profileKeyCredential = 2;
}

message DeviceLastResetTime {
    message Pair {
        int32 deviceId      = 1;
        int64 lastResetTime = 2;
    }

    repeated Pair resetTime = 1;
}

message Wallpaper {
    message SingleColor {
        int32 color = 1;
    }

    message LinearGradient {
                 float rotation  = 1;
        repeated int32 colors    = 2;
        repeated float positions = 3;
    }

    message File {
        string uri = 1;
    }

    oneof wallpaper {
        SingleColor    singleColor    = 1;
        LinearGradient linearGradient = 2;
        File           file           = 3;
    }

    float dimLevelInDarkTheme = 4;
}

message ChatColor {
    message SingleColor {
        int32 color = 1;
    }

    message LinearGradient {
        float rotation  = 1;
        repeated int32 colors    = 2;
        repeated float positions = 3;
    }

    message File {
        string uri = 1;
    }

    oneof chatColor {
        SingleColor    singleColor    = 1;
        LinearGradient linearGradient = 2;
    }
}

message RecipientExtras {
    bool manuallyShownAvatar = 1;
    bool hideStory           = 2;
}

message CustomAvatar {

    message Text {
        string text   = 1;
        string colors = 2;
    }

    message Vector {
        string key    = 1;
        string colors = 2;
    }

    message Photo {
        string uri   = 1;
        int64  size  = 2;
    }

    oneof avatar {
        Text   text   = 1;
        Vector vector = 2;
        Photo  photo  = 3;
    }
}

message StoryTextPost {
    enum Style {
        DEFAULT   = 0;
        REGULAR   = 1;
        BOLD      = 2;
        SERIF     = 3;
        SCRIPT    = 4;
        CONDENSED = 5;
    }

    string    body                = 1;
    Style     style               = 2;
    int32     textForegroundColor = 3;
    int32     textBackgroundColor = 4;
    ChatColor background          = 5;
}