<< lib/citizen/character/BusinessModel.sleela SLeeLa Standard Library Definition. Definition: Defines BusinessModel, the language-neutral base contract a developer extends to describe how a Character actually makes a living. It is the heart of the character package's business-model family: every concrete model (subscription, freemium, marketplace, advertising, retail, wholesale, franchise, licensing, SaaS, consulting, manufacturing, brokerage) subclasses it and overrides the revenue math. A new model is created exactly like a compiler front end in lib/compiler: subclass BusinessModel, call configure() to declare identity, and override monthlyRevenue()/monthlyCost() with the model's own economics. The base implementations are deliberate no-ops that report "nothing yet", so an un-overridden model is honest rather than magical. BusinessModel is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). It holds model state only; a Character owns one and asks it, each month, "so — did we make money?". Family: character. Settlement crosses an explicit bridge to the ledger. >> #sleela 2.5 material; < Unified SLeeLa SDK front-end object. > class BusinessModel { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 10298; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-07"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } static final String MODULE = "BusinessModel"; < Model archetypes, so a Character can say what it is without a pitch deck. > static final int KIND_NONE = 0; static final int KIND_SUBSCRIPTION = 1; static final int KIND_FREEMIUM = 2; static final int KIND_MARKETPLACE = 3; static final int KIND_ADVERTISING = 4; static final int KIND_RETAIL = 5; static final int KIND_WHOLESALE = 6; static final int KIND_FRANCHISE = 7; static final int KIND_LICENSING = 8; static final int KIND_SAAS = 9; static final int KIND_CONSULTING = 10; static final int KIND_MANUFACTURING = 11; static final int KIND_BROKERAGE = 12; < 1 once the module is loaded > int loadedFlag; < human-readable, e.g. "Subscription" > String modelName; < one of KIND_* > int kind; < the model's primary quantity (seats, items, listings) > int unitsCents; < true once a subclass has declared identity > boolean configured; < --- loadable-module contract ------------------------------------------ > void load() { loadedFlag = 1; modelName = "Unconfigured"; kind = KIND_NONE; unitsCents = 0; configured = false; } boolean loaded() { return loadedFlag == 1; } String moduleName() { return MODULE; } < A subclass calls this from its own setup to declare identity. Mirrors the > < declare()/configure() pattern used by the lib/compiler front ends. > void configure(String name, int modelKind) { modelName = name; kind = modelKind; configured = true; } < The model's primary driver — seats, items sold, listings, billable hours. > < Expressed as a plain count; subclasses decide what it means. > void setUnits(int n) { if (n >= 0) { unitsCents = n; } } < --- revenue hooks. Base implementations report "nothing yet"; a concrete > < model overrides these with its own economics. All amounts are whole cents. > int monthlyRevenue() { return 0; } int monthlyCost() { return 0; } < Profit is the same arithmetic for every model, so the base owns it and no > < subclass has to repeat it. This is the one honest law of business. > int monthlyProfit() { return monthlyRevenue() - monthlyCost(); } boolean profitable() { return monthlyProfit() > 0; } boolean ready() { return configured; } int modelKind() { return kind; } String name() { return modelName; } int units() { return unitsCents; } < Render a boolean as a word so describe() concatenates only Strings/ints, > < matching the proven /lib describe() idiom. > String yn(boolean b) { if (b) { return "yes"; } return "no"; } String describe() { return MODULE + "/" + modelName + " kind=" + kind + " units=" + unitsCents + " revenue=" + monthlyRevenue() + " cost=" + monthlyCost() + " profit=" + monthlyProfit() + " profitable=" + yn(profitable()); } }