package newssvc

import (
	categoryrepository "legalgo-BE-go/internal/accessor/category"
	newsrepository "legalgo-BE-go/internal/accessor/news"
	tagrepository "legalgo-BE-go/internal/accessor/tag"
	userrepository "legalgo-BE-go/internal/accessor/user_repository"
	newsdomain "legalgo-BE-go/internal/domain/news"
)

type impl struct {
	newsRepo     newsrepository.News
	tagRepo      tagrepository.TagAccessor
	categoryRepo categoryrepository.Category
	userRepo     userrepository.User
}

type News interface {
	GetAll() ([]newsdomain.News, error)
	GetBySlug(string) (*newsdomain.News, error)
	Create(newsdomain.NewsReq, string) error
	Update(string, newsdomain.NewsUpdate) error
	Delete(string) error
}

func New(
	newsRepo newsrepository.News,
	tagRepo tagrepository.TagAccessor,
	categoryRepo categoryrepository.Category,
	userRepo userrepository.User,
) News {
	return &impl{
		newsRepo,
		tagRepo,
		categoryRepo,
		userRepo,
	}
}
