import { type AuthenticationClient } from "../Authentication/AuthenticationClient"; type Method = "GET" | "POST" | "PUT" | "DELETE"; /** A recursively serialisable JSON value – prevents passing non-serialisable data in request bodies. */ type JSONValue = string | number | boolean | null | JSONValue[] | { [key: string]: JSONValue; }; type Body = Record; /** * Minimal interface for a pluggable HTTP transport. * Inject a custom adapter via `AuthClientPropType.httpAdapter` (e.g. for testing or edge runtimes). * The adapter must throw `ApiError` for HTTP errors and `NetworkError`/`TimeoutError` for network failures. */ interface HttpAdapterRequest { url: string; method: Method; headers: Record; data: Body; timeout?: number; } interface HttpAdapterResponse { data: T; status: number; } type HttpAdapter = (request: HttpAdapterRequest) => Promise; /** Minimal structured logger compatible with console, pino, winston, etc. */ interface Logger { debug: (msg: string, meta?: unknown) => void; warn: (msg: string, meta?: unknown) => void; error: (msg: string, meta?: unknown) => void; } type AuthClientPropType = { authenticationClient?: AuthenticationClient; autoAuthenticate?: boolean; /** Optional structured logger for request/response diagnostics. */ logger?: Logger; /** Optional HTTP transport override. Defaults to an axios-based adapter. */ httpAdapter?: HttpAdapter; }; type AuthenticateResult = { token: string; status: "success"; }; /** * @deprecated Use concrete response types returned by each client method instead. * Kept for backward compatibility with external consumers. */ type ResponseType = Promise>>; export type { Method, Body, JSONValue, HttpAdapterRequest, HttpAdapterResponse, HttpAdapter, Logger, AuthClientPropType, AuthenticateResult, ResponseType };