// Package dto defines the transport-independent data shared by service and store. package dto import ( "time" "github.com/google/uuid" ) // UserDTO is the public account profile without credentials. type UserDTO struct { // ID is the server-generated user identifier. ID uuid.UUID // Username is the unique lowercase ASCII account name. Username string // DisplayName is the display label, limited to 100 Unicode code points. DisplayName string // CreatedAt is the server-assigned UTC creation time. CreatedAt time.Time } // ChatDTO is a chat with immutable membership. type ChatDTO struct { // ID is the server-generated chat identifier. ID uuid.UUID // Title is the nonblank title, limited to 100 Unicode code points. Title string // MemberIDs contains the fixed set of users allowed to read and write the chat. MemberIDs []uuid.UUID // CreatedAt is the server-assigned UTC creation time. CreatedAt time.Time } // MessageDTO is an immutable message stored in a chat. type MessageDTO struct { // IdempotencyKey identifies a validated retry within the sender and chat scope. IdempotencyKey string // ID is the server-generated message identifier. ID uuid.UUID // ChatID identifies the owning chat. ChatID uuid.UUID // SenderID identifies the user resolved from the request identity. SenderID uuid.UUID // Text contains the original text, limited to 4000 Unicode code points. Text string // CreatedAt is the server-assigned UTC ordering timestamp. CreatedAt time.Time } // UsersCreateRequestDTO carries untrusted registration values into the service. type UsersCreateRequestDTO struct { // Username is the raw requested account name. Username string // DisplayName is the raw requested display label. DisplayName string } // ChatsCreateRequestDTO carries untrusted chat creation input. type ChatsCreateRequestDTO struct { // UserID is the caller identifier resolved from a validated session. UserID string // Title is the raw requested chat title. Title string // MemberIDs contains raw user UUIDs; the service checks uniqueness and membership. MemberIDs []string } // MessagesCreateRequestDTO carries untrusted message creation input. type MessagesCreateRequestDTO struct { // IdempotencyKey identifies a validated retry within the sender and chat scope. IdempotencyKey string // UserID is the authenticated caller identifier, never a supplied sender field. UserID string // ChatID is the raw chat UUID from the route. ChatID string // Text is the unmodified message text to validate. Text string } // PageRequestDTO carries raw pagination values for service-level validation. type PageRequestDTO struct { // UserID is the caller identifier resolved from a validated session. UserID string // ChatID is the requested chat UUID; it is unused when listing chats. ChatID string // Limit is the raw page size; empty selects the contract default. Limit string // Cursor is the opaque continuation token; empty starts at the beginning. Cursor string } // PositionDTO is a validated keyset boundary; its zero value starts a history. type PositionDTO struct { // CreatedAt is the timestamp of the last record already returned. CreatedAt time.Time // ID is the tie-breaking identifier of the last record already returned. ID uuid.UUID } // ChatPageDTO contains an ordered page of accessible chats. type ChatPageDTO struct { // Items contains at most the requested number of chats. Items []ChatDTO // NextCursor continues the same user-specific list; nil marks its current end. NextCursor *string } // MessagePageDTO contains an ordered page of chat history. type MessagePageDTO struct { // Items contains at most the requested number of messages. Items []MessageDTO // NextCursor continues the same chat history; nil marks its current end. NextCursor *string }