package logic

import (
	"context"
	"fmt"

	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/svc"
	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/types"
	. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/service"
	"github.com/zeromicro/go-zero/core/logx"
)

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

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

func (l *EmpowerListLogic) EmpowerList(req *types.Req) (resp *types.Reply, err error) {
	resp = &types.Reply{}
	count, datas, err := EmpowerList(req.AppId, req.Function_code, req.Ent_id, 0, 0)
	if err != nil {
		resp.Error_msg = err.Error()
		l.Error(fmt.Sprintf("%+v", req), err)
	}
	resp.Error_code = 0
	resp.Data = map[string]interface{}{
		"count": count,
		"list":  datas,
	}
	return
}
