package userProfile

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

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

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

func (l *GetMyStarsLogic) GetMyStars(req *types.PageReq) (*plantPb.UserStarListResp, error) {
	userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
	return l.svcCtx.PlantRpc.GetMyStars(l.ctx, &plantPb.GetProfileReq{UserId: userId})
}
