// Path: Backend/internal/http/params/params.go

package params

import (
	"boostai-backend/internal/http/respond"
	"strconv"
	"strings"

	"github.com/gofiber/fiber/v2"
)

func Int64PathParam(c *fiber.Ctx, name string) (int64, error) {
	value := strings.TrimSpace(c.Params(name))
	parsed, err := strconv.ParseInt(value, 10, 64)
	if err != nil || parsed <= 0 {
		return 0, respond.Error(c, fiber.StatusBadRequest, "invalid_request", "Invalid path parameter: "+name)
	}

	return parsed, nil
}
