import { ReactNode } from "react";
import { Principal, Principal as Principal$1, SignInCredentials, SignInCredentials as SignInCredentials$1 } from "@platform-modules/auth";
//#region src/client.d.ts
/** Minimal sign-up payload; host routes may extend with additional fields. */
type SignUpInput = {
  email: string;
  password: string;
};
/**
 * Injected data seam for browser-side auth.
 * The consumer wires each method to its authenticated API route — sessions stay server-managed.
 */
interface AuthClient {
  getCurrentUser(): Promise<Principal$1 | null>;
  signIn(creds: SignInCredentials$1): Promise<Principal$1>;
  signUp(input: SignUpInput): Promise<Principal$1>;
  signOut(): Promise<void>;
  requestPasswordReset(email: string): Promise<void>;
  resetPassword(token: string, newPassword: string): Promise<void>;
}
//#endregion
//#region src/errors.d.ts
/** Typed boundary error when the session is no longer valid. */
declare class AuthSessionExpiredError extends Error {
  readonly name = "AuthSessionExpiredError";
  constructor(message?: string);
}
declare function isAuthSessionExpiredError(e: unknown): e is AuthSessionExpiredError;
declare class AuthProviderError extends Error {
  readonly name = "AuthProviderError";
  constructor(hook: string);
}
declare function isAuthProviderError(e: unknown): e is AuthProviderError;
//#endregion
//#region src/AuthProvider.d.ts
/** Holds the current Principal snapshot and refreshes it on mount. */
declare function AuthProvider({ client, children }: {
  client: AuthClient;
  children: ReactNode;
}): import("react").JSX.Element;
//#endregion
//#region src/useCurrentUser.d.ts
declare function useCurrentUser(): {
  user: import("@platform-modules/auth").Principal | null;
  loading: boolean;
  error: Error | null;
  reload: () => void;
};
//#endregion
//#region src/useSignIn.d.ts
declare function useSignIn(): {
  signIn: (creds: SignInCredentials$1) => Promise<Principal$1>;
  pending: boolean;
  error: Error | null;
};
//#endregion
//#region src/useSignUp.d.ts
declare function useSignUp(): {
  signUp: (input: SignUpInput) => Promise<Principal$1>;
  pending: boolean;
  error: Error | null;
};
//#endregion
//#region src/useSignOut.d.ts
declare function useSignOut(): {
  signOut: () => Promise<void>;
  pending: boolean;
  error: Error | null;
};
//#endregion
//#region src/usePasswordReset.d.ts
declare function usePasswordReset(): {
  request: (email: string) => Promise<void>;
  reset: (token: string, newPassword: string) => Promise<void>;
  pending: boolean;
  error: Error | null;
};
//#endregion
//#region src/RequireRole.d.ts
interface RequireRoleProps {
  role: string;
  hierarchy?: readonly string[];
  fallback?: ReactNode;
  children: ReactNode;
}
/**
 * UX-only role guard — hides children when the current user lacks the required role.
 * Authorization path: `isAtLeastRole` from `@platform-modules/auth` when `hierarchy` is
 * provided; otherwise exact `principal.roles` membership. The server route MUST
 * re-authorize; hiding a button is not access control.
 */
declare function RequireRole({ role, hierarchy, fallback, children }: RequireRoleProps): ReactNode;
//#endregion
//#region src/RequireCapability.d.ts
interface RequireCapabilityProps {
  capability: string;
  fallback?: ReactNode;
  children: ReactNode;
}
/**
 * UX-only capability guard — hides children when the current user lacks the capability.
 * Authorization path: `hasPermission` from `@platform-modules/auth`. The server route
 * MUST re-authorize; hiding a button is not access control.
 */
declare function RequireCapability({ capability, fallback, children }: RequireCapabilityProps): ReactNode;
//#endregion
export { type AuthClient, AuthProvider, AuthProviderError, AuthSessionExpiredError, type Principal, RequireCapability, type RequireCapabilityProps, RequireRole, type RequireRoleProps, type SignInCredentials, type SignUpInput, isAuthProviderError, isAuthSessionExpiredError, useCurrentUser, usePasswordReset, useSignIn, useSignOut, useSignUp };