package ai

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 GetAiChatQuotaLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

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

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