package sql

import (
	"tercul/internal/app/analytics"
	"tercul/internal/domain"
	"tercul/internal/platform/config"

	"gorm.io/gorm"
)

type Repositories struct {
	Work          domain.WorkRepository
	User          domain.UserRepository
	UserProfile   domain.UserProfileRepository
	Author        domain.AuthorRepository
	Translation   domain.TranslationRepository
	Comment       domain.CommentRepository
	Like          domain.LikeRepository
	Bookmark      domain.BookmarkRepository
	Collection    domain.CollectionRepository
	Tag           domain.TagRepository
	Category      domain.CategoryRepository
	Book          domain.BookRepository
	Publisher     domain.PublisherRepository
	Source        domain.SourceRepository
	Copyright     domain.CopyrightRepository
	Monetization  domain.MonetizationRepository
	Contribution  domain.ContributionRepository
	Analytics     analytics.Repository
	Auth          domain.AuthRepository
	Localization  domain.LocalizationRepository
}

// NewRepositories creates a new Repositories container
func NewRepositories(db *gorm.DB, cfg *config.Config) *Repositories {
	return &Repositories{
		Work:         NewWorkRepository(db, cfg),
		User:         NewUserRepository(db, cfg),
		UserProfile:  NewUserProfileRepository(db, cfg),
		Author:       NewAuthorRepository(db, cfg),
		Translation:  NewTranslationRepository(db, cfg),
		Comment:      NewCommentRepository(db, cfg),
		Like:         NewLikeRepository(db, cfg),
		Bookmark:     NewBookmarkRepository(db, cfg),
		Collection:   NewCollectionRepository(db, cfg),
		Tag:          NewTagRepository(db, cfg),
		Category:     NewCategoryRepository(db, cfg),
		Book:         NewBookRepository(db, cfg),
		Publisher:    NewPublisherRepository(db, cfg),
		Source:       NewSourceRepository(db, cfg),
		Copyright:    NewCopyrightRepository(db, cfg),
		Monetization: NewMonetizationRepository(db, cfg),
		Contribution: NewContributionRepository(db, cfg),
		Analytics:    NewAnalyticsRepository(db, cfg),
		Auth:         NewAuthRepository(db, cfg),
		Localization: NewLocalizationRepository(db, cfg),
	}
}
