syntax = "proto3";

package org.xrpl.rpc.v1;
option java_package = "org.xrpl.rpc.v1";
option java_multiple_files = true;

// Next field: 4
message LedgerSpecifier
{
    // Next field: 4
    enum Shortcut
    {
        SHORTCUT_UNSPECIFIED = 0;
        SHORTCUT_VALIDATED   = 1;
        SHORTCUT_CLOSED      = 2;
        SHORTCUT_CURRENT     = 3;
    }

    oneof ledger
    {
        Shortcut shortcut = 1;
        uint32 sequence = 2;
        // 32 bytes
        bytes hash = 3;
    }
}


// Next field: 3
message RawLedgerObject
{
    // Raw data of the ledger object. In GetLedgerResponse and
    // GetLedgerDiffResponse, data will be empty if the object was deleted.
    bytes data = 1;

    // Key of the ledger object
    bytes key = 2;

    enum ModificationType
    {
        UNSPECIFIED = 0;
        CREATED = 1;
        MODIFIED = 2;
        DELETED = 3;
    }

    // Whether the object was created, modified or deleted
    ModificationType mod_type = 3;

    // Key of the object preceding this object in the desired ledger
    bytes predecessor = 4;

    // Key of the object succeeding this object in the desired ledger
    bytes successor = 5;
}

message RawLedgerObjects
{
    repeated RawLedgerObject objects = 1;
}

// Successor information for book directories. The book base is (usually) not
// an actual object, yet we need to be able to ask for the successor to the
// book base.
message BookSuccessor {

    // Base of the book in question
    bytes book_base = 1;

    // First book directory in the book. An empty value here means the entire
    // book is deleted
    bytes first_book = 2;

};

