syntax = "proto2";

import "playlist4ops.proto";
import "playlist4meta.proto";
import "playlist4content.proto";
import "playlist4issues.proto";

message ChangeInfo {
    optional string user = 0x1;
    optional int32 timestamp = 0x2;
    optional bool admin = 0x3;
    optional bool undo = 0x4;
    optional bool redo = 0x5;
    optional bool merge = 0x6;
    optional bool compressed = 0x7;
    optional bool migration = 0x8;
}

message Delta {
    optional bytes base_version = 0x1;
    repeated Op ops = 0x2;
    optional ChangeInfo info = 0x4;
}

message Merge {
    optional bytes base_version = 0x1;
    optional bytes merge_version = 0x2;
    optional ChangeInfo info = 0x4;
}

message ChangeSet {
    optional Kind kind = 0x1;
    enum Kind {
        KIND_UNKNOWN = 0x0;
        DELTA = 0x2;
        MERGE = 0x3;
    }
    optional Delta delta = 0x2;
    optional Merge merge = 0x3;
}

message RevisionTaggedChangeSet {
    optional bytes revision = 0x1;
    optional ChangeSet change_set = 0x2;
}

message Diff {
    optional bytes from_revision = 0x1;
    repeated Op ops = 0x2;
    optional bytes to_revision = 0x3;
}

message ListDump {
    optional bytes latestRevision = 0x1;
    optional int32 length = 0x2;
    optional ListAttributes attributes = 0x3;
    optional ListChecksum checksum = 0x4;
    optional ListItems contents = 0x5;
    repeated Delta pendingDeltas = 0x7;
}

message ListChanges {
    optional bytes baseRevision = 0x1;
    repeated Delta deltas = 0x2;
    optional bool wantResultingRevisions = 0x3;
    optional bool wantSyncResult = 0x4;
    optional ListDump dump = 0x5;
    repeated int32 nonces = 0x6;
}

message SelectedListContent {
    optional bytes revision = 0x1;
    optional int32 length = 0x2;
    optional ListAttributes attributes = 0x3;
    optional ListChecksum checksum = 0x4;
    optional ListItems contents = 0x5;
    optional Diff diff = 0x6;
    optional Diff syncResult = 0x7;
    repeated bytes resultingRevisions = 0x8;
    optional bool multipleHeads = 0x9;
    optional bool upToDate = 0xa;
    repeated ClientResolveAction resolveAction = 0xc;
    repeated ClientIssue issues = 0xd;
    repeated int32 nonces = 0xe;
    optional string owner_username =0x10;
}

