syntax = "proto2";

import "playlist4meta.proto";
import "playlist4content.proto";

message Add {
    optional int32 fromIndex = 0x1;
    repeated Item items = 0x2;
    optional ListChecksum list_checksum = 0x3;
    optional bool addLast = 0x4;
    optional bool addFirst = 0x5;
}

message Rem {
    optional int32 fromIndex = 0x1;
    optional int32 length = 0x2;
    repeated Item items = 0x3;
    optional ListChecksum list_checksum = 0x4;
    optional ListChecksum items_checksum = 0x5;
    optional ListChecksum uris_checksum = 0x6;
    optional bool itemsAsKey = 0x7;
}

message Mov {
    optional int32 fromIndex = 0x1;
    optional int32 length = 0x2;
    optional int32 toIndex = 0x3;
    optional ListChecksum list_checksum = 0x4;
    optional ListChecksum items_checksum = 0x5;
    optional ListChecksum uris_checksum = 0x6;
}

message ItemAttributesPartialState {
    optional ItemAttributes values = 0x1;
    repeated ItemAttributeKind no_value = 0x2;

    enum ItemAttributeKind {
        ITEM_UNKNOWN = 0x0;
        ITEM_ADDED_BY = 0x1;
        ITEM_TIMESTAMP = 0x2;
        ITEM_MESSAGE = 0x3;
        ITEM_SEEN = 0x4;
        ITEM_DOWNLOAD_COUNT = 0x5;
        ITEM_DOWNLOAD_FORMAT = 0x6;
        ITEM_SEVENDIGITAL_ID = 0x7;
        ITEM_SEVENDIGITAL_LEFT = 0x8;
        ITEM_SEEN_AT = 0x9;
        ITEM_PUBLIC = 0xa;
    }
}

message ListAttributesPartialState {
    optional ListAttributes values = 0x1;
    repeated ListAttributeKind no_value = 0x2;

    enum ListAttributeKind {
        LIST_UNKNOWN = 0x0;
        LIST_NAME = 0x1;
        LIST_DESCRIPTION = 0x2;
        LIST_PICTURE = 0x3;
        LIST_COLLABORATIVE = 0x4;
        LIST_PL3_VERSION = 0x5;
        LIST_DELETED_BY_OWNER = 0x6;
        LIST_RESTRICTED_COLLABORATIVE = 0x7;
    }
}

message UpdateItemAttributes {
    optional int32 index = 0x1;
    optional ItemAttributesPartialState new_attributes = 0x2;
    optional ItemAttributesPartialState old_attributes = 0x3;
    optional ListChecksum list_checksum = 0x4;
    optional ListChecksum old_attributes_checksum = 0x5;
}

message UpdateListAttributes {
    optional ListAttributesPartialState new_attributes = 0x1;
    optional ListAttributesPartialState old_attributes = 0x2;
    optional ListChecksum list_checksum = 0x3;
    optional ListChecksum old_attributes_checksum = 0x4;
}

message Op {
    optional Kind kind = 0x1;
    enum Kind {
        KIND_UNKNOWN = 0x0;
        ADD = 0x2;
        REM = 0x3;
        MOV = 0x4;
        UPDATE_ITEM_ATTRIBUTES = 0x5;
        UPDATE_LIST_ATTRIBUTES = 0x6;
    }
    optional Add add = 0x2;
    optional Rem rem = 0x3;
    optional Mov mov = 0x4;
    optional UpdateItemAttributes update_item_attributes = 0x5;
    optional UpdateListAttributes update_list_attributes = 0x6;
}

message OpList {
    repeated Op ops = 0x1;
}

