package match

import (
	"context"

	"bsm/full/module/social/relation/internal/logic/common"
	pb "bsm/full/module/social/relation/pb"
	"git.apinb.com/bsm-sdk/core/errcode"
	"git.apinb.com/bsm-sdk/core/printer"
	"git.apinb.com/bsm-sdk/core/service"
)

// 获取匹配详情
func Get(ctx context.Context, in *pb.IdentRequest) (reply *pb.RelationItem, err error) {
	// parse authorization meta.
	_, err = service.ParseMetaCtx(ctx, nil)
	if err != nil {
		return nil, err
	}
	if in.Identity == "" {
		return nil, errcode.ErrInvalidArgument
	}

	reply, err = common.GetrelationInfoDetailCard(in.Identity)
	if err != nil {
		printer.Error(err.Error())
		return nil, errcode.ErrDB
	}
	return reply, nil
}
