import { z } from 'zod'; /** * Site-Admin user management (issue #59): the list + actions an instance * operator uses for support, abuse handling, and GDPR groundwork. Deleting a * user pseudonymizes their authorship ("Deleted user") and trashes their * personal pond (security.md §Privacy) rather than hard-deleting rows. */ export type AdminUserStatus = 'PENDING_VERIFICATION' | 'ACTIVE' | 'DISABLED'; export interface AdminUserView { id: string; username: string; email: string; displayName: string; status: AdminUserStatus; isSiteAdmin: boolean; createdAt: string; lastLoginAt: string | null; /** Ponds this user owns (personal + shared). */ pondCount: number; } export interface AdminUserListView { users: AdminUserView[]; total: number; page: number; pageSize: number; } export const adminUserListQuerySchema = z.object({ q: z.string().trim().optional(), page: z.coerce.number().int().min(1).default(1), pageSize: z.coerce.number().int().min(1).max(100).default(20), }); export type AdminUserListQuery = z.infer; export const setUserDisabledSchema = z.object({ disabled: z.boolean() }); export const setSiteAdminSchema = z.object({ isSiteAdmin: z.boolean() }); /** The pseudonym a deleted user's authorship shows as. */ export const DELETED_USER_DISPLAY_NAME = 'Deleted user';