package services

import (
	"nearle/models"
	"nearle/repositories"
)

type UtilsService interface {
	GetApptypes(tag string) ([]models.Apptypes, error)
	SendNotification(token string, notification models.FcmNotification, data map[string]string) error
	GetSubcategories(moduleid int, categoryid int) ([]models.Appsubcategories, error)
	GetApplocations(aid int) ([]models.Applocations, error)
	GetApplocationConfig(aid int) ([]models.Applocations, error)
	GetAppConfig(configID int) (models.Appconfig, error)
	GetAppCategory() ([]models.AppCategory, error)
}

type utilsService struct {
	repo repositories.UtilsRepository
}

func NewUtilsService(repo repositories.UtilsRepository) UtilsService {
	return &utilsService{repo: repo}
}

func (s *utilsService) GetApptypes(tag string) ([]models.Apptypes, error) {
	return s.repo.GetApptypes(tag)
}

func (s *utilsService) SendNotification(token string, notification models.FcmNotification, data map[string]string) error {
	return s.repo.SendNotification(token, notification, data)
}

func (s *utilsService) GetSubcategories(moduleid int, categoryid int) ([]models.Appsubcategories, error) {
	return s.repo.GetSubcategories(moduleid, categoryid)
}

func (s *utilsService) GetApplocations(aid int) ([]models.Applocations, error) {
	return s.repo.GetApplocations(aid)
}

func (s *utilsService) GetApplocationConfig(aid int) ([]models.Applocations, error) {
	return s.repo.GetApplocationConfig(aid)
}

func (s *utilsService) GetAppConfig(configID int) (models.Appconfig, error) {
	return s.repo.GetAppConfig(configID)
}

func (s *utilsService) GetAppCategory() ([]models.AppCategory, error) {
	return s.repo.GetAppCategory()
}
