package userProfile

import (
	"context"
	"fmt"
	"github.com/zeromicro/go-zero/core/logx"
	"sundynix-micro-go/app/plant/api/internal/svc"
	plantPb "sundynix-micro-go/app/plant/rpc/plant"
)

type GetMyBadgesLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetMyBadgesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyBadgesLogic {
	return &GetMyBadgesLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}

func (l *GetMyBadgesLogic) GetMyBadges() (*plantPb.UserBadgeListResp, error) {
	userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
	return l.svcCtx.PlantRpc.GetMyBadges(l.ctx, &plantPb.GetProfileReq{UserId: userId})
}
