A made-up mining-company domain model for playing with domain tooling: the model graph (`/domain/overview`), the object browser (`/dom`) and the domain APIs. Converted from d1's `devdomain1claude.Spec:MiningDomain` (56 classes in 8 groups) on 2026-09-24.

Conventions (d2 class syntax, spec 6.1.1a): `X*` is a list, `<>X` / `<>X*` a reference by key to another stored object, and a bare `X` is containment: a class without a `@key` is embedded by value, a class with a `@key` would be owned. Every class carries `@group` for the browser and the model graph. `@label` marks the display field. `?` marks an optional field; d1's empty-string dates became absent values on optional fields (`Officer.endDate`, `Payment.paidOn`). Storage is the prototype's in-memory inventory, reloaded from [[Story:mining-samples]] at startup.

## Shared value types

$class Address (
  street: String,
  city: String,
  province: String,
  country: String,
  postalCode: String,
) @group("Shared value types")

$class GeoPoint (
  lat: Number,
  lon: Number,
  elevationM: Number,
  datum: String,
  utmZone: String,
) @group("Shared value types")

$class Payment (
  due: Date,
  amount: Number,
  currency: String,
  paid: Boolean,
  paidOn: Date?,
) @group("Shared value types")

## Corporate

$class Company (
  @key ticker: String,
  @label name: String,
  legalName: String,
  exchange: String,
  secondaryListing: String,
  sector: String,
  stage: String,
  primaryCommodity: <>Commodity,
  headquarters: Address,
  website: String,
  incorporatedIn: <>Jurisdiction,
  fiscalYearEnd: String,
  sharesOutstanding: Number,
  fullyDiluted: Number,
  marketCap: Number,
  cash: Number,
  debt: Number,
  workingCapital: Number,
  officers: Officer*,
  directors: Director*,
  shareClasses: ShareClass*,
  properties: <>Property*,
  financings: <>Financing*,
  filings: <>Filing*,
  auditor: String,
  transferAgent: String,
  status: String,
) @group("Corporate")

$class Person (
  @key personId: String,
  firstName: String,
  lastName: String,
  email: String,
  phone: String,
  address: Address,
  nationality: String,
  linkedin: String,
  bio: String,
  credentials: String*,
) @group("Corporate")

$class Officer (
  person: <>Person,
  title: String,
  startDate: Date,
  endDate: Date?,
  salary: Number,
  bonus: Number,
  interim: Boolean,
) @group("Corporate")

$class Director (
  person: <>Person,
  since: Date,
  independent: Boolean,
  committees: String*,
  annualFee: Number,
  sharesHeld: Number,
) @group("Corporate")

$class ShareClass (
  @label name: String,
  votesPerShare: Number,
  outstanding: Number,
  parValue: Number,
) @group("Corporate")

$class Shareholder (
  @key id: String,
  company: <>Company,
  holder: <>Person,
  institution: String,
  shares: Number,
  percent: Number,
  asOf: Date,
  insider: Boolean,
) @group("Corporate")

$class Financing (
  @key id: String,
  company: <>Company,
  kind: String,
  announced: Date,
  closed: Date,
  grossProceeds: Number,
  pricePerUnit: Number,
  units: Number,
  warrants: Warrant*,
  agent: <>Contractor,
  flowThrough: Boolean,
  useOfProceeds: String,
  holdPeriodEnds: Date,
  status: String,
) @group("Corporate")

$class Warrant (
  strike: Number,
  expiry: Date,
  count: Number,
  accelerationPrice: Number,
  ratio: Number,
) @group("Corporate")

$class OptionGrant (
  @key id: String,
  company: <>Company,
  grantee: <>Person,
  grantDate: Date,
  strike: Number,
  count: Number,
  vesting: String,
  expiry: Date,
  cancelled: Boolean,
) @group("Corporate")

$class Filing (
  @key id: String,
  company: <>Company,
  kind: String,
  filedOn: Date,
  jurisdiction: <>Jurisdiction,
  title: String,
  url: String,
  sedarId: String,
  materialChange: Boolean,
) @group("Corporate")

## Land & tenure

$class Jurisdiction (
  @key code: String,
  @label name: String,
  country: String,
  miningAct: String,
  royaltyRatePct: Number,
  corporateTaxPct: Number,
  fraserRank: Number,
  permittingMonths: Number,
  stable: Boolean,
) @group("Land & tenure")

