syntax = "proto3";

import "google/protobuf/timestamp.proto";

option go_package = "github.com/tech/sendico/pkg/generated/gmessaging";

// NotificationEvent identifies the type and action of an event for routing.
message NotificationEvent {
    // type is the notification category (e.g. "payment", "account").
    string type = 1;
    // action is the specific event action (e.g. "created", "settled").
    string action = 2;
}

// EventMetadata carries provenance information for a published event.
message EventMetadata {
    // sender identifies the originating service.
    string sender = 1;
    // message_id is the unique identifier of this event message.
    string message_id = 2;
    // timestamp is the time the event was published.
    google.protobuf.Timestamp timestamp = 3;
}

// Envelope wraps a serialised event payload with routing and metadata.
message Envelope {
    // event describes the notification type and action for routing.
    NotificationEvent event = 2;
    // message_data is the serialised protobuf payload.
    bytes message_data = 3;
    // metadata carries provenance information about the event.
    EventMetadata metadata = 4;
}
