package site

import (
	"context"

	"go.uber.org/zap"

	siteusecase "codeberg.org/mapleopentech/monorepo/cloud/maplepress-backend/internal/usecase/site"
)

// AuthenticateAPIKeyService handles API key authentication operations
type AuthenticateAPIKeyService interface {
	AuthenticateByAPIKey(ctx context.Context, input *siteusecase.AuthenticateAPIKeyInput) (*siteusecase.AuthenticateAPIKeyOutput, error)
}

type authenticateAPIKeyService struct {
	authenticateUC *siteusecase.AuthenticateAPIKeyUseCase
	logger         *zap.Logger
}

// NewAuthenticateAPIKeyService creates a new AuthenticateAPIKeyService
func NewAuthenticateAPIKeyService(
	authenticateUC *siteusecase.AuthenticateAPIKeyUseCase,
	logger *zap.Logger,
) AuthenticateAPIKeyService {
	return &authenticateAPIKeyService{
		authenticateUC: authenticateUC,
		logger:         logger.Named("authenticate-apikey-service"),
	}
}

// AuthenticateByAPIKey authenticates an API key
func (s *authenticateAPIKeyService) AuthenticateByAPIKey(ctx context.Context, input *siteusecase.AuthenticateAPIKeyInput) (*siteusecase.AuthenticateAPIKeyOutput, error) {
	return s.authenticateUC.Execute(ctx, input)
}
