// Package http defines the public JSON boundary, separate from DTOs. package http import "time" // UsersCreateRequest is the registration payload. type UsersCreateRequest struct { // Password is the unmodified Unicode registration secret. Password string `json:"password"` // Username is the unique lowercase ASCII username. Username string `json:"username"` // DisplayName is the user-visible name, limited to 100 Unicode code points. DisplayName string `json:"display_name"` } // ChatsCreateRequest is the chat payload. type ChatsCreateRequest struct { // Title is the nonblank chat title, limited to 100 Unicode code points. Title string `json:"title"` // MemberIDs contains unique user UUIDs, including the caller when creating a chat. MemberIDs []string `json:"member_ids"` } // MessagesCreateRequest is the message payload. type MessagesCreateRequest struct { // Text contains nonblank text, limited to 4000 Unicode code points. Text string `json:"text"` } // UserResponse is the public user model. type UserResponse struct { // ID is the canonical server-generated UUID. ID string `json:"id"` // Username is the unique lowercase ASCII username. Username string `json:"username"` // DisplayName is the user-visible name, limited to 100 Unicode code points. DisplayName string `json:"display_name"` // CreatedAt is the UTC creation time serialized as RFC 3339. CreatedAt time.Time `json:"created_at"` } // ChatResponse is the public chat model. type ChatResponse struct { // ID is the canonical server-generated UUID. ID string `json:"id"` // Title is the nonblank chat title, limited to 100 Unicode code points. Title string `json:"title"` // MemberIDs contains unique user UUIDs, including the caller when creating a chat. MemberIDs []string `json:"member_ids"` // CreatedAt is the UTC creation time serialized as RFC 3339. CreatedAt time.Time `json:"created_at"` } // MessageResponse is the public message model. type MessageResponse struct { // ID is the canonical server-generated UUID. ID string `json:"id"` // ChatID is the canonical UUID of the chat containing the message. ChatID string `json:"chat_id"` // SenderID is derived from the request identity, never from a client-supplied sender. SenderID string `json:"sender_id"` // Text contains nonblank text, limited to 4000 Unicode code points. Text string `json:"text"` // CreatedAt is the UTC creation time serialized as RFC 3339. CreatedAt time.Time `json:"created_at"` } // ChatPageResponse contains visible chats. type ChatPageResponse struct { // Items contains the ordered page records; an empty page is serialized as an empty array. Items []ChatResponse `json:"items"` // NextCursor is the opaque continuation token or null when the current page is last. NextCursor *string `json:"next_cursor"` } // MessagePageResponse contains the requested history page. type MessagePageResponse struct { // Items contains the ordered page records; an empty page is serialized as an empty array. Items []MessageResponse `json:"items"` // NextCursor is the opaque continuation token or null when the current page is last. NextCursor *string `json:"next_cursor"` } // ErrorResponse is the mandatory error envelope. type ErrorResponse struct { // Error contains the safe public error details. Error ErrorDetail `json:"error"` } // ErrorDetail never exposes internal errors or input contents. type ErrorDetail struct { // Code is one of the machine-readable error codes declared by the API contract. Code string `json:"code"` // Message is a safe public explanation without internal errors or input contents. Message string `json:"message"` // RequestID matches the X-Request-Id response header for log correlation. RequestID string `json:"request_id"` }