import type { Invitation } from "../_internal/types.gen";
import type { RequestOptions } from "../base-client";
import { RequestBuilder } from "../request-builder";
/**
 * Attributes accepted by the `:invite` action on Invitation. Mirrors the
 * server-side accept list in `lib/gpt_core/tenancy/resources/invitation.ex`.
 */
export interface InviteAttributes {
    /** Email of the invitee. */
    email: string;
    /** Whether the invitation targets a tenant or workspace. */
    scope_type: "tenant" | "workspace";
    /** UUID of the tenant or workspace the invitee is being added to. */
    scope_id: string;
    /** Role granted once the invitation is accepted. */
    role: "admin" | "member" | "editor" | "viewer";
    /** Override the inviter (defaults to the authenticated actor). */
    inviter_id?: string;
    /** Application the invitation is anchored to (controls branding / email). */
    application_id?: string;
    /** Optional message embedded in the invitation email (<= 500 chars). */
    custom_message?: string;
    /** Extra permission strings applied alongside the base role. */
    permissions?: string[];
    /**
     * Per-call override of the Application's `system_email_method` for this
     * invitation. When omitted, falls back to the Application default.
     */
    email_method?: "link" | "code";
}
export declare function createInvitationsNamespace(rb: RequestBuilder): {
    /**
     * List all invitations visible to the current actor.
     *
     * @param options - Optional request options (pagination, filters, sorting).
     * @returns A list of `Invitation` records.
     *
     * @example
     * ```ts
     * const invitations = await admin.invitations.list();
     * ```
     */
    list: (options?: RequestOptions) => Promise<Invitation[]>;
    /**
     * Create a new invitation.
     *
     * @param attributes - Invitation attributes (email, role, scope, etc.).
     *   Pass `email_method: "code"` to send a 6-character short code instead
     *   of a click-through link — required for non-web ISVs (SF plugin,
     *   future mobile apps) whose Application has no `base_url` to redirect
     *   to.
     * @param options - Optional request options.
     * @returns The created `Invitation`.
     *
     * @example
     * ```ts
     * // Default (link-mode) invitation
     * const invitation = await admin.invitations.create({
     *   email: "user@example.com",
     *   scope_type: "tenant",
     *   scope_id: "tenant-uuid",
     *   role: "member",
     * });
     *
     * // Code-mode invitation (for non-web ISV clients)
     * const invitation = await admin.invitations.create({
     *   email: "sf-user@example.com",
     *   scope_type: "tenant",
     *   scope_id: "tenant-uuid",
     *   role: "member",
     *   email_method: "code",
     * });
     * // The recipient receives a 6-character code; they pass it to
     * // admin.invitations.acceptByToken(code, email).
     * ```
     */
    create: (attributes: InviteAttributes, options?: RequestOptions) => Promise<Invitation>;
    /**
     * List invitations addressed to the current user.
     *
     * @param options - Optional request options.
     * @returns A list of `Invitation` records.
     *
     * @example
     * ```ts
     * const mine = await admin.invitations.mine();
     * ```
     */
    mine: (options?: RequestOptions) => Promise<Invitation[]>;
    /**
     * Look up an invitation by its token.
     *
     * @param token - The invitation token.
     * @param options - Optional request options.
     * @returns The `Invitation` record.
     *
     * @example
     * ```ts
     * const invitation = await admin.invitations.getByToken("abc123");
     * ```
     */
    getByToken: (token: string, options?: RequestOptions) => Promise<Invitation>;
    /**
     * Accept an invitation by its token (unauthenticated flow).
     *
     * Accepts either the long opaque invitation token (link-mode emails) or
     * the 6-character short code (code-mode emails).
     *
     * **`email` is required when `token` is a 6-character short code.** The
     * server scopes the short-code lookup by email; omitting `email` for a
     * short code returns a `code_invalid` 401 even if the code is correct.
     * For long opaque tokens, `email` is optional and ignored.
     *
     * @param token - The invitation token (long opaque token OR 6-char short code).
     * @param email - The invitee's email. Required for short-code mode.
     * @param options - Optional request options.
     * @returns The accepted `Invitation`.
     *
     * @throws ApiError with `code === "code_invalid"` (HTTP 401) — token/code did not match.
     * @throws ApiError with `code === "code_expired"` (HTTP 401) — code or invitation expired.
     * @throws ApiError with `code === "too_many_attempts"` (HTTP 429) — rate-limited; check `meta.locked_until`.
     *
     * @example
     * ```ts
     * // Link-mode: long opaque token from the invitation email
     * const invitation = await admin.invitations.acceptByToken("opaque-base64-token");
     *
     * // Code-mode: 6-character short code (email is required)
     * const invitation = await admin.invitations.acceptByToken("ABC234", "user@example.com");
     * ```
     */
    acceptByToken: (token: string, email?: string, options?: RequestOptions) => Promise<Invitation>;
    /**
     * Accept an invitation by ID (authenticated flow).
     *
     * @param id - The UUID of the invitation.
     * @param options - Optional request options.
     * @returns The accepted `Invitation`.
     *
     * @example
     * ```ts
     * const invitation = await admin.invitations.accept("invitation-uuid");
     * ```
     */
    accept: (id: string, options?: RequestOptions) => Promise<Invitation>;
    /**
     * Accept an invitation by ID (authenticated User flow with no raw token).
     *
     * Use this when a user discovered the invitation via `mine()` /
     * `listAllMe` and has the invitation `id` but no raw URL token. The
     * action validates that `actor.email == invitation.email` and rejects
     * system actors (`sk_srv_` / `sk_sys_`) — server-side flows must use
     * `acceptByUser` with an explicit `user_id`.
     *
     * @param id - The UUID of the invitation.
     * @param options - Optional request options.
     * @returns The accepted `Invitation`.
     *
     * @example
     * ```ts
     * const invitation = await admin.invitations.acceptById("invitation-uuid");
     * ```
     */
    acceptById: (id: string, options?: RequestOptions) => Promise<Invitation>;
    /**
     * Accept an invitation on behalf of a specific user.
     *
     * @param id - The UUID of the invitation.
     * @param userId - The UUID of the user accepting the invitation. Must match
     *   the invitation's target email.
     * @param options - Optional request options.
     * @returns The accepted `Invitation`.
     *
     * @example
     * ```ts
     * const invitation = await admin.invitations.acceptByUser(
     *   "invitation-uuid",
     *   "user-uuid",
     * );
     * ```
     */
    acceptByUser: (id: string, userId: string, options?: RequestOptions) => Promise<Invitation>;
    /**
     * Decline an invitation.
     *
     * @param id - The UUID of the invitation.
     * @param options - Optional request options.
     * @returns The declined `Invitation`.
     *
     * @example
     * ```ts
     * const invitation = await admin.invitations.decline("invitation-uuid");
     * ```
     */
    decline: (id: string, options?: RequestOptions) => Promise<Invitation>;
    /**
     * Revoke a pending invitation.
     *
     * @param id - The UUID of the invitation.
     * @param options - Optional request options.
     * @returns The revoked `Invitation`.
     *
     * @example
     * ```ts
     * const invitation = await admin.invitations.revoke("invitation-uuid");
     * ```
     */
    revoke: (id: string, options?: RequestOptions) => Promise<Invitation>;
    /**
     * Resend an invitation email.
     *
     * @param id - The UUID of the invitation.
     * @param options - Optional request options.
     * @returns The resent `Invitation`.
     *
     * @example
     * ```ts
     * const invitation = await admin.invitations.resend("invitation-uuid");
     * ```
     */
    resend: (id: string, options?: RequestOptions) => Promise<Invitation>;
};
//# sourceMappingURL=invitations.d.ts.map