package controllers

import (
	"GoMembership/internal/services"
	"GoMembership/internal/utils"
	"GoMembership/pkg/errors"
	"net/http"

	"github.com/gin-gonic/gin"
)

type LicenceController struct {
	Service services.LicenceServiceInterface
}

func (lc *LicenceController) GetAllCategories(c *gin.Context) {

	categories, err := lc.Service.GetAllCategories()

	if err != nil {
		utils.RespondWithError(c, err, "Error retrieving licence categories", http.StatusInternalServerError, errors.Responses.Fields.Licences, errors.Responses.Keys.InternalServerError)
		return
	}
	c.JSON(http.StatusOK, gin.H{
		"licence_categories": categories,
	})
}