$class Property (
  @key id: String,
  @label name: String,
  owner: <>Company,
  jurisdiction: <>Jurisdiction,
  location: GeoPoint,
  areaHa: Number,
  stage: String,
  claims: Claim*,
  permits: Permit*,
  agreements: <>Agreement*,
  royalties: Royalty*,
  deposits: <>Deposit*,
  drillPrograms: <>DrillProgram*,
  geophysics: <>GeophysicalSurvey*,
  access: String,
  infrastructure: String,
  notes: String,
) @group("Land & tenure")

$class Claim (
  number: String,
  kind: String,
  areaHa: Number,
  staked: Date,
  expires: Date,
  holder: <>Company,
  goodStanding: Boolean,
  workCredits: Number,
) @group("Land & tenure")

$class Permit (
  number: String,
  kind: String,
  issuer: <>Jurisdiction,
  issued: Date,
  expires: Date,
  conditions: String,
  status: String,
) @group("Land & tenure")

$class Agreement (
  @key id: String,
  kind: String,
  property: <>Property,
  optionor: <>Company,
  optionee: <>Company,
  earnPercent: Number,
  spendRequired: Number,
  cashPayments: Payment*,
  sharePayments: Number,
  deadline: Date,
  retainedRoyalty: Royalty,
  status: String,
) @group("Land & tenure")

$class Royalty (
  kind: String,
  ratePct: Number,
  holder: <>Company,
  buybackPct: Number,
  buybackPrice: Number,
  commodities: <>Commodity*,
  areaOfInterestKm: Number,
) @group("Land & tenure")

$class Stream (
  @key id: String,
  streamer: <>Company,
  operator: <>Company,
  mine: <>Mine,
  commodity: <>Commodity,
  percent: Number,
  ongoingPrice: Number,
  upfront: Number,
  stepDown: String,
  termYears: Number,
) @group("Land & tenure")

## Geology & resources

$class Commodity (
  @key symbol: String,
  @label name: String,
  unit: String,
  spotPrice: Number,
  currency: String,
  priceSource: String,
  category: String,
) @group("Geology & resources")

$class Mineral (
  @key @label name: String,
  formula: String,
  commodity: <>Commodity,
  hardness: Number,
  specificGravity: Number,
  habit: String,
) @group("Geology & resources")

$class Deposit (
  @key id: String,
  @label name: String,
  property: <>Property,
  style: String,
  primary: <>Commodity,
  byproducts: <>Commodity*,
  minerals: <>Mineral*,
  zones: Zone*,
  location: GeoPoint,
  strikeLengthM: Number,
  depthM: Number,
  openAtDepth: Boolean,
  discoveryYear: Number,
  estimates: <>ResourceEstimate*,
) @group("Geology & resources")

$class Zone (
  @label name: String,
  kind: String,
  strikeM: Number,
  widthM: Number,
  dipDeg: Number,
  plungeDeg: Number,
  open: Boolean,
) @group("Geology & resources")

$class ResourceEstimate (
  @key id: String,
  deposit: <>Deposit,
  effectiveDate: Date,
  author: <>QualifiedPerson,
  cutoff: Number,
  cutoffUnit: String,
  method: String,
  lines: ResourceLine*,
  ni43101: Boolean,
  reportUrl: String,
) @group("Geology & resources")

$class ResourceLine (
  category: String,
  tonnesMt: Number,
  commodity: <>Commodity,
  grade: Number,
  gradeUnit: String,
  contained: Number,
  containedUnit: String,
  pitConstrained: Boolean,
) @group("Geology & resources")

$class ReserveEstimate (
  @key id: String,
  deposit: <>Deposit,
  study: <>TechnicalStudy,
  effectiveDate: Date,
  provenMt: Number,
  probableMt: Number,
  grade: Number,
  gradeUnit: String,
  contained: Number,
  dilutionPct: Number,
  recoveryPct: Number,
  lomYears: Number,
) @group("Geology & resources")

## Exploration

