syntax = "proto3";
package queue;
option go_package = "blitiri.com.ar/go/chasquid/internal/queue";
message Message {
	// Message ID. Uniquely identifies this message, it is used for
	// auditing and troubleshooting.
	string ID = 1;
	// The envelope for this message.
	string from = 2;
	repeated string To = 3;
	repeated Recipient rcpt = 4;
	bytes data = 5;
	// Creation timestamp.
	Timestamp created_at_ts = 6;
}
message Recipient {
	// Address to send the message to.
	// This is the final one, after expanding aliases.
	string address = 1;
	enum Type {
		EMAIL = 0;
		PIPE = 1;
                FORWARD = 2;
	}
	Type type = 2;
	enum Status {
		PENDING = 0;
		SENT = 1;
		FAILED = 2;
	}
	Status status = 3;
	string last_failure_message = 4;
	// Address that this recipient was originally intended to.
	// This is before expanding aliases and only used in very particular
	// cases.
	string original_address = 5;
        // The list of servers to use, for recipients of type == FORWARD.
        repeated string via = 6;
}
// Timestamp representation, for convenience.
// We used to use the well-known type, but the dependency makes packaging much
// more convoluted and adds very little value, so we now just include it here.
message Timestamp {
	// Represents seconds of UTC time since Unix epoch.
	int64 seconds = 1;
	// Non-negative fractions of a second at nanosecond resolution.
	int32 nanos = 2;
}