using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using GB5Shared.DTO.Framework.Login;
namespace GB5Shared.ExternalAI
{
///
/// Low-level, shared transport for calling the external Enterprise AI engine
/// (AI-Enterprise-v1.0) — mints a short-lived JWT via IJwtAccessTokenIssuer (claims:
/// tenantId = login.ClientId, userId = login.UserId, matching the already-live
/// AIExtractNodeExecutor contract) and sends the request over a named HttpClient.
///
/// This is the one piece two modules (EAIAdmin, KMS) genuinely share — the actual per-entity
/// push/pull methods (PushInitiativeAsync, TriggerExtractionAsync, ...) live in each module's
/// own EAISyncClient/KmsAISyncClient, built on top of this.
///
public interface IAIEngineSyncClient
{
/// Plain JSON REST call (GET/POST/PUT/DELETE) — used for admin CRUD endpoints
/// (e.g. gbEAI's /api/admin/initiative). Never throws on a non-2xx or network failure;
/// check .
Task SendJsonAsync(
AIEngineOptions options,
HttpMethod method,
string relativePath,
object? jsonBody,
LoginDTO login,
CancellationToken ct = default);
/// Multipart form call — used for gbEAI's agent-execution routes (POST /<slug>),
/// which always expect "input"/"session_id"/"capability" form fields and an optional
/// "file" part. Never throws on a non-2xx or network failure.
Task SendMultipartAsync(
AIEngineOptions options,
string relativePath,
IReadOnlyDictionary formFields,
(string FileName, byte[] Bytes)? file,
LoginDTO login,
CancellationToken ct = default);
}
}