//go:build dev

package mw

import (
	"net/http"
	"time"
)

func NewRateLimiter(limit int, window time.Duration) *RateLimiter {
	rl := &RateLimiter{
		requests: make(map[string][]time.Time),
		limit:    limit,
		window:   window,
	}
	registerLimiter(rl)
	return rl
}

func (rl *RateLimiter) Allow(key string) bool { return true }

func NewProgressiveRateLimiter() *ProgressiveRateLimiter {
	return &ProgressiveRateLimiter{
		requests: make(map[string]*ipProgressiveState),
	}
}

func (prl *ProgressiveRateLimiter) Check(ip string) int { return 0 }

func ProgressiveRateLimit(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		next.ServeHTTP(w, r)
	})
}

func RateLimit(limit int, window time.Duration) func(http.Handler) http.Handler {
	return func(next http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			next.ServeHTTP(w, r)
		})
	}
}
