// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1

package member

import (
	"context"

	"haixun-backend/internal/svc"
	"haixun-backend/internal/types"

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

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

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

func (l *GetMemberPlacementSettingsLogic) GetMemberPlacementSettings() (resp *types.MemberPlacementSettingsData, err error) {
	tenantID, uid, err := actorFrom(l.ctx)
	if err != nil {
		return nil, err
	}
	settings, err := l.svcCtx.Placement.Get(l.ctx, tenantID, uid)
	if err != nil {
		return nil, err
	}
	data := toPlacementSettingsData(settings)
	return &data, nil
}