$class DrillProgram (
  @key id: String,
  property: <>Property,
  operator: <>Company,
  contractor: <>Contractor,
  season: String,
  plannedMetres: Number,
  drilledMetres: Number,
  budget: Number,
  spent: Number,
  holes: <>DrillHole*,
  lab: <>Lab,
  startDate: Date,
  endDate: Date,
  status: String,
) @group("Exploration")

$class DrillHole (
  @key holeId: String,
  program: <>DrillProgram,
  collar: GeoPoint,
  azimuth: Number,
  dip: Number,
  plannedDepthM: Number,
  finalDepthM: Number,
  method: String,
  coreSize: String,
  startDate: Date,
  endDate: Date,
  target: String,
  intervals: Interval*,
  surveys: Survey*,
  samples: <>Sample*,
  loggedBy: <>Person,
  rig: <>Equipment,
  abandoned: Boolean,
  notes: String,
) @group("Exploration")

$class Interval (
  fromM: Number,
  toM: Number,
  lengthM: Number,
  trueWidthM: Number,
  lithology: String,
  alteration: String,
  mineralization: String,
  recoveryPct: Number,
  rqd: Number,
  commodity: <>Commodity,
  grade: Number,
  gradeUnit: String,
  highlight: Boolean,
) @group("Exploration")

$class Survey (
  depthM: Number,
  azimuth: Number,
  dip: Number,
  method: String,
  magField: Number,
) @group("Exploration")

$class Sample (
  @key sampleId: String,
  hole: <>DrillHole,
  fromM: Number,
  toM: Number,
  kind: String,
  location: GeoPoint,
  collectedOn: Date,
  collectedBy: <>Person,
  weightKg: Number,
  duplicate: Boolean,
  blank: Boolean,
  standard: Boolean,
  standardId: String,
  assays: <>Assay*,
  chainOfCustody: String,
) @group("Exploration")

$class Assay (
  @key id: String,
  sample: <>Sample,
  lab: <>Lab,
  certificate: String,
  method: String,
  receivedOn: Date,
  reportedOn: Date,
  auGpt: Number,
  agGpt: Number,
  cuPct: Number,
  pbPct: Number,
  znPct: Number,
  moPct: Number,
  niPct: Number,
  coPct: Number,
  li2oPct: Number,
  u3o8Pct: Number,
  auDetectionLimit: Number,
  overLimit: Boolean,
  reassay: Boolean,
  qaqcPass: Boolean,
) @group("Exploration")

$class Lab (
  @key code: String,
  @label name: String,
  address: Address,
  accreditation: String,
  isoCertified: Boolean,
  turnaroundDays: Number,
  methods: String*,
  contact: <>Person,
) @group("Exploration")

$class Contractor (
  @key id: String,
  @label name: String,
  kind: String,
  address: Address,
  contact: <>Person,
  fleet: <>Equipment*,
  dayRate: Number,
  safetyRating: Number,
  preferred: Boolean,
) @group("Exploration")

$class GeophysicalSurvey (
  @key id: String,
  property: <>Property,
  contractor: <>Contractor,
  method: String,
  flownOn: Date,
  lineKm: Number,
  spacingM: Number,
  anomalies: Anomaly*,
  reportUrl: String,
) @group("Exploration")

$class Anomaly (
  @label name: String,
  kind: String,
  strength: Number,
  location: GeoPoint,
  drillTested: Boolean,
  testedBy: <>DrillHole,
) @group("Exploration")

## Studies & economics

$class QualifiedPerson (
  @key id: String,
  person: <>Person,
  designation: String,
  association: String,
  licenseNo: String,
  independent: Boolean,
  firm: String,
) @group("Studies & economics")

$class TechnicalStudy (
  @key id: String,
  kind: String,
  deposit: <>Deposit,
  published: Date,
  authors: <>QualifiedPerson*,
  priceDeck: <>PriceDeck,
  baseCase: EconomicCase,
  sensitivities: EconomicCase*,
  capex: CapexItem*,
  opex: OpexItem*,
  mineLifeYears: Number,
  throughputTpd: Number,
  miningMethod: String,
  processMethod: String,
  recoveryPct: Number,
  reportUrl: String,
  status: String,
) @group("Studies & economics")

$class EconomicCase (
  label: String,
  discountRatePct: Number,
  npvAfterTax: Number,
  npvPreTax: Number,
  irrAfterTaxPct: Number,
  irrPreTaxPct: Number,
  paybackYears: Number,
  aisc: Number,
  cashCost: Number,
  lomRevenue: Number,
  lomFreeCashFlow: Number,
  priceBasis: String,
) @group("Studies & economics")

