import * as react_jsx_runtime from 'react/jsx-runtime';
import * as _raystack_proton_frontier from '@raystack/proton/frontier';
import { RQLRequest, RQLQueryPaginationResponse, RQLQueryGroupResponse } from '@raystack/proton/frontier';
import React, { ReactNode } from 'react';
import * as _bufbuild_protobuf from '@bufbuild/protobuf';
import { DataTableQuery } from '@raystack/apsara';

type RolesViewProps = {
    /** When set, opens the detail sheet for this role. */
    selectedRoleId?: string;
    /** Called when a user clicks a role row. Use to update the URL or local state. */
    onSelectRole?: (roleId: string) => void;
    /** Called when the detail sheet is closed. Use to clear the selected role from URL/state. */
    onCloseDetail?: () => void;
    /** App name displayed in the page title. */
    appName?: string;
};
declare function RolesView({ selectedRoleId: controlledRoleId, onSelectRole, onCloseDetail, appName, }?: RolesViewProps): react_jsx_runtime.JSX.Element;

type InvoicesViewProps = {
    /** App name displayed in the page title. */
    appName?: string;
};
declare function InvoicesView({ appName }?: InvoicesViewProps): react_jsx_runtime.JSX.Element;

type ProductsViewProps = {
    /** When set, opens the detail sheet for this product. */
    selectedProductId?: string;
    /** Called when a user clicks a product row. Use to update the URL or local state. */
    onSelectProduct?: (productId: string) => void;
    /** Called when the detail sheet is closed. Use to clear the selected product. */
    onCloseDetail?: () => void;
    /** Called when "View Prices" is clicked. Use to navigate to the prices page for this product. */
    onNavigateToPrices?: (productId: string) => void;
    /** App name displayed in the page title. */
    appName?: string;
};
declare function ProductsView({ selectedProductId, onSelectProduct, onCloseDetail, onNavigateToPrices, appName, }?: ProductsViewProps): react_jsx_runtime.JSX.Element;

type ProductPricesViewProps = {
    /** The product ID whose prices are displayed. */
    productId: string;
    /** App name displayed in the page title. */
    appName?: string;
    /** Called when a breadcrumb item is clicked. Use to navigate back (e.g. to products list). */
    onBreadcrumbClick?: (item: {
        name: string;
        href?: string;
    }) => void;
};
declare function ProductPricesView({ productId, appName, onBreadcrumbClick, }: ProductPricesViewProps): react_jsx_runtime.JSX.Element;

type AuditLogsViewProps = {
    /** App name displayed in the page title. */
    appName?: string;
    /** Callback to export audit logs as CSV with the current query filters applied. */
    onExportCsv?: (query: RQLRequest) => Promise<void>;
    /** Navigation callback for links within audit log entries (e.g. to org/user pages). */
    onNavigate?: (path: string) => void;
};
declare function AuditLogsView({ appName, onExportCsv, onNavigate }?: AuditLogsViewProps): react_jsx_runtime.JSX.Element;

type AdminsViewProps = {
    onNavigateToOrg?: (orgId: string) => void;
};
declare function AdminsView({ onNavigateToOrg }?: AdminsViewProps): react_jsx_runtime.JSX.Element;

type PlansViewProps = {
    /** When set, opens the detail sheet for this plan. */
    selectedPlanId?: string;
    /** Called when the detail sheet is closed. Use to clear the selected plan. */
    onCloseDetail?: () => void;
    /** Called when a plan is selected. Use to open the detail sheet. */
    onSelectPlan?: (planId: string) => void;
    /** App name displayed in the page title. */
    appName?: string;
};
declare function PlansView({ selectedPlanId, onCloseDetail, onSelectPlan, appName, }?: PlansViewProps): react_jsx_runtime.JSX.Element;

type WebhooksViewProps = {
    /** When set, opens the update panel for this webhook. */
    selectedWebhookId?: string;
    /** When true, opens the create webhook panel. */
    createOpen?: boolean;
    /** Called when the detail/create panel is closed. */
    onCloseDetail?: () => void;
    /** Called when a user clicks a webhook row. Use to update the URL or local state. */
    onSelectWebhook?: (id: string) => void;
    /** Called when the "Create" button is clicked. Use to update the URL or open the create panel. */
    onOpenCreate?: () => void;
    /** When true, shows the delete option for webhooks. Defaults to `false`. */
    enableDelete?: boolean;
};
declare function WebhooksView({ selectedWebhookId, createOpen, onCloseDetail, onSelectWebhook, onOpenCreate, enableDelete, }?: WebhooksViewProps): react_jsx_runtime.JSX.Element;

