Home /Modules/citizen/FranchiseModel.sleela

FranchiseModel.sleela

lib/citizen/character/FranchiseModel.sleela · 83 line(s) · sleela

<< lib/citizen/character/FranchiseModel.sleela
   SLeeLa Standard Library Definition.
   Definition: FranchiseModel — don't run the shops; rent out the right to BE
     the shop. Revenue is an ongoing royalty on each franchisee's sales plus a
     one-time fee amortized across the month, and the brand does the rest.
   
   A concrete BusinessModel. Family: character. >>
#sleela 2.5
material;
class FranchiseModel extends 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 = 10314;
  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; }

  < franchised locations >
  int outlets;
  < average monthly sales per outlet >
  int avgOutletSalesCents;
  < the franchisor's royalty (0..100) >
  int royaltyPercent;
  < monthly cost to support one outlet >
  int supportCostCents;

  void setUp(int locations, int avgSales, int royalty, int supportCost) {
    load();
    configure("Franchise", KIND_FRANCHISE);
    if (locations < 0) { locations = 0; }
    if (avgSales < 0) { avgSales = 0; }
    if (royalty < 0) { royalty = 0; }
    if (royalty > 100) { royalty = 100; }
    if (supportCost < 0) { supportCost = 0; }
    outlets = locations;
    avgOutletSalesCents = avgSales;
    royaltyPercent = royalty;
    supportCostCents = supportCost;
    setUnits(locations);
  }

  < Total sales across the whole brand this month. >
  int networkSales() { return outlets * avgOutletSalesCents; }

  int monthlyRevenue() { return (networkSales() * royaltyPercent) / 100; }
  int monthlyCost() { return outlets * supportCostCents; }
}