package tenant

import (
	"context"

	"go.uber.org/zap"

	tenantusecase "codeberg.org/mapleopentech/monorepo/cloud/maplepress-backend/internal/usecase/tenant"
)

// GetTenantService handles getting tenant information
type GetTenantService interface {
	GetTenant(ctx context.Context, input *tenantusecase.GetTenantInput) (*tenantusecase.GetTenantOutput, error)
	GetTenantBySlug(ctx context.Context, input *tenantusecase.GetTenantBySlugInput) (*tenantusecase.GetTenantOutput, error)
}

type getTenantService struct {
	getUC  *tenantusecase.GetTenantUseCase
	logger *zap.Logger
}

// NewGetTenantService creates a new GetTenantService
func NewGetTenantService(
	getUC *tenantusecase.GetTenantUseCase,
	logger *zap.Logger,
) GetTenantService {
	return &getTenantService{
		getUC:  getUC,
		logger: logger.Named("get-tenant-service"),
	}
}

// GetTenant retrieves a tenant by ID
func (s *getTenantService) GetTenant(ctx context.Context, input *tenantusecase.GetTenantInput) (*tenantusecase.GetTenantOutput, error) {
	return s.getUC.Execute(ctx, input)
}

// GetTenantBySlug retrieves a tenant by slug
func (s *getTenantService) GetTenantBySlug(ctx context.Context, input *tenantusecase.GetTenantBySlugInput) (*tenantusecase.GetTenantOutput, error) {
	return s.getUC.ExecuteBySlug(ctx, input)
}
