package processor_jwt

import (
	"slices"

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

type JWTClaims struct {
	UserID    int      `json:"user_id"`
	UserEmail string   `json:"user_email"`
	Roles     []string `json:"roles"`
	jwt.RegisteredClaims
}

func (c *JWTClaims) HasRole(role string) bool {
	return slices.Contains(c.Roles, role)
}

type IProcessorJWT interface {
	GenerateAccessToken(userId int, userEmail string, userRoles []string) (string, error)
	GenerateRefreshToken(userId int) (string, error)
	GetClaims(token string) (*JWTClaims, error)
}
