// This file contains messages used internally in the component system.
option cpp_component = framework;

/**
 * Defines the common content of an OpTypedMessage. This is used to send
 * an OpTypedMessage from one process to another.
 *
 * The data of the OpTypedMessage is first serialized to a byte buffer then
 * placed in this structure and serialized again before being sent to the
 * receiving process.
 */
message TypedMessage
{
    /**
     * Message address; identifies the endpoints of an OpTypedMessage.
     */
    message Address
    {
        /**
         * Number identifying the OpComponentManager instance.
         */
        required int32 componentManager = 1;
        /**
         * Number identifying the OpComponent instance within that OpComponentManager instance.
         */
        required int32 component = 2;
        /**
         * Number identifying the OpChannel instance managed by that OpComponent instance.
         */
        required int32 channel = 3;
    }

    /**
     * The source message address.
     */
    required Address source = 1;
    /**
     * The destination message address.
     */
    required Address destination = 2;
    /**
     * Number of milliseconds until this message should be processed.
     */
    required double dueTime = 3;
    /**
     * Identifies the specific OpTypedMessage sub-class. The value corresponds
     * to the enum OpTypedMessage::MessageType.
     */
    required int32 type = 4;
    /**
     * The serialized protobuf data of the message.
     */
    required bytes data = 5 [
        cpp_method = GetRef,
    ];
}
