package newssvc

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

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

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

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