import { AppId, ClientId } from './communication.public-types';
/**
 * @category Auth
 */
export type AuthType = 'Bearer' | 'ApiKey';
/**
 * The payload of a JWT token when Bearer authentication is used.
 * @category Auth
 */
export interface AuthWithBearer {
    /** Specifies the Bearer authentication type. */
    type: 'Bearer';
    /** The unique identifier of the authenticated user. */
    userId: string;
    /** The expiration timestamp of the token, in seconds. */
    expiration: number;
    /** Additional attributes associated with the token. */
    attributes: Record<string, any>;
    /** The raw JWT token string, if available. */
    jwt?: string;
}
/**
 * The authentication object for the current request when an API key is used.
 * @category Auth
 */
export interface AuthWithApiKey {
    /** Specifies the API key authentication type. */
    type: 'ApiKey';
    /** The API key string used for authentication. */
    apiKey: string;
}
/**
 * The authentication object for the current request.
 * @category Auth
 */
export type Auth = AuthWithBearer | AuthWithApiKey;
/**
 * Represents an authentication token with its type and associated details.
 * @category Auth
 */
export interface AuthToken {
    /** The type of authentication (e.g., 'Bearer' or 'ApiKey'). */
    type: AuthType;
    /** The token string used for authentication. */
    token: string;
    /** The ID of the integration associated with the token, if applicable. */
    integrationId?: string;
}
/** * The context of a request to a service, providing metadata about the request source. */
export interface RunContext {
    /** Your applicationId. */
    appId: AppId;
    /**
     * The id of the client that initiated this request. This is only relevant in cases that the request was initiated by
     * a client such as when securing an api call or a DB operation. This id will not be available for triggers,
     * schedulers, webhooks and other functions that are not directly initiated by a user action.
     */
    clientId?: ClientId;
    /** The IP address of the client that initiated this request. */
    sourceIp?: string;
    /** The headers of the request. Headers are in lower-case. */
    headers?: Record<string, any>;
    /** Additional context for OpenAPI requests */
    openApiContext?: OpenApiContext;
}
/** In the case of OpenAPI, the context of the request is provided in a separate object. */
export interface OpenApiContext {
    /** The OpenAPI request. */
    request: RawRequest;
}
/** Represents a raw HTTP request, including method, path, query parameters, body, and headers. */
export interface RawRequest {
    /** The HTTP method of the request (e.g., GET, POST, PUT, DELETE). */
    method: string;
    /** The path of the request, excluding the domain and query parameters. */
    path: string;
    /** The query parameters of the request, represented as key-value pairs. */
    queryParams?: Record<string, string>;
    /** The body of the request, if applicable. */
    rawBody?: string;
    /** The headers of the request, represented as key-value pairs. */
    headers?: Record<string, string>;
}