$class PriceDeck (
  @key id: String,
  @label name: String,
  asOf: Date,
  prices: PricePoint*,
  fxCadUsd: Number,
  source: String,
) @group("Studies & economics")

$class PricePoint (
  commodity: <>Commodity,
  price: Number,
  unit: String,
  year: Number,
) @group("Studies & economics")

$class CapexItem (
  area: String,
  phase: String,
  amount: Number,
  currency: String,
  contingencyPct: Number,
) @group("Studies & economics")

$class OpexItem (
  area: String,
  perTonne: Number,
  perYear: Number,
  currency: String,
) @group("Studies & economics")

## Operations

$class Mine (
  @key id: String,
  @label name: String,
  deposit: <>Deposit,
  operator: <>Company,
  owners: Ownership*,
  method: String,
  plant: <>Plant,
  commercialProduction: Date,
  nameplateTpd: Number,
  status: String,
  lomEnd: Date,
  workforce: <>Employee*,
  camp: <>Camp,
  periods: <>ProductionPeriod*,
  closurePlan: String,
) @group("Operations")

$class Ownership (
  owner: <>Company,
  percent: Number,
  since: Date,
  carried: Boolean,
) @group("Operations")

$class Plant (
  @key id: String,
  @label name: String,
  kind: String,
  capacityTpd: Number,
  recoveryPct: Number,
  commissioned: Date,
  circuits: String*,
  powerSource: String,
  waterM3PerDay: Number,
) @group("Operations")

$class ProductionPeriod (
  @key id: String,
  mine: <>Mine,
  period: String,
  oreMinedT: Number,
  wasteMinedT: Number,
  milledT: Number,
  headGrade: Number,
  recoveryPct: Number,
  produced: Number,
  commodity: <>Commodity,
  sold: Number,
  aisc: Number,
  cashCost: Number,
  revenue: Number,
  shipments: <>Shipment*,
  downtimeHrs: Number,
  lostTimeInjuries: Number,
) @group("Operations")

$class Shipment (
  @key id: String,
  mine: <>Mine,
  offtaker: <>Offtaker,
  product: String,
  wetTonnes: Number,
  moisturePct: Number,
  payableContent: Number,
  shippedOn: Date,
  port: String,
  vessel: String,
  invoiceValue: Number,
  settled: Boolean,
) @group("Operations")

$class Offtaker (
  @key id: String,
  @label name: String,
  country: String,
  kind: String,
  contractTerms: String,
  treatmentCharge: Number,
  refiningCharge: Number,
  penaltyElements: String*,
) @group("Operations")

$class Equipment (
  @key assetTag: String,
  kind: String,
  make: String,
  model: String,
  year: Number,
  owner: <>Contractor,
  hours: Number,
  status: String,
  location: GeoPoint,
) @group("Operations")

$class Employee (
  @key id: String,
  person: <>Person,
  employer: <>Company,
  role: String,
  site: <>Mine,
  hired: Date,
  local: Boolean,
  union: String,
  shift: String,
) @group("Operations")

$class Camp (
  @key id: String,
  @label name: String,
  location: GeoPoint,
  capacity: Number,
  operator: <>Contractor,
  flyIn: Boolean,
  powerSource: String,
) @group("Operations")

## Community & ESG

$class Community (
  @key id: String,
  @label name: String,
  kind: String,
  location: GeoPoint,
  population: Number,
  agreements: <>ImpactBenefitAgreement*,
  contact: <>Person,
) @group("Community & ESG")

$class ImpactBenefitAgreement (
  @key id: String,
  community: <>Community,
  company: <>Company,
  mine: <>Mine,
  signed: Date,
  termYears: Number,
  annualPayment: Number,
  employmentTargetPct: Number,
  status: String,
) @group("Community & ESG")

$class EnvironmentalIncident (
  @key id: String,
  site: <>Mine,
  occurredOn: Date,
  kind: String,
  severity: String,
  reportedTo: <>Jurisdiction,
  volumeM3: Number,
  remediated: Boolean,
  fine: Number,
) @group("Community & ESG")

// eol
