Home /Modules/character/ConsultingModel.sleela

ConsultingModel.sleela

lib/character/ConsultingModel.sleela · 88 line(s) · sleela

<< lib/character/ConsultingModel.sleela
   SLeeLa Standard Library Definition.
   Definition: ConsultingModel — sell time, dressed up as insight. Revenue is
     billable hours x rate, bounded by the brutal truth that there are only so
     many hours and consultants insist on sleeping some of them.
   
   A concrete BusinessModel: revenue scales with utilization, not headcount
   alone; cost is the consultants' salaries whether or not they billed. Family:
   character. >>
#sleela 2.5
material;
class ConsultingModel 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 = 10304;
  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; }

  < people who can bill >
  int consultants;
  < total hours actually billed this month >
  int billableHours;
  < billing rate per hour >
  int rateCents;
  < monthly salary cost per consultant >
  int salaryPerHeadCents;

  void setUp(int heads, int hours, int rate, int salaryPerHead) {
    load();
    configure("Consulting", KIND_CONSULTING);
    if (heads < 0) { heads = 0; }
    if (hours < 0) { hours = 0; }
    if (rate < 0) { rate = 0; }
    if (salaryPerHead < 0) { salaryPerHead = 0; }
    consultants = heads;
    billableHours = hours;
    rateCents = rate;
    salaryPerHeadCents = salaryPerHead;
    setUnits(hours);
  }

  < Utilization as a percent of a nominal 160-hour month across all heads. >
  int utilizationPercent() {
    int capacity = consultants * 160;
    if (capacity <= 0) { return 0; }
    return (billableHours * 100) / capacity;
  }

  int monthlyRevenue() { return billableHours * rateCents; }
  int monthlyCost() { return consultants * salaryPerHeadCents; }
}