syntax = "proto3";
package pstore.pb;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.benchgen_all) = true;
option (gogoproto.populate_all) = true;

// AddrBookRecord represents a record for a peer in the address book.
message AddrBookRecord {
	// The peer ID.
	bytes id = 1 [(gogoproto.customtype) = "ProtoPeerID"];

	// The multiaddresses. This is a sorted list where element 0 expires the soonest.
	repeated AddrEntry addrs = 2;

	// The most recently received signed PeerRecord.
	CertifiedRecord certified_record = 3;

	// AddrEntry represents a single multiaddress.
	message AddrEntry {
		bytes addr = 1 [(gogoproto.customtype) = "ProtoAddr"];

		// The point in time when this address expires.
		int64 expiry = 2;

		// The original TTL of this address.
		int64 ttl = 3;
	}

	// CertifiedRecord contains a serialized signed PeerRecord used to
	// populate the signedAddrs list.
	message CertifiedRecord {
		// The Seq counter from the signed PeerRecord envelope
		uint64 seq = 1;

		// The serialized bytes of the SignedEnvelope containing the PeerRecord.
		bytes raw = 2;
	}
}