package copy_mission

import (
	"context"

	app "haixun-backend/internal/library/errors"
	"haixun-backend/internal/library/errors/code"
	"haixun-backend/internal/svc"
)

func requireMemberAiReady(ctx context.Context, svcCtx *svc.ServiceContext, tenantID, uid string) error {
	if _, err := svcCtx.ThreadsAccount.ResolveMemberAiCredential(ctx, tenantID, uid); err != nil {
		return app.For(code.ThreadsAccount).InputMissingRequired("請先在設定頁設定 AI API key")
	}
	return nil
}
