package filemetadata

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"
)

// Wire providers for file metadata use cases

func ProvideCreateFileMetadataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) CreateFileMetadataUseCase {
	return NewCreateFileMetadataUseCase(cfg, logger, repo)
}

func ProvideUpdateFileMetadataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) UpdateFileMetadataUseCase {
	return NewUpdateFileMetadataUseCase(cfg, logger, repo)
}

func ProvideGetFileMetadataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) GetFileMetadataUseCase {
	return NewGetFileMetadataUseCase(cfg, logger, repo)
}

func ProvideSoftDeleteFileMetadataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) SoftDeleteFileMetadataUseCase {
	return NewSoftDeleteFileMetadataUseCase(cfg, logger, repo)
}

func ProvideGetFileMetadataByCollectionUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) GetFileMetadataByCollectionUseCase {
	return NewGetFileMetadataByCollectionUseCase(cfg, logger, repo)
}

func ProvideGetFileMetadataByCreatedByUserIDUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) GetFileMetadataByCreatedByUserIDUseCase {
	return NewGetFileMetadataByCreatedByUserIDUseCase(cfg, logger, repo)
}

func ProvideDeleteManyFileMetadataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) DeleteManyFileMetadataUseCase {
	return NewDeleteManyFileMetadataUseCase(cfg, logger, repo)
}

func ProvideCountUserFilesUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	fileRepo dom_file.FileMetadataRepository,
	collectionRepo dom_collection.CollectionRepository,
) CountUserFilesUseCase {
	return NewCountUserFilesUseCase(cfg, logger, fileRepo, collectionRepo)
}

func ProvideCheckFileAccessUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) CheckFileAccessUseCase {
	return NewCheckFileAccessUseCase(cfg, logger, repo)
}

func ProvideGetStorageSizeByCollectionUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) GetStorageSizeByCollectionUseCase {
	return NewGetStorageSizeByCollectionUseCase(cfg, logger, repo)
}

func ProvideGetFileMetadataByOwnerIDUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) GetFileMetadataByOwnerIDUseCase {
	return NewGetFileMetadataByOwnerIDUseCase(cfg, logger, repo)
}

func ProvideCheckFileExistsUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) CheckFileExistsUseCase {
	return NewCheckFileExistsUseCase(cfg, logger, repo)
}

func ProvideGetStorageSizeByUserUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	fileRepo dom_file.FileMetadataRepository,
	collectionRepo dom_collection.CollectionRepository,
) GetStorageSizeByUserUseCase {
	return NewGetStorageSizeByUserUseCase(cfg, logger, fileRepo, collectionRepo)
}

func ProvideListRecentFilesUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	fileRepo dom_file.FileMetadataRepository,
	collectionRepo dom_collection.CollectionRepository,
) ListRecentFilesUseCase {
	return NewListRecentFilesUseCase(cfg, logger, fileRepo, collectionRepo)
}

func ProvideGetFileMetadataByIDsUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) GetFileMetadataByIDsUseCase {
	return NewGetFileMetadataByIDsUseCase(cfg, logger, repo)
}

func ProvideCreateManyFileMetadataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) CreateManyFileMetadataUseCase {
	return NewCreateManyFileMetadataUseCase(cfg, logger, repo)
}

func ProvideListFileMetadataSyncDataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) ListFileMetadataSyncDataUseCase {
	return NewListFileMetadataSyncDataUseCase(cfg, logger, repo)
}

func ProvideGetStorageSizeByOwnerUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) GetStorageSizeByOwnerUseCase {
	return NewGetStorageSizeByOwnerUseCase(cfg, logger, repo)
}

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

func ProvideListFilesByOwnerIDUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) ListFilesByOwnerIDUseCase {
	return NewListFilesByOwnerIDUseCase(cfg, logger, repo)
}

func ProvideRestoreFileMetadataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) RestoreFileMetadataUseCase {
	return NewRestoreFileMetadataUseCase(cfg, logger, repo)
}

func ProvideHardDeleteFileMetadataUseCase(
	cfg *config.Configuration,
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) HardDeleteFileMetadataUseCase {
	return NewHardDeleteFileMetadataUseCase(cfg, logger, repo)
}

func ProvideAnonymizeUserReferencesUseCase(
	logger *zap.Logger,
	repo dom_file.FileMetadataRepository,
) AnonymizeUserReferencesUseCase {
	return NewAnonymizeUserReferencesUseCase(logger, repo)
}
