package auth

import (
	"time"

	"github.com/golang-jwt/jwt/v5"
)

type TestAuthenticator struct {
}

const testToken = "test-token"

var testClaims = jwt.MapClaims{
	"aud": "test-audience",
	"iss": "test-issuer",
	"sub": 1,
	"exp": time.Now().Add(time.Hour * 24).Unix(),
}

func (a *TestAuthenticator) GenerateToken(claims jwt.Claims) (string, error) {
	token := jwt.NewWithClaims(jwt.SigningMethodHS256, testClaims)

	return token.SignedString([]byte(testToken))
}

func (a *TestAuthenticator) ValidateToken(token string) (*jwt.Token, error) {
	return jwt.Parse(token, func(token *jwt.Token) (any, error) {
		return []byte(testToken), nil
	})
}
