//! The constants the engines reference, ported by name as they are needed.//!//! `packages/core/src/constants.ts` is 1770 lines and most of it belongs to//! parts of the product this crate has not reached yet. Adding an entry here//! before its engine needs it would be inventing a contract; this file grows//! one constant at a time, each beside the module that reads it.use serde::{Deserialize, Serialize};/// Declare one of the TypeScript's `as const` string unions as a Rust enum.////// Every one of them is the same four things — the wire strings, the declared/// ORDER (which several tests and a few renderers depend on), a parse that/// answers `None` rather than guessing, and a `Display` that cannot drift from/// the serde representation. Writing those by hand four times is how the fifth/// one ends up with a typo in exactly one of the four.use cotton_rules::string_enum;pubuse cotton_rules::memory_briefing::{ MEMORY_BRIEFING_BUDGET_TOKENS, MEMORY_BRIEFING_OWNER_TOKENS, MEMORY_BRIEFING_PROCEDURES_TOKENS,};string_enum! {/// `MEMORY_STATUSES` — the two states a memory row can be in.MemoryStatus {Active => "active",Archived => "archived", }}string_enum! {/// `MEMORY_VISIBILITIES` — how far an entry may travel.////// Read here only to VALIDATE: the phone's decision queue parses it for the/// same reason `toIMemory` does — a value this build has no words for means/// the file is ahead of the binary, and such a row is skipped and counted/// rather than briefed under a gating rule nobody can name.MemoryVisibility {Private => "private",Shared => "shared",Public => "public", }}string_enum! {/// `MEMORY_ORIGIN_KINDS` — who wrote the entry.////// Memory holds only the owner's mind: `Agent` means an assistant/// TRANSCRIBED something the owner said, never that it inferred one.MemoryOriginKind {User => "user",Agent => "agent", }}string_enum! {/// `ROUTE_TARGET_KINDS` — the record kinds an inbox capture routes INTO.////// Narrower than `LINK_KINDS`: `journal` is a note with a date-identity,/// and a person capture lands as a `person_note`.RouteTargetKind {Todo => "todo",Event => "event",Note => "note",Journal => "journal",Transaction => "transaction",// gen-kind: route-target-kind }}string_enum! {/// `MONEY_CAPTURE_VERBS` — how a captured money event moved.////// A verb, not a signed amount: "lent Ravi 2000" and "spent 2000" are both/// money leaving the same account, and only the verb says whether what/// remains is an expense or a claim. Each maps to exactly one balanced/// posting helper, which is what lets the SQL writer and this engine be/// checked against each other line for line.MoneyCaptureVerb {/// Money out, gone: expense category ← paying account.Spent => "spent",/// Money in, earned: income category → receiving account.Received => "received",/// Between the user's own accounts — touches no category, so it is/// correctly invisible to money-in/money-out.Transfer => "transfer",/// Money out that is still yours: a claim on the person who has it.Lent => "lent",/// Money in that is not yours: a debt to the person who gave it.Borrowed => "borrowed",/// The user paying down what they borrowed.RepaidByMe => "repaid_by_me",/// Someone paying back what the user lent them.RepaidToMe => "repaid_to_me", }}/// `MONEY_CAPTURE_PERSON_VERBS` — the verbs whose posting needs a person, the/// claim/debt half of the set.pubconst MONEY_CAPTURE_PERSON_VERBS: [MoneyCaptureVerb; 4] = [MoneyCaptureVerb::Lent,MoneyCaptureVerb::Borrowed,MoneyCaptureVerb::RepaidByMe,MoneyCaptureVerb::RepaidToMe,];string_enum! {/// `LINK_KINDS` — what a `cotton_links` edge from a person may point at.////// The list is a DB CHECK constraint: widening it is a migration, which is/// why `capture_links.rs` names the holes rather than assuming one.LinkKind {Todo => "todo",Event => "event",Note => "note",Person => "person",Transaction => "transaction",Document => "document",/// v31: "the photos of Ravi" is a person edge and nothing else — the/// one question anybody asks of a picture that a caption cannot answer.Photo => "photo",Video => "video",/// v6 of the Rust ladder: the portal login is part of the material of a/// piece of work, and an edge from the person whose portal it is/// answers "what do I need to get in".Secret => "secret",/// v19: a todo that says "review this" wants to point at the pull, and/// a note about a decision wants to point at the issue it was argued/// in. The repository is edgeable for the same reason a document is —/// it is material a piece of work is made of.Repository => "repository",Pull => "pull",Issue => "issue",EmailThread => "email_thread",// gen-kind: link-kind }}string_enum! {/// `PROJECT_LINK_KINDS` — what a `cotton_project_links` row may point at.////// Also a DB CHECK constraint. Memory joined it at v34: an entry belongs to/// its projects the way everything else does, and no link left means the/// entry briefs nowhere.ProjectLinkKind {Thread => "thread",EmailThread => "email_thread",Person => "person",Note => "note",Journal => "journal",Todo => "todo",Event => "event",Document => "document",Transaction => "transaction",/// v31: event photos and site screenshots are exactly the material a/// project is looked at through.Photo => "photo",Video => "video",/// v34: a memory entry belongs to its projects; the arrangement/// (pinned, position) is PER PROJECT and rides on the link row.Memory => "memory",/// v36: an explicit link is how an assistant that knows THIS call was/// about THIS project says so, and it is listed first.Call => "call",/// v42: a trip is what a project is made of.Album => "album",/// v6 of the Rust ladder: a client's portal login belongs to the/// client's project, and looking for it anywhere else is how a person/// ends up keeping a second copy somewhere worse.Secret => "secret",/// v19: a project naming a repository IS the membership. The project's/// own `repos` field stays a MIRROR for one release, and this link row/// is what the `repos` worker, the phone and `get_project` all read.Repository => "repository",// gen-kind: project-link-kind }}/// `MIRRORED_PROJECT_COLUMNS` — the kinds whose project membership is ALSO a/// column on their own row, and the column that says it.////// Two statements of one fact is the drift this map exists to bound. The one/// entry is deliberate: a journal page's `project_id` IS its identity for a/// day (journal spec §3.1). The COLUMN is authoritative and the link row is/// the mirror. (A store's was the second, until Stores stopped being a tool on/// 11 Oct 2026.)////// The TypeScript is a `Partial<Record<ProjectLinkKind, string>>`, so a kind/// added there needs no decision at all. Here every kind is written out and the/// `match` is exhaustive, which turns "does this new kind mirror its/// membership onto its own row?" into a question the BUILD asks — and the/// sharing membership function is one of the two readers that would otherwise/// quietly stop finding a kind's rows.////// Callers walk [`ProjectLinkKind::ALL`] and keep the `Some`s, which yields/// `journal` — the order members come back in.pubconstfn mirrored_project_column(kind: ProjectLinkKind) -> Option<&'static str> {useProjectLinkKind::*;match kind {Journal => Some("project_id"),Thread | EmailThread | Person | Note | Todo | Event | Document | Transaction | Photo | Video | Memory | Call | Album | Secret | Repository => None, }}string_enum! {/// `BIN_KINDS` — the record kinds that have a bin.////// One bin, not one per kind: an email bin and, later, a calendar bin and a/// photo bin would be three screens, three verbs and three chances to/// disagree about what Restore means. What makes one bin possible is that/// the mechanism is identical for every kind that has it — a `trashed_at`/// column, readers that hide the row, a restore that clears the column, and/// an empty that is the only thing which erases anything.BinKind {Transaction => "transaction",Email => "email",EmailThread => "email_thread",/// v6 of the Rust ladder: removing a password is ROUTINE — a login for/// a service a person left, a key they rotated — and being wrong about/// one of them must cost a tap rather than a re-derivation of something/// they cannot get back. `empty_bin` is still the only thing that/// erases.Secret => "secret",/// A note a person deletes waits here (5 Oct 2026): one rule for/// everything deleted, and archiving stays its own act beside it.Note => "note",/// A deleted calendar event (5 Oct 2026), local or Google's alike: a/// synced one is cancelled at Google by the push and waits here/// stripped of its Google identity, so a restore makes it anew.Event => "event",/// A deleted photo or video (5 Oct 2026): it waits here with its/// file, and only erasing it from the bin lets the file's bytes go.Photo => "photo",Video => "video",/// A deleted document (6 Oct 2026): it waits here with its file, as a/// photo does, and only erasing it from the bin lets the file go — and/// never one whose statement Cotton has read.Document => "document",/// A WhatsApp text of the owner's that failed to send (7 Oct 2026):/// Delete on its slip puts it here, never sent, and a restore brings/// it back still failed. The disappearing timer bins messages too, but/// those are never this Bin's items: they leave only by his act on the/// chat's line (ABSENCE 7).Message => "message",/// A deleted todo (15 Oct 2026, the owner's todo sweep): it waits/// here like every other record, and dropping it stays its status.Todo => "todo",// gen-kind: bin-kind }}string_enum! {/// `PROJECT_SECTION_KEYS` — how a project's members are GROUPED, and the/// order the groups read in.////// Declared in `packages/core/src/engine/projectSections.ts` rather than in/// `constants.ts`, and it lives here anyway because that is where this/// crate keeps its string unions; `rules::project_sections` is its one/// reader.////// The order is EDITORIAL (spec 2026-08-29 §D2, amended 2026-09-02 §2.4 —/// Journal split out of Notes). It is NOT derived from/// [`ProjectLinkKind`] and must not be: reading it from a declared table is/// what keeps a page, its tests and a second window agreeing about what/// comes first.////// What is NOT here: a label, an icon or an address. Those are each/// surface's own, keyed by this enum so a new key fails their build rather/// than disappearing from their page.ProjectSectionKey {People => "people",Chats => "chats",Email => "email",Documents => "documents",Todos => "todos",/// Memory (v34): the owner's own sentences about this project — what an/// assistant is briefed with. Above notes because it is what the person/// opens the page to CHECK, and the one section in the owner's own/// order rather than in recency order.Memory => "memory",Notes => "notes",Journal => "journal",Events => "events",Money => "money",/// Code (v18), beside the containers a project was created FOR rather/// than the material filed into it: a repository is the work itself,/// and the section reads as "where the code is".Code => "code",/// Photos and Videos (v31), last and in that order: they are the/// project's material of record, and they read as a pair, so nothing/// may come between them.Photos => "photos",Videos => "videos",/// Albums (v42) after the pictures they group.Albums => "albums",/// Calls (v36), after the material: a project's calls answer "when did/// we last actually speak", which is a question you ask after you have/// looked at the work.Calls => "calls",/// Passwords (v6 of the Rust ladder), last: the portal login is what/// you reach for to DO the work, not what you read to understand it.Passwords => "passwords", }}string_enum! {/// `THREAD_KINDS` — mirrors `cotton_msg_threads.kind`.////// From `packages/core/src/models/message/constants.ts`, not/// `constants.ts`: the messaging enums were kept out of the shared file/// while it was byte-mirrored into the edge runtime, and the split stayed.ThreadKind {Dm => "dm",Group => "group", }}string_enum! {/// `MESSAGE_CHANNELS` — mirrors `cotton_msg_messages.channel`, the/// transport a message actually travelled over.////// One per transport, and not one per source label. The exact label a source printed —/// `iMessage`, `SMS`, `RCS`, `WhatsApp iOS backup` — rides `meta.source` as/// provenance: a channel is what the app badges and what a reader groups/// by, and there is no end to the number of labels a carrier can print.////// The DECLARED ORDER is what `channels_present` renders badges in, so it/// is load-bearing rather than incidental.MessageChannel {/// The owned pipe (the app) and the only one that is LIVE; everything/// else arrives through an importer.Cotton => "cotton",Whatsapp => "whatsapp",/// v36, when a Mac started reading the Messages database an iPhone will/// never open to an app.Imessage => "imessage",Sms => "sms",/// Instagram direct messages: rows the browser-session source and its/// export import wrote before Instagram left (owner, 22 Nov 2026). Kept/// as data; nothing reads or sends new ones.Instagram => "instagram", }}string_enum! {/// `SUMMARY_KINDS` — the kinds that carry a SUMMARY: a paragraph about the/// record, with the provenance of whoever wrote it (spec 2026-08-29 §D6).////// Not a DB CHECK: a summary is a COLUMN on each of these tables, not a row/// in a shared one, so there is no enumeration for the file to enforce./// `rules::summaries::summary_source` is what says where each one lives,/// and its exhaustive `match` is what the TypeScript needs a module-load/// loop for.SummaryKind {Person => "person",Thread => "thread",EmailThread => "email_thread",Project => "project",// gen-kind: summary-kind }}string_enum! {/// `EVENT_SYNC_STATES` — mirrors `cotton_events.sync_state`, which is/// NULLABLE: NULL means the row lives only in Cotton and never leaves the/// file. That is why `rules::event_edits` holds the column as an/// `Option<String>` and only ever COMPARES against this enum's strings —/// the absent state is the fourth, unnamed member and it is the common one.EventSyncState {Synced => "synced",/// The one value this crate ever WRITES: the mark that makes the push/// go. Every planner in `rules::event_edits` sets it, and none of them/// re-sets it on a row already carrying it.Pending => "pending",Conflict => "conflict", }}pubuse cotton_rules::name_match::PersonSuggestionReason;string_enum! {/// The kind of a real money account, as the personal kit stores it.MoneyAccountKind {Bank => "bank",CreditCard => "credit_card",Cash => "cash",Wallet => "wallet",Loan => "loan", }}string_enum! {/// `MONEY_ACCOUNT_SUBTYPES` — mirrors `cotton_money_accounts.subtype`.////// `Wallet` (a UPI balance) behaves as `Bank` everywhere the engines look,/// and exists because "my PhonePe balance" is not a bank account to anyone/// who holds one.MoneyAccountSubtype {Bank => "bank",Cash => "cash",CreditCard => "credit_card",Wallet => "wallet",Receivable => "receivable",Payable => "payable",Loan => "loan",LentOut => "lent_out",FixedAsset => "fixed_asset",Suspense => "suspense",Category => "category", }}string_enum! {/// `STATEMENT_KINDS` — mirrors `cotton_money_statements.kind`.////// The two kinds read their printed balances in OPPOSITE directions, and/// `rules::money::statement_check` is the one place that rule is written/// down. Reading a card with the bank's rule does not fail loudly; it/// produces a number wrong by exactly twice the period's turnover and calls/// it ok.StatementKind {Bank => "bank",CreditCard => "credit_card", }}string_enum! {/// `BALANCE_CHECKS` — mirrors `cotton_money_statements.balance_check`.////// `Unknown` is a real answer and not a failure: plenty of paper prints no/// balances at all, and those lines are booked anyway.BalanceCheck {Ok => "ok",Mismatch => "mismatch",Unknown => "unknown", }}/// `LINE_DIRECTIONS`, the money run's (cotton-rules balances).pubuse cotton_rules::balances::LineDirection;string_enum! {/// `MONEY_TRANSACTION_SOURCES` — where a money row came from, kept for/// ever so a row's provenance is never re-derived from its shape.////// `capture` is the composer path; `migration` marks rows carried across/// from the retired Runway tool; `statement` (schema v23) is a row born/// from a line of paper, which is now the ordinary way money arrives;/// `external` is a row matched in from somewhere that is not Cotton at all/// (a Splitwise export, a Khatabook sheet) through `match_external`.////// A row writer stamps its source when it creates the row. Statement/// booking always uses `Statement`, because paper is not manual.MoneyTransactionSource {Capture => "capture",Manual => "manual",Import => "import",System => "system",Schedule => "schedule",Migration => "migration",Statement => "statement",External => "external", }}/// `TRANSFER_MATCH_WINDOW_DAYS` — how far apart two sides of one transfer may/// be dated (spec §4.6).////// Three days, because a card payment cleared on a Friday shows on the bank/// statement that day and on the card statement the following Monday. Wider and/// two unrelated equal amounts in one week start pairing; narrower and a/// weekend defeats it. It is the DEFAULT argument of/// `rules::money::transfer_match::find_transfer_pairs`, which Rust makes the/// caller pass explicitly.pubconst TRANSFER_MATCH_WINDOW_DAYS: i64 = 3;string_enum! {/// `VERSION_RECORD_KINDS` — the record kinds whose edits earn a version/// row, in the order the TypeScript declares them.////// History is written by TRIGGERS, below the op layer, precisely so that no/// code path can skip it; this list is the other half of that promise, and/// a kind missing from it reads on screen as "this record has no history"/// while the trigger has been writing rows for it all along. The order is/// the order kinds joined: the first eight came with the original plpgsql,/// `memory` and `goal` in August 2026, the two screenplay prose kinds with/// schema v10/v11, `transaction` with v23 (a bulk classification pass must/// be undoable). `order` joined with v28 and left on 11 Oct 2026 with the/// Stores tool; the two screenplay prose kinds left on 17 Nov 2026 with/// the old screenplay tables (their rows and version rows stay in storage).VersionRecordKind {Todo => "todo",Event => "event",Note => "note",Journal => "journal",Person => "person",TodoRecurrence => "todo_recurrence",Document => "document",Memory => "memory",Transaction => "transaction",Message => "message",// gen-kind: version-record-kind }}string_enum! {/// `VERSION_OPS` — what a history entry says happened to/// the record. A `Delete` row is the one whose "after" state is nothing.VersionOp {Update => "update",Delete => "delete", }}string_enum! {/// `MEDIA_ALBUM_KINDS` — the two kinds of album the derivation proposes/// (`cotton_media_albums.kind`).////// The DECLARED ORDER is the TypeScript's and is not the order proposals/// come back in: `rules::media::albums` sorts its answer by start day, so/// a trip and an event on the same days interleave by date. What the order/// does fix is the enum's `ALL`, which is the list a CHECK constraint and a/// filter chip read.////// A trip SUBSUMES the events inside it — the derivation drops any event/// whose day falls in a trip's span — so the two are alternatives for one/// stretch of days rather than layers over it.MediaAlbumKind {Trip => "trip",Event => "event", }}string_enum! {/// `PRIMITIVE_KINDS` — every record kind Cotton has, in declaration order.////// Its TypeScript home is `packages/core/src/primitives.ts`/// (`keyof typeof PRIMITIVES`) rather than `constants.ts`, and it is/// declared here for the reason [`ProjectSectionKey`] is: this crate keeps/// its string unions in one file. `RECORD_KINDS` used to be the master/// list; since 2026-08-29 the master is the registry, and/// [`crate::primitives`] is where each kind's facilities are decided.////// The ORDER is the registry's own, and it is observable: the MCP verb grid/// and the generated catalogue both walk it.PrimitiveKind {Todo => "todo",TodoRecurrence => "todo_recurrence",Event => "event",Note => "note",/// The one row-level kind: a journal page is a `cotton_notes` row whose/// identity is its date.Journal => "journal",Person => "person",Transaction => "transaction",Statement => "statement",MoneyAccount => "money_account",StatementLine => "statement_line",Evidence => "evidence",Document => "document",Memory => "memory",EmailThread => "email_thread",Email => "email",Thread => "thread",Message => "message",Session => "session",SessionMessage => "session_message",Project => "project",Prompt => "prompt",Photo => "photo",Video => "video",Album => "album",Call => "call",/// v6 of the Rust ladder. A password stopped being a credential the/// server holds and became a record the person opens: it has a page, a/// search hit, a project and a bin, and the whole of the vault design/// is what made that safe.Secret => "secret",/// v13. A device stopped being infrastructure the owner could only see/// on a screen and became a record kind: a session and a machine's/// telemetry point at one, and an assistant may LIST them. Every write/// stays human — approve, revoke, rename and leave are the owner's own/// acts, on a screen, and the verb grid says so five times.Device => "device",/// v19. Phase 2 of code hosting: the five kinds a repository is made/// of stop being supporting tables and become records. The TABLES keep/// their names — a synced table's name is wire protocol — and what/// changes is that the owner now WRITES them: a pull request opened/// from a branch, an issue filed, a comment, a review, a release cut.Repository => "repository",Pull => "pull",Issue => "issue",/// The timeline of a pull request or an issue — a plain comment, a/// review with the host's own verdict, or a review comment with its/// place in the diff. Deliberately not `comment`: a Cotton comment is a/// thread on the owner's own record, and this is writing on a git host.RepoComment => "repo_comment",Release => "release",/// v20. Phase 3 of code hosting: one workflow run, its jobs beside it/// in a supporting table. Deliberately not `ci_run` and not/// `workflow_run`, which are both jargon — a run is what a person calls/// it when they ask whether the run passed.Run => "run",// gen-kind: primitive-kind }}string_enum! {/// `RECORD_KINDS` — the flattened record surface (the 2026-08-17 flattening/// spec): the kinds `search_records` / `get_record` / comments address as/// plain records.////// This list was once the master registry. Since 2026-08-29 the master is/// [`PrimitiveKind`], and this array is ONE membership among peers — the/// registry's `addressable` facility. The kinds that outgrew it (goal,/// thread, message, session, project, prompt) are first-class/// there and absent here on purpose.RecordKind {Todo => "todo",Event => "event",Note => "note",Journal => "journal",Person => "person",TodoRecurrence => "todo_recurrence",Transaction => "transaction",Document => "document",Memory => "memory",/// v29. In this surface because it is addressable and searchable, never/// because it is a route target: nothing routes into a session (v30).SessionMessage => "session_message",/// v31. A description is how a picture becomes findable. Neither is a/// route target: a capture is words, and a picture enters as bytes.Photo => "photo",Video => "video",/// v36. The handle is what a search box can answer about a call.Call => "call",/// v6 of the Rust ladder. Addressable because a search hit has to open/// somewhere: `secret:<id>` is the Passwords page. Never a route/// target — a capture does not become a password by routing.Secret => "secret",/// v19. A repository, a pull request, an issue and a release each have/// a page a search hit opens: `/repos/[id]`, its pull, its issue, its/// release. `repo_comment` is absent on purpose — a comment is read in/// the timeline of the thing it is on, and there is no page to open it/// by itself.Repository => "repository",Pull => "pull",Issue => "issue",Release => "release",/// v20. A run has a page — `/repos/[id]/runs/[id]`, its jobs, their/// steps and their durations — so it is addressable. It is NOT/// searchable: nothing in a run is a word a person looks for, and the/// log is a file rather than a row.Run => "run",// gen-kind: record-kind }}string_enum! {/// `COMMENT_RECORD_KINDS` — mirrors `cotton_comments.record_kind`.////// `transaction` is deliberately absent: a payment has nothing to discuss./// `news_edition` is the most load-bearing membership on the list — a/// comment on an edition is the steering wheel, since the NEXT run reads/// unresolved owner comments on the last three editions. `memory` is the/// same shape one facility over: a comment on an entry IS the review loop.CommentRecordKind {Todo => "todo",Event => "event",Note => "note",Journal => "journal",Person => "person",Document => "document",Memory => "memory",/// v36: "what we talked about" is the one thing a phone's call log/// cannot record for itself.Call => "call",// gen-kind: comment-record-kind }}string_enum! {/// `SHAREABLE_KINDS` — the kinds a record of which may LEAVE this file into/// a scope (sharing spec S-D5), as the array every caller reads.////// A "yes" is a promise with a COLUMN behind it: the kind's table carries/// `origin_handle` (schema v45), so a row that came from somebody else can/// say so. `primitives_tests.rs` holds this list and the eight tables/// carrying that column to the same set.ShareableKind {Note => "note",Document => "document",Project => "project",Album => "album",Photo => "photo",Video => "video",// gen-kind: shareable-kind }}/// `SHAREABLE_LINK_TABLES` — the three join tables that travel with a scope.////// Not kinds, so they cannot be marked in the registry — a link row carries a/// MEMBERSHIP rather than a record. They travel anyway: without them the far/// side receives a project's records with nothing saying they are that/// project's, an album's pictures with nothing saying they are in it, and (v32/// of the Rust ladder) a note's pictures with nothing saying they are on it.pubconst SHAREABLE_LINK_TABLES: [&str; 3] = ["cotton_project_links","cotton_media_album_items","cotton_note_attachments",];/// `GROUP_MEMBER_CAP` — the most people one group conversation may hold.////// Declared once so the relay's applier, the peer producer and the phone read/// ONE number: a cap enforced at 256 on one side and 512 on the other is a/// group that is full for one member and not for another, and the member who/// cannot see the difference is the one who gets dropped.pubconst GROUP_MEMBER_CAP: usize = 256;string_enum! {/// The account types a person can add. Legacy claim types are carried/// into between-us rows by the shape mover, rather than offered here.RealAccountSubtype {Bank => "bank",CreditCard => "credit_card",Cash => "cash",Wallet => "wallet",Loan => "loan", }}implRealAccountSubtype {/// The wider subtype this narrows, so a caller writing a row names one/// vocabulary. Total by construction: a variant added here without a home/// in [`MoneyAccountSubtype`] fails the build.pubconstfn widen(self) -> MoneyAccountSubtype {matchself {RealAccountSubtype::Bank => MoneyAccountSubtype::Bank,RealAccountSubtype::CreditCard => MoneyAccountSubtype::CreditCard,RealAccountSubtype::Cash => MoneyAccountSubtype::Cash,RealAccountSubtype::Wallet => MoneyAccountSubtype::Wallet,RealAccountSubtype::Loan => MoneyAccountSubtype::Loan, } }}string_enum! {/// `STATEMENT_READ_STATUSES` — mirrors/// `cotton_money_statements.read_status`.////// A pending statement is still waiting to be read. A failed statement/// carries its visible reason in `read_error`.StatementReadStatus {Pending => "pending",Read => "read",Mismatch => "mismatch",Failed => "failed", }}string_enum! {/// `MESSAGE_DIRECTIONS` — mirrors `cotton_msg_messages.direction`.////// From `packages/core/src/models/message/constants.ts`, beside/// [`ThreadKind`] and [`MessageChannel`].////// Read from the OWNER's side, always: `in` is a message that arrived for/// the owner, `out` is one they sent. One direction vocabulary means an/// imported WhatsApp archive and a native thread agree.MessageDirection {In => "in",Out => "out", }}string_enum! {/// `MESSAGE_ORIGINS` — whether this row HAPPENED on Cotton (`live`) or was/// carried in from an export (`imported`).////// The privacy hinge, not a bookkeeping detail: the relay never mirrors an/// imported row (the archive is the owner's copy and contains other/// people's words), and importing five years of history fires no pushes.MessageOrigin {Live => "live",Imported => "imported", }}pubuse cotton_rules::messages::{GroupEventKind, MessageMediaKind};pubuse cotton_rules::ids::REACTION_ACTOR_SELF;/// `MUTE_ALWAYS_UNTIL` — `muted_until` for "always", a frozen literal and never/// a computed far date.////// ONE exported spelling on purpose: a second alias is how two tracks end up/// comparing a thread against two different "forever"s. The store's migrator/// spells the same literal in SQL, because a migration cannot call TypeScript —/// which is why [`crate::messages::unread::is_muted_forever`] compares it as an/// INSTANT rather than as a string.pubconst MUTE_ALWAYS_UNTIL: &str = "9999-12-31T00:00:00Z";#[cfg(test)]#[path = "constants_tests.rs"]mod tests;/// Where the serving Mac stops counting how far behind a device is, on every/// exchange answer and in the catch-up wake's recount: a count below it is/// exact, a count at it means "at least this many". ONE number for both sides/// (`cotton_server::routes::sync::BEHIND_BY_CAP` counts up to it,/// `cotton_client::sync::line::COUNTED_UP_TO` reads a count at it as "at/// least"), so the compiler — not a test reading the other crate's source —/// keeps them equal.pubconst BEHIND_BY_CAP: u64 = 10_000;