package app

import (
	
	
)

type router struct {
	mu               sync.RWMutex
	routes           map[string]func() Composer
	routesWithRegexp []regexpRoute
}

func makeRouter() router {
	return router{
		routes: make(map[string]func() Composer),
	}
}

func ( *router) ( string,  func() Composer) {
	.mu.Lock()
	defer .mu.Unlock()

	.routes[] = 
}

func ( *router) ( string,  func() Composer) {
	.mu.Lock()
	defer .mu.Unlock()

	.routesWithRegexp = append(.routesWithRegexp, regexpRoute{
		regexp:       regexp.MustCompile(),
		newComponent: ,
	})
}

func ( *router) ( string) bool {
	.mu.RLock()
	defer .mu.RUnlock()

	if ,  := .routes[];  {
		return true
	}

	for ,  := range .routesWithRegexp {
		if .regexp.MatchString() {
			return true
		}
	}

	return false
}

func ( *router) ( string) (Composer, bool) {
	.mu.RLock()
	defer .mu.RUnlock()

	if ,  := .routes[];  {
		return (), true
	}

	for ,  := range .routesWithRegexp {
		if .regexp.MatchString() {
			return .newComponent(), true
		}
	}

	return nil, false
}

type regexpRoute struct {
	regexp       *regexp.Regexp
	newComponent func() Composer
}