type PreferencesViewProps = {
    /** When set, opens the detail panel for this preference (matched by name). */
    selectedPreferenceName?: string;
    /** Called when the detail panel is closed. Use to clear the selected preference. */
    onCloseDetail?: () => void;
    onSelectPreference?: (name: string) => void;
};
declare function PreferencesView({ selectedPreferenceName, onCloseDetail, onSelectPreference, }?: PreferencesViewProps): react_jsx_runtime.JSX.Element;

type UsersViewProps = {
    /** When set, renders the user detail view for this user ID instead of the list. */
    selectedUserId?: string;
    /** Called when the detail view is closed. Use to navigate back to the users list. */
    onCloseDetail?: () => void;
    /** Callback to export users list as CSV. Shown in navbar when provided. */
    onExportUsers?: () => Promise<void>;
    /** Called when a user row is clicked. Use to navigate to the user detail page. */
    onNavigateToUser?: (userId: string) => void;
    currentPath?: string;
    onNavigate?: (path: string) => void;
};
declare function UsersView({ selectedUserId, onCloseDetail, onExportUsers, onNavigateToUser, currentPath, onNavigate, }?: UsersViewProps): react_jsx_runtime.JSX.Element;

type OrganizationListViewProps = {
    /** App name displayed in the page title (e.g. "Frontier Admin"). */
    appName?: string;
    /** Called when a user clicks on an organization row. Use to navigate to the org detail page. */
    onNavigateToOrg?: (id: string) => void;
    /** Callback to export organizations list as CSV. Shown in navbar when provided. */
    onExportCsv?: () => Promise<void>;
    /** List of allowed organization types for filtering / creation. */
    organizationTypes?: string[];
    /** Base URL of the consumer app, used for generating links. */
    appUrl?: string;
    /** List of country names for KYC country selector during org creation. */
    countries?: string[];
};
declare const OrganizationListView: ({ appName, onNavigateToOrg, onExportCsv, organizationTypes, appUrl, countries, }?: OrganizationListViewProps) => react_jsx_runtime.JSX.Element;

type OrganizationDetailsViewProps = {
    /** The organization ID, typically from route params (e.g. `useParams`). */
    organizationId: string | undefined;
    /** Callback to export organization members as CSV. Shown in the action menu when provided. */
    onExportMembers?: () => Promise<void>;
    /** Callback to export organization projects as CSV. Shown in the action menu when provided. */
    onExportProjects?: () => Promise<void>;
    /** Callback to export organization tokens as CSV. Shown in the action menu when provided. */
    onExportTokens?: () => Promise<void>;
    /** Base URL of the consumer app, used for generating links (e.g. invitation emails). */
    appUrl?: string;
    /** Product ID used for token-related billing operations. */
    tokenProductId?: string;
    /** List of country names for KYC country selector. */
    countries?: string[];
    /** List of allowed organization types for the organization type selector. */
    organizationTypes?: string[];
    /** Current browser path (e.g. `location.pathname`) for highlighting active nav tabs. */
    currentPath: string;
    /** Navigation callback for tab switches (e.g. `useNavigate()` from react-router-dom). */
    onNavigate: (path: string) => void;
    children?: React.ReactNode;
};
declare const OrganizationDetailsView: ({ organizationId, onExportMembers, onExportProjects, onExportTokens, appUrl, tokenProductId, countries, organizationTypes, currentPath, onNavigate, children, }: OrganizationDetailsViewProps) => react_jsx_runtime.JSX.Element;

declare const OrganizationSecurity: () => react_jsx_runtime.JSX.Element;

declare function OrganizationMembersView(): react_jsx_runtime.JSX.Element;

declare function OrganizationProjectsView(): react_jsx_runtime.JSX.Element;

declare function OrganizationInvoicesView(): react_jsx_runtime.JSX.Element;

declare function OrganizationTokensView(): react_jsx_runtime.JSX.Element;

declare function OrganizationApisView(): react_jsx_runtime.JSX.Element;

declare function OrganizationPatView(): react_jsx_runtime.JSX.Element;

interface EntityTerminologies {
    singular: string;
    plural: string;
}

interface AdminTerminologyConfig {
    organization?: EntityTerminologies;
    project?: EntityTerminologies;
    team?: EntityTerminologies;
    member?: EntityTerminologies;
    user?: EntityTerminologies;
    appName?: string;
}
interface Config {
    title?: string;
    app_url?: string;
    token_product_id?: string;
    organization_types?: string[];
    terminology?: AdminTerminologyConfig;
}
declare const defaultTerminology: Required<AdminTerminologyConfig>;
declare const defaultConfig: Config;

