package user

import (
	"go.uber.org/zap"

	"codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/config"
	dom_collection "codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/internal/domain/collection"
	dom_file "codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/internal/domain/file"
	dom_storagedailyusage "codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/internal/domain/storagedailyusage"
	dom_user "codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/internal/domain/user"
	"codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/pkg/storage/cache/cassandracache"
)

// Wire providers for user use cases

func ProvideUserCreateUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_user.Repository,
) UserCreateUseCase {
	return NewUserCreateUseCase(cfg, logger, repo)
}

func ProvideUserUpdateUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_user.Repository,
) UserUpdateUseCase {
	return NewUserUpdateUseCase(cfg, logger, repo)
}

func ProvideUserGetByIDUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_user.Repository,
) UserGetByIDUseCase {
	return NewUserGetByIDUseCase(cfg, logger, repo)
}

func ProvideUserGetByEmailUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_user.Repository,
) UserGetByEmailUseCase {
	return NewUserGetByEmailUseCase(cfg, logger, repo)
}

func ProvideUserGetBySessionIDUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	cache cassandracache.CassandraCacher,
) UserGetBySessionIDUseCase {
	return NewUserGetBySessionIDUseCase(cfg, logger, cache)
}

func ProvideUserGetByVerificationCodeUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_user.Repository,
) UserGetByVerificationCodeUseCase {
	return NewUserGetByVerificationCodeUseCase(cfg, logger, repo)
}

func ProvideUserDeleteByIDUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_user.Repository,
) UserDeleteByIDUseCase {
	return NewUserDeleteByIDUseCase(cfg, logger, repo)
}

func ProvideUserDeleteUserByEmailUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_user.Repository,
) UserDeleteUserByEmailUseCase {
	return NewUserDeleteUserByEmailUseCase(cfg, logger, repo)
}

func ProvideUserStorageQuotaHelperUseCase(
	logger *zap.Logger,
	storageDailyUsageRepository dom_storagedailyusage.StorageDailyUsageRepository,
) UserStorageQuotaHelperUseCase {
	return NewUserStorageQuotaHelperUseCase(logger, storageDailyUsageRepository)
}

func ProvideAnonymizeOldIPsUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_user.Repository,
) AnonymizeOldIPsUseCase {
	return NewAnonymizeOldIPsUseCase(cfg, logger, repo)
}

func ProvideAnonymizeUserIPsImmediatelyUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	userRepo dom_user.Repository,
	collectionRepo dom_collection.CollectionRepository,
	fileRepo dom_file.FileMetadataRepository,
) AnonymizeUserIPsImmediatelyUseCase {
	return NewAnonymizeUserIPsImmediatelyUseCase(cfg, logger, userRepo, collectionRepo, fileRepo)
}

func ProvideClearUserCacheUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
) ClearUserCacheUseCase {
	return NewClearUserCacheUseCase(cfg, logger)
}
