package wiki

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

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

func (l *UpdateWikiClassLogic) UpdateWikiClass(req *types.UpdateWikiClassReq) error {
	_, err := l.svcCtx.PlantRpc.UpdateWikiClass(l.ctx, &plantPb.UpdateWikiClassReq{
		Id: req.Id, Name: req.Name, Icon: req.Icon,
	})
	return err
}
