Home /Modules/citizen/Industry.sleela

Industry.sleela

lib/citizen/Industry.sleela · 159 line(s) · sleela

<< lib/citizen/Industry.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines Industry, the civic-sector Master Class — the honest
     living a Citizen claims to make. It models which slice of "the whole
     economy" a person belongs to and what that slice pays per cycle.
   
   Industry is a NATURAL / LOADABLE MODULE sharing the common module contract
   (load / loaded / moduleName / describe). It is a sidecar owned by Citizen:
   Citizen models the person; Industry models their place in the great churning
   machine of commerce — and whether that machine currently remembers their
   name. It covers the whole industry at the sector level, from the people who
   grow the food to the people who grow the spreadsheets.
   
   Family: citizen. Economic data crosses an explicit bridge to the ledger. >>
#sleela 2.5
material;
< Unified SLeeLa SDK front-end object. >
class Industry {
  < ---- 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 = 10322;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | 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 = "Industry";

  < The whole economy, abridged to fit on one business card. >
  < between jobs; "consulting" >
  static final int SECTOR_NONE          = 0;
  < feeds everyone, thanked by few >
  static final int SECTOR_AGRICULTURE   = 1;
  < digs up tomorrow's shortage >
  static final int SECTOR_MINING        = 2;
  < makes the thing in the box >
  static final int SECTOR_MANUFACTURING = 3;
  < keeps the lights, bills on >
  static final int SECTOR_ENERGY        = 4;
  < runs 3 weeks over, always >
  static final int SECTOR_CONSTRUCTION  = 5;
  < "did you find everything okay?" >
  static final int SECTOR_RETAIL        = 6;
  < the box, now moving >
  static final int SECTOR_TRANSPORT     = 7;
  < moves money, keeps a slice >
  static final int SECTOR_FINANCE       = 8;
  < the only sector that bills you >
  static final int SECTOR_HEALTHCARE    = 9;
                                               < for existing near it >
  < underpaid, over-caffeinated >
  static final int SECTOR_EDUCATION     = 10;
  < "we've gone fully remote" >
  static final int SECTOR_TECHNOLOGY    = 11;
  < the sector that counts the rest >
  static final int SECTOR_GOVERNMENT    = 12;
  static final int SECTOR_COUNT         = 13;

  int loadedFlag;
  < one of SECTOR_* >
  int sector;
  < pay per cycle, in cents, so nobody loses a penny >
  int wageCents;
  < whether the machine currently remembers your name >
  boolean onPayroll;

  void load() {
    loadedFlag = 1;
    sector = SECTOR_NONE;
    wageCents = 0;
    onPayroll = false;
  }
  boolean loaded() { return loadedFlag == 1; }
  String moduleName() { return MODULE; }

  < Join the workforce in a given sector at a given wage. Welcome aboard. >
  void employ(int whichSector, int cents) {
    if (whichSector < 0 || whichSector >= SECTOR_COUNT) {
      whichSector = SECTOR_NONE;
    }
    if (cents < 0) { cents = 0; }
    sector = whichSector;
    wageCents = cents;
    onPayroll = whichSector != SECTOR_NONE;
  }

  < "We're going in a different direction." Famous last words of a Friday. >
  void layOff() {
    onPayroll = false;
  }

  < A modest raise. The economy's rare act of kindness. >
  void giveRaise(int cents) {
    if (cents > 0) { wageCents = wageCents + cents; }
  }

  boolean employed() { return onPayroll && sector != SECTOR_NONE; }
  int wage() { if (!employed()) { return 0; } return wageCents; }
  int currentSector() { return sector; }

  < A human-readable job title, because SECTOR_8 impresses no one at dinner. >
  String sectorName() {
    if (sector == SECTOR_AGRICULTURE)   { return "Agriculture"; }
    if (sector == SECTOR_MINING)        { return "Mining"; }
    if (sector == SECTOR_MANUFACTURING) { return "Manufacturing"; }
    if (sector == SECTOR_ENERGY)        { return "Energy"; }
    if (sector == SECTOR_CONSTRUCTION)  { return "Construction"; }
    if (sector == SECTOR_RETAIL)        { return "Retail"; }
    if (sector == SECTOR_TRANSPORT)     { return "Transport"; }
    if (sector == SECTOR_FINANCE)       { return "Finance"; }
    if (sector == SECTOR_HEALTHCARE)    { return "Healthcare"; }
    if (sector == SECTOR_EDUCATION)     { return "Education"; }
    if (sector == SECTOR_TECHNOLOGY)    { return "Technology"; }
    if (sector == SECTOR_GOVERNMENT)    { return "Government"; }
    return "Unemployed (Consulting)";
  }

  String yn(boolean b) { if (b) { return "yes"; } return "no"; }

  String describe() {
    return MODULE + " sector=" + sectorName() + " wage=" + wageCents
         + " employed=" + yn(employed());
  }
}