/** * Shared DTOs for collaborative shopping lists. The API serializes these shapes * and the web app consumes them, so they live here instead of being duplicated. */ export type ListRole = 'owner' | 'collaborator' export type InvitationStatus = 'pending' | 'accepted' | 'revoked' | 'expired' /** A member of a list, as seen in the list detail. */ export type ListMember = { id: string role: ListRole isPrimary: boolean user: { id: string name: string email: string image: string | null } } /** A list as returned by the collection endpoint (`GET /lists`). */ export type ShoppingListSummary = { id: string name: string role: ListRole isPrimary: boolean memberCount: number createdAt: string updatedAt: string } /** A list with its members, as returned by `GET /lists/:listId`. */ export type ShoppingListDetail = { id: string name: string role: ListRole isPrimary: boolean members: ListMember[] invitations: ListInvitation[] createdAt: string updatedAt: string } /** An invitation attached to a list (pending or historical). */ export type ListInvitation = { id: string email: string status: InvitationStatus expiresAt: string createdAt: string } /** A pending invitation from the invited user's point of view. */ export type PendingInvitation = { id: string email: string status: InvitationStatus expiresAt: string createdAt: string list: { id: string name: string } invitedBy: { id: string name: string } } /** * Result of creating an invitation: `added` when the email already had an * account (membership granted immediately) or `invited` when a pending * invitation was emailed. */ export type CreateInvitationResult = { status: 'added' | 'invited' email: string } /** Result of accepting an invitation, used to navigate to the shared list. */ export type AcceptInvitationResult = { listId: string listName: string } /** An item inside a shopping list, as returned by the items endpoints. */ export type ListItem = { id: string listId: string name: string completed: boolean /** When the item was marked as bought; `null` while it is pending. */ boughtAt: string | null quantity: string | null notes: string | null order: number createdAt: string updatedAt: string }