package pubsub

import (
	

	
)

// GossipSubFeatureTest is a feature test function; it takes a feature and a protocol ID and
// should return true if the feature is supported by the protocol
type GossipSubFeatureTest = func(GossipSubFeature, protocol.ID) bool

// GossipSubFeature is a feature discriminant enum
type GossipSubFeature int

const (
	// Protocol supports basic GossipSub Mesh -- gossipsub-v1.0 compatible
	GossipSubFeatureMesh = iota
	// Protocol supports Peer eXchange on prune -- gossipsub-v1.1 compatible
	GossipSubFeaturePX
	// Protocol supports IDONTWANT -- gossipsub-v1.2 compatible
	GossipSubFeatureIdontwant
)

// GossipSubDefaultProtocols is the default gossipsub router protocol list
var GossipSubDefaultProtocols = []protocol.ID{GossipSubID_v12, GossipSubID_v11, GossipSubID_v10, FloodSubID}

// GossipSubDefaultFeatures is the feature test function for the default gossipsub protocols
func ( GossipSubFeature,  protocol.ID) bool {
	switch  {
	case GossipSubFeatureMesh:
		return  == GossipSubID_v12 ||  == GossipSubID_v11 ||  == GossipSubID_v10
	case GossipSubFeaturePX:
		return  == GossipSubID_v12 ||  == GossipSubID_v11
	case GossipSubFeatureIdontwant:
		return  == GossipSubID_v12
	default:
		return false
	}
}

// WithGossipSubProtocols is a gossipsub router option that configures a custom protocol list
// and feature test function
func ( []protocol.ID,  GossipSubFeatureTest) Option {
	return func( *PubSub) error {
		,  := .rt.(*GossipSubRouter)
		if ! {
			return fmt.Errorf("pubsub router is not gossipsub")
		}

		.protos = 
		.feature = 

		return nil
	}
}