export interface ChatBrief {
    chatId: string;
    name?: string;
    description?: string;
    chatMode?: string;
    ownerId?: string;
    /** 群头像 URL（/open-apis/im/v1/chats 的 avatar 字段）。 */
    avatar?: string;
}
/**
 * List chats the given bot is a member of, draining pagination internally.
 * Uses /open-apis/im/v1/chats.
 */
export declare function listChats(larkAppId: string): Promise<ChatBrief[]>;
/**
 * Check whether the given bot is a member of the given chat.
 * Uses /open-apis/im/v1/chats/:chat_id/members/is_in_chat — the bot's own
 * access token implicitly identifies the bot being checked.
 *
 * Errors (chat not found, no permission, etc.) are swallowed and treated as
 * "not in chat" so callers can use this as a simple boolean predicate.
 */
export declare function isInChat(larkAppId: string, chatId: string): Promise<boolean>;
/**
 * Create a brand-new chat with `bot_id_list` as initial bot members.  The
 * `creatorLarkAppId` bot becomes the chat's owner and an implicit member; the
 * other bots in `botIds` are added in the same call.  Used by the dashboard's
 * "Create new group" flow.
 *
 * Returns the new chatId on success.  Throws on any non-zero Lark response so
 * the route can surface a real error.  We deliberately don't soften failures
 * here (unlike `isInChat`) because the caller wants to know whether the chat
 * actually got created.
 */
export declare function createChat(creatorLarkAppId: string, opts: {
    name?: string;
    botIds: string[];
    userIds?: string[];
}): Promise<{
    chatId: string;
    invalidBotIds: string[];
    invalidUserIds: string[];
}>;
/**
 * Transfer ownership of a chat from the calling bot to a Feishu user.  Used
 * after `createChat` so the dashboard operator (who's been invited as a
 * member) ends up as the actual owner — otherwise the bot stays group owner
 * and the user can't manage the chat.
 *
 * Calls /open-apis/im/v1/chats/:chat_id with `owner_id` in the body and
 * `user_id_type=open_id`. The caller's bot must currently be the owner; this
 * is the case right after createChat since the creator bot is the implicit
 * owner.
 *
 * `newOwnerOpenId` must be in the calling bot's app scope — Lark open_ids are
 * app-scoped, see operator-selector.ts for why.
 */
export declare function transferChatOwner(ownerLarkAppId: string, chatId: string, newOwnerOpenId: string): Promise<{
    ok: true;
} | {
    ok: false;
    error: string;
}>;
/**
 * Fetch the current owner of a chat (as an open_id). Used by group-creator to
 * verify the post-transfer state when transferChatOwner returns an error —
 * Lark sometimes ACKs a transfer slowly (e.g. 504 Gateway Timeout) even though
 * the server-side write succeeded, so a follow-up read disambiguates "really
 * failed" from "ACK lost".
 *
 * Returns undefined when the API itself errors or doesn't include owner_id;
 * callers treat undefined as "unknown" and keep the original error.
 */
export declare function getChatOwner(larkAppId: string, chatId: string): Promise<string | undefined>;
/**
 * Get a shareable join link for a chat — the link others can click to *join*
 * the group, unlike the applink:// "open chat" URL which only works for members
 * who are already in the chat.
 *
 * Calls POST /open-apis/im/v1/chats/:chat_id/link. Accepted scope is any of
 * im:chat / im:chat:read / im:chat:readonly (the bot already holds im:chat:read,
 * verified at startup). `validity_period` is week | year | permanently.
 *
 * Not supported for p2p / secret / team chats — those return a non-zero code,
 * which we surface as an error so the caller can fall back to the applink.
 */
export declare function getChatShareLink(larkAppId: string, chatId: string, validityPeriod?: 'week' | 'year' | 'permanently'): Promise<{
    ok: true;
    shareLink: string;
} | {
    ok: false;
    error: string;
}>;
/**
 * Disband (delete) a chat. The Lark API only succeeds when the calling bot is
 * the chat's current owner, OR is the creator AND the app holds
 * `im:chat:operate_as_owner`. Routes that fan-out to multiple bots can use
 * this best-effort: try each in-chat bot until one succeeds.
 */
export declare function disbandChat(larkAppId: string, chatId: string): Promise<{
    ok: true;
} | {
    ok: false;
    error: string;
}>;
/**
 * Make the calling bot leave a chat.  Per Lark docs, self-removal succeeds
 * regardless of role (owner/manager/member). Useful when the bot can't disband
 * (not owner, no operate_as_owner scope) but still wants to detach.
 */
export declare function leaveChat(larkAppId: string, chatId: string): Promise<{
    ok: true;
} | {
    ok: false;
    error: string;
}>;
/**
 * Add bot apps to a chat using a "proxy" bot that's already a member.
 * Uses /open-apis/im/v1/chats/:chat_id/members with member_id_type=app_id.
 * Returns per-id result derived from the API's invalid_id_list.
 *
 * On total failure (network error, non-zero code) every id reports the same
 * error so the caller can present a uniform per-id status.
 */
export declare function addBotToChat(proxyLarkAppId: string, chatId: string, targetLarkAppIds: string[]): Promise<{
    id: string;
    ok: boolean;
    error?: string;
}[]>;
/**
 * Add USERS to an existing chat by **union_id** (tenant-stable, NOT app-scoped
 * like open_id). Used to pull bot owners into a federated group regardless of
 * which bot they paired through. Returns the union_ids Lark could not add.
 * Best-effort: total failure reports all ids invalid.
 *
 * Uses /open-apis/im/v1/chats/:chat_id/members with member_id_type=union_id.
 */
export declare function addUsersToChatByUnionId(proxyLarkAppId: string, chatId: string, unionIds: string[]): Promise<{
    invalidUserIds: string[];
}>;
//# sourceMappingURL=groups-store.d.ts.map