#pragma once // DragonX Wallet - HushChat decrypted message model. Held in memory by ChatStore and persisted at // rest (encrypted under a seed-derived key) by ChatDatabase. #include #include namespace dragonx::chat { enum class ChatDirection { Incoming, Outgoing }; enum class ChatMessageKind { Message, ContactRequest }; // Outgoing delivery status. Sending = broadcast in flight (async op not yet resolved); Sent = the // daemon accepted + broadcast the tx; Failed = it didn't (not connected, no funded address, rejected). // Always Sent for incoming. NB: the values are persisted (chat DB serializes the int), so Sent MUST // stay 0 and new states are APPENDED — never reordered. enum class ChatDelivery { Sent, Failed, Sending }; struct ChatMessage { ChatDirection direction = ChatDirection::Incoming; ChatMessageKind kind = ChatMessageKind::Message; std::string txid; std::string conversation_id; // cid — the conversation thread key std::string peer_zaddr; // header "z": peer's reply z-address std::string peer_public_key_hex; // header "p": peer's crypto_kx public key std::string body; // decrypted plaintext (Message) or request text (ContactRequest) std::int64_t timestamp = 0; // tx time in seconds; set by the ingesting caller std::size_t payload_position = 0; // together with txid, the dedup key ChatDelivery delivery = ChatDelivery::Sent; // outgoing only }; } // namespace dragonx::chat