//go:build dev
// +build dev

package mw

import (
	"net/http"
	"sync"
	"time"
)

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)
		})
	}
}

type ProgressiveRateLimiter struct {
	requests map[string]*ipProgressiveState
	mu       sync.RWMutex
}

type ipProgressiveState struct {
	timestamps []time.Time
}

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

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

var globalProgressiveLimiter = NewProgressiveRateLimiter()

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