package taghttp

import (
	tagsvc "legalgo-BE-go/internal/services/tag"
	"legalgo-BE-go/internal/utilities/response"
	"net/http"

	"github.com/go-chi/chi/v5"
)

func GetAll(
	router chi.Router,
	tagSvc tagsvc.Tag,
) {
	router.Get("/tag", func(w http.ResponseWriter, r *http.Request) {
		ctx := r.Context()
		tags, err := tagSvc.GetAllModel()
		// tags, err := tagSvc.GetAll()
		if err != nil {
			response.ResponseWithErrorCode(
				ctx,
				w,
				err,
				response.ErrBadRequest.Code,
				response.ErrBadRequest.HttpCode,
				err.Error(),
			)
			return
		}

		response.RespondJsonSuccess(ctx, w, tags)
	})
}
