package threads_account

import (
	"context"

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

type ActivateThreadsAccountLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewActivateThreadsAccountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ActivateThreadsAccountLogic {
	return &ActivateThreadsAccountLogic{ctx: ctx, svcCtx: svcCtx}
}

func (l *ActivateThreadsAccountLogic) ActivateThreadsAccount(req *types.ThreadsAccountPath) error {
	tenantID, uid, err := actorFrom(l.ctx)
	if err != nil {
		return err
	}
	return l.svcCtx.ThreadsAccount.Activate(l.ctx, tenantID, uid, req.ID)
}
