import { User } from "../user.js";
import { AuthError, Result } from "./utils.js";

//#region src/auth/methods/profile.d.ts
type Profile = Pick<User, "id" | "email" | "fullName" | "userGroupIds" | "avatarUrl" | "avatarEditable">;
/**
 * Changes the signed-in visitor's own name, photo, or both. A field left out
 * stays as it is. {@link removeAvatar} removes the photo.
 *
 * The photo can change only where `user.avatarEditable` is true. Elsewhere a
 * photo answers `avatarNotSupported`, so hide the photo controls instead.
 *
 * Answers with the visitor as they are now, without `properties`. The page keeps showing what it
 * loaded until its route context loads again, so call `router.invalidate()`
 * after a success.
 *
 * @example
 * const result = await auth.updateProfile({ fullName: 'Ann Lee' })
 * const result = await auth.updateProfile({ avatar: file })
 */
declare function updateProfile(changes: {
  fullName?: string;
  avatar?: File;
}): Promise<Result<Profile, AuthError>>;
/**
 * Removes the signed-in visitor's own photo. Like {@link updateProfile}, it
 * works only where `user.avatarEditable` is true, and answers with the visitor
 * as they are now, without `properties`.
 *
 * @example
 * const result = await auth.removeAvatar()
 */
declare function removeAvatar(): Promise<Result<Profile, AuthError>>;
//#endregion
export { removeAvatar, updateProfile };