interface AdminConfigProviderProps {
    children: ReactNode;
    config?: Config;
}
declare const AdminConfigProvider: React.FC<AdminConfigProviderProps>;
declare const useAdminConfig: () => Config;

interface TerminologyOptions {
    plural?: boolean;
    case?: "lower" | "upper" | "capital";
}
interface TerminologyEntity {
    (options?: TerminologyOptions): string;
}
interface TerminologyMap {
    organization: TerminologyEntity;
    project: TerminologyEntity;
    team: TerminologyEntity;
    member: TerminologyEntity;
    user: TerminologyEntity;
    appName: TerminologyEntity;
}
declare const useTerminology: () => TerminologyMap;

interface AdminPaths {
    /** URL slug for the organization entity, e.g. "organizations" or "workspaces" */
    organizations: string;
    /** URL slug for the user entity, e.g. "users" or "people" */
    users: string;
    /** URL slug for the project entity, e.g. "projects" or "repos" */
    projects: string;
    /** URL slug for the member entity, e.g. "members" or "participants" */
    members: string;
    /** URL slug for the team entity, e.g. "teams" or "groups" */
    teams: string;
}
declare const useAdminPaths: () => AdminPaths;

/** Default page size used for paginated RQL queries. */
declare const DEFAULT_PAGE_SIZE = 50;
/** Shape of a Connect RPC response that includes pagination and group metadata. */
type ConnectRPCPaginatedResponse = {
    pagination?: RQLQueryPaginationResponse;
    group?: RQLQueryGroupResponse;
    [key: string]: unknown;
};
/**
 * Returns the next page params for `useInfiniteQuery` based on the last page's pagination metadata.
 * Returns `undefined` when there are no more pages.
 *
 * @param lastPage - The most recent page returned by the query.
 * @param queryParams - The current query params (contains the RQLRequest).
 * @param itemsKey - The key in the response that holds the list of items (defaults to `"organizations"`).
 */
declare function getConnectNextPageParam<T extends ConnectRPCPaginatedResponse>(lastPage: T, queryParams: {
    query: RQLRequest;
}, itemsKey?: string): {
    offset: number;
    $typeName: "raystack.frontier.v1beta1.RQLRequest";
    $unknown?: _bufbuild_protobuf.UnknownField[];
    filters: _raystack_proton_frontier.RQLFilter[];
    groupBy: string[];
    limit: number;
    search: string;
    sort: _raystack_proton_frontier.RQLSort[];
} | undefined;
/**
 * Extracts group-by count map from the first page of an infinite query.
 * Returns a nested map: `{ [groupName]: { [value]: count } }`.
 */
declare function getGroupCountMapFromFirstPage<T extends ConnectRPCPaginatedResponse>(infiniteData?: {
    pages: T[];
}): Record<string, Record<string, number>>;

interface TransformOptions {
    /**
     * Default limit if not specified
     * @default 50
     */
    defaultLimit?: number;
    /**
     * Maps DataTable field names to RQL field names.
     * E.g. `{ createdAt: "created_at" }` transforms the DataTable column name to the backend field.
     */
    fieldNameMapping?: Record<string, string>;
}
/**
 * Converts an Apsara `DataTableQuery` (search, filters, sort, pagination) into
 * a Frontier `RQLRequest` that can be passed to Connect RPC query hooks.
 */
declare function transformDataTableQueryToRQLRequest(query: DataTableQuery, options?: TransformOptions): RQLRequest;

export { AdminConfigProvider, AdminConfigProviderProps, AdminPaths, AdminTerminologyConfig, AdminsView, AuditLogsView, Config, ConnectRPCPaginatedResponse, DEFAULT_PAGE_SIZE, InvoicesView, OrganizationApisView, OrganizationDetailsView, OrganizationDetailsViewProps, OrganizationInvoicesView, OrganizationListView, OrganizationListViewProps, OrganizationMembersView, OrganizationPatView, OrganizationProjectsView, OrganizationSecurity, OrganizationTokensView, PlansView, PreferencesView, ProductPricesView, ProductsView, RolesView, TransformOptions, UsersView, WebhooksView, defaultConfig, defaultTerminology, getConnectNextPageParam, getGroupCountMapFromFirstPage, transformDataTableQueryToRQLRequest, useAdminConfig, useAdminPaths, useTerminology };
