package logic

import (
	"context"
	"jyBXSubscribe/rpc/type/bxsubscribe"

	"jyBXSubscribe/api/internal/svc"
	"jyBXSubscribe/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

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

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

func (l *GetPushSetLogic) GetPushSet(req *types.GetUserReq) (*types.CommonResp, error) {
	// todo: add your logic here and delete this line
	res, err := l.svcCtx.Suscribe.GetPushSet(l.ctx, &bxsubscribe.GetPushSetReq{
		UserId:       req.UserId,
		EntId:        req.EntId,
		EntUserId:    req.EntUserId,
		PositionType: req.PositionType,
		PositionId:   req.PositionId,
		AccountId:    req.AccountId,
		BaseUserId:   req.BaseUserId,
		MgoUserId:    req.MgoUserId,
	})
	if err != nil {
		return &types.CommonResp{
			Err_code: res.ErrorCode,
			Err_msg:  res.ErrorMsg,
			Data:     nil,
		}, nil
	}
	return &types.CommonResp{
		Err_code: res.ErrorCode,
		Err_msg:  res.ErrorMsg,
		Data:     res.Data,
		TimeData: res.TimeData,
	}, nil
}
