package tag

import (
	"go.uber.org/zap"

	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_tag "codeberg.org/mapleopentech/monorepo/cloud/maplefile-backend/internal/domain/tag"
)

// Wire providers for tag use cases

func ProvideCreateTagUseCase(
	tagRepo dom_tag.Repository,
) *CreateTagUseCase {
	return NewCreateTagUseCase(tagRepo)
}

func ProvideGetTagByIDUseCase(
	tagRepo dom_tag.Repository,
) *GetTagByIDUseCase {
	return NewGetTagByIDUseCase(tagRepo)
}

func ProvideListTagsByUserUseCase(
	tagRepo dom_tag.Repository,
) *ListTagsByUserUseCase {
	return NewListTagsByUserUseCase(tagRepo)
}

func ProvideUpdateTagUseCase(
	tagRepo dom_tag.Repository,
	collectionRepo dom_collection.CollectionRepository,
	fileRepo dom_file.FileMetadataRepository,
	logger *zap.Logger,
) *UpdateTagUseCase {
	return NewUpdateTagUseCase(tagRepo, collectionRepo, fileRepo, logger)
}

func ProvideDeleteTagUseCase(
	tagRepo dom_tag.Repository,
	collectionRepo dom_collection.CollectionRepository,
	fileRepo dom_file.FileMetadataRepository,
	logger *zap.Logger,
) *DeleteTagUseCase {
	return NewDeleteTagUseCase(tagRepo, collectionRepo, fileRepo, logger)
}

func ProvideAssignTagUseCase(
	tagRepo dom_tag.Repository,
	collectionRepo dom_collection.CollectionRepository,
	fileRepo dom_file.FileMetadataRepository,
) *AssignTagUseCase {
	return NewAssignTagUseCase(tagRepo, collectionRepo, fileRepo)
}

func ProvideUnassignTagUseCase(
	tagRepo dom_tag.Repository,
	collectionRepo dom_collection.CollectionRepository,
	fileRepo dom_file.FileMetadataRepository,
) *UnassignTagUseCase {
	return NewUnassignTagUseCase(tagRepo, collectionRepo, fileRepo)
}

func ProvideGetTagsForEntityUseCase(
	tagRepo dom_tag.Repository,
) *GetTagsForEntityUseCase {
	return NewGetTagsForEntityUseCase(tagRepo)
}

func ProvideListCollectionsByTagUseCase(
	tagRepo dom_tag.Repository,
	collectionRepo dom_collection.CollectionRepository,
) *ListCollectionsByTagUseCase {
	return NewListCollectionsByTagUseCase(tagRepo, collectionRepo)
}

func ProvideListFilesByTagUseCase(
	tagRepo dom_tag.Repository,
	fileRepo dom_file.FileMetadataRepository,
) *ListFilesByTagUseCase {
	return NewListFilesByTagUseCase(tagRepo, fileRepo)
}

// NOTE: CreateDefaultTagsUseCase removed - default tags must be created client-side
// due to E2EE. The client creates default tags after first login using the user's master key.
