package menu

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

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

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

func (l *GetMenuListLogic) GetMenuList() (interface{}, error) {
	resp, err := l.svcCtx.SystemRpc.GetMenuList(l.ctx, &system.IdReq{})
	if err != nil {
		return nil, err
	}
	return resp.Menus, nil
}
