package resourceapi

import (
	"net/http"

	"hyapp/services/gateway-service/internal/appconfig"
	"hyapp/services/gateway-service/internal/client"
)

// Handler owns public resource catalog and current-user resource inventory endpoints.
// Wallet-service remains the owner for entitlement and grant semantics.
type Handler struct {
	walletClient        client.WalletClient
	runtimeCapabilities appconfig.RuntimeCapabilityReader
}

type Config struct {
	WalletClient        client.WalletClient
	RuntimeCapabilities appconfig.RuntimeCapabilityReader
}

func New(config Config) *Handler {
	return &Handler{walletClient: config.WalletClient, runtimeCapabilities: config.RuntimeCapabilities}
}

func (h *Handler) ListResources(writer http.ResponseWriter, request *http.Request) {
	h.listResources(writer, request)
}

func (h *Handler) GetResourceGroup(writer http.ResponseWriter, request *http.Request) {
	h.getResourceGroup(writer, request)
}

func (h *Handler) ListResourceShopItems(writer http.ResponseWriter, request *http.Request) {
	h.listResourceShopItems(writer, request)
}

func (h *Handler) PurchaseResourceShopItem(writer http.ResponseWriter, request *http.Request) {
	h.purchaseResourceShopItem(writer, request)
}

func (h *Handler) ListGifts(writer http.ResponseWriter, request *http.Request) {
	h.listGifts(writer, request)
}

func (h *Handler) ListGiftTabs(writer http.ResponseWriter, request *http.Request) {
	h.listGiftTabs(writer, request)
}

func (h *Handler) ListEmojiPacks(writer http.ResponseWriter, request *http.Request) {
	h.listEmojiPacks(writer, request)
}

func (h *Handler) ListMyResources(writer http.ResponseWriter, request *http.Request) {
	h.listMyResources(writer, request)
}

func (h *Handler) EquipMyResource(writer http.ResponseWriter, request *http.Request) {
	h.equipMyResource(writer, request)
}

func (h *Handler) UnequipMyResource(writer http.ResponseWriter, request *http.Request) {
	h.unequipMyResource(writer, request)
}
