package glob

// Pattern is a glob pattern.
type Pattern struct {
	Segments    []Segment
	DirOverride string
}

// Segment is the building block of Pattern.
type Segment interface {
	isSegment()
}

// Slash represents a slash "/".
type Slash struct{}

// Literal is a series of non-slash, non-wildcard characters, that is to be
// matched literally.
type Literal struct {
	Data string
}

// Wild is a wildcard.
type Wild struct {
	Type        WildType
	MatchHidden bool
	Matchers    []func(rune) bool
}

// WildType is the type of a Wild.
type WildType int

// Values for WildType.
const (
	Question = iota
	Star
	StarStar
)

// Match returns whether a rune is within the match set.
func ( Wild) ( rune) bool {
	if len(.Matchers) == 0 {
		return true
	}
	for ,  := range .Matchers {
		if () {
			return true
		}
	}
	return false
}

func (Literal) () {}
func (Slash) ()   {}
func (Wild) ()    {}

// IsSlash returns whether a Segment is a Slash.
func ( Segment) bool {
	,  := .(Slash)
	return 
}

// IsLiteral returns whether a Segment is a Literal.
func ( Segment) bool {
	,  := .(Literal)
	return 
}

// IsWild returns whether a Segment is a Wild.
func ( Segment) bool {
	,  := .(Wild)
	return 
}

// IsWild1 returns whether a Segment is a Wild and has the specified type.
func ( Segment,  WildType) bool {
	return IsWild() && .(Wild).Type == 
}

// IsWild2 returns whether a Segment is a Wild and has one of the two specified
// types.
func ( Segment, ,  WildType) bool {
	return IsWild() && (.(Wild).Type ==  || .(Wild).Type == )
}