Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

26.6 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.

import type {
  BatchPropertySpec,
  ConfigurationSpec,
  CustomerPartSpec,
  EnforcementRuleSpec,
  InspectionPlanSpec,
  ItemSpec,
  ItemsData,
  MakeMethodSpec,
  PriceOverrideSpec,
  PricingRuleSpec,
  RevisionLadderSpec,
  SupersessionSpec,
  SupplierLinkSpec
} from "../../types.ts";
import { satelliteAssembly } from "./assembly.ts";

// ---------------------------------------------------------------------------
// Satellite item catalog for Orbital Systems Inc.
// Namespace items by type so readableIds can't collide across extension tables.
//   Make Parts: SAT- / BUS- / EPS- / ADCS- / COMMS- / PROP- / SAW- / ANT- /
//               HARNESS- / PCB-EPS- / PCB-ADCS-
//   Buy Parts:  BAT- / RW- / ST- / TXRX- / THR- / TANK- / VLV- / FST- / BRG- /
//               PCB-BARE-
//   MAT- = Materials, TL- = Tools, CN- = Consumables; services are keyed by name
// PCB- spans both: the bare board is bought, the populated assemblies are made.
// ---------------------------------------------------------------------------

export const BUY_PARTS: ItemSpec[] = [
  // Electronics
  {
    readableId: "BAT-LIION-48V",
    name: "Li-Ion Battery Pack 48V 100Wh",
    type: "Part",
    replenishment: "Buy",
    // Batch-tracked: receiving captures a lot, and the lot is what gets scanned
    // into an assembly on the floor.
    trackingType: "Batch",
    standardCost: 2400,
    unitSalePrice: 3600,
    leadTime: 60
  },
  {
    readableId: "PCB-BARE-REV3",
    name: "Bare PCB Rev3 (4-layer)",
    type: "Part",
    replenishment: "Buy",
    standardCost: 85,
    leadTime: 21
  },
  {
    readableId: "RW-010",
    name: "Reaction Wheel 0.010 Nm",
    type: "Part",
    replenishment: "Buy",
    trackingType: "Serial",
    standardCost: 14500,
    unitSalePrice: 21750,
    leadTime: 90
  },
  {
    readableId: "ST-050",
    name: "Star Tracker 0.5 arcsec",
    type: "Part",
    replenishment: "Buy",
    standardCost: 28000,
    unitSalePrice: 42000,
    leadTime: 120
  },
  {
    readableId: "TXRX-SBAND",
    name: "S-Band Transponder 2W",
    type: "Part",
    replenishment: "Buy",
    standardCost: 9500,
    unitSalePrice: 14250,
    leadTime: 90
  },
  // Propulsion
  {
    readableId: "THR-HYDRA-1N",
    name: "Hydrazine Thruster 1N",
    type: "Part",
    replenishment: "Buy",
    standardCost: 6800,
    unitSalePrice: 10200,
    leadTime: 120
  },
  {
    readableId: "TANK-TI-4L",
    name: "Titanium Propellant Tank 4L",
    type: "Part",
    replenishment: "Buy",
    standardCost: 3200,
    unitSalePrice: 4800,
    leadTime: 60
  },
  {
    readableId: "VLV-SOLENOID-LP",
    name: "Solenoid Valve Low-Pressure",
    type: "Part",
    replenishment: "Buy",
    standardCost: 950,
    unitSalePrice: 1425,
    leadTime: 45
  },
  // Structural buy parts
  {
    readableId: "FST-M4-TI",
    name: "M4 x 8 Titanium Fastener",
    type: "Part",
    replenishment: "Buy",
    standardCost: 2.5,
    unitSalePrice: 4,
    leadTime: 14
  },
  {
    readableId: "FST-M6-A286",
    name: "M6 x 10 A286 Fastener",
    type: "Part",
    replenishment: "Buy",
    standardCost: 5.5,
    unitSalePrice: 8,
    leadTime: 14
  },
  {
    readableId: "BRG-6201",
    name: "Deep Groove Ball Bearing 6201",
    type: "Part",
    replenishment: "Buy",
    standardCost: 18,
    unitSalePrice: 27,
    leadTime: 10
  },
  // Deliberately absent from every BOM: job creation and picking redirect to it via SUPERSESSIONS.
  {
    readableId: "VLV-SOLENOID-LP2",
    name: "Solenoid Valve Low-Pressure Gen2",
    type: "Part",
    replenishment: "Buy",
    standardCost: 1050,
    unitSalePrice: 1575,
    leadTime: 30
  }
];

export const MATERIALS: ItemSpec[] = [
  {
    readableId: "MAT-AL7075-PLT",
    name: "Aluminum 7075-T651 Plate",
    type: "Material",
    trackingType: "Batch",
    standardCost: 12,
    unitOfMeasureCode: "LB",
    leadTime: 10
  },
  {
    readableId: "MAT-CF-LAM",
    name: "Carbon Fiber Laminate Sheet 1mm",
    type: "Material",
    standardCost: 320,
    unitOfMeasureCode: "EA",
    leadTime: 21,
    // Partially classified on purpose.
    material: {
      substance: "Carbon Fiber Composite",
      grade: "M55J",
      finish: "Low-Outgassing Coating"
    }
  },
  {
    readableId: "MAT-GAAS-CELL",
    name: "Triple-Junction GaAs Solar Cell",
    type: "Material",
    standardCost: 180,
    unitOfMeasureCode: "EA",
    leadTime: 45
  },
  {
    readableId: "MAT-KAPTON",
    name: "Kapton HN Tape 25mm",
    type: "Material",
    standardCost: 45,
    unitOfMeasureCode: "YD",
    leadTime: 7,
    material: {
      substance: "Polyimide Film",
      form: "Film Roll",
      materialType: "Polyimide Tape Roll",
      grade: "Kapton HN",
      finish: "Silicone Adhesive Backing",
      dimension: "25mm x 33m"
    }
  },
  {
    readableId: "MAT-SYLGARD",
    name: "Sylgard 184 Silicone Potting",
    type: "Material",
    standardCost: 95,
    unitOfMeasureCode: "LB",
    leadTime: 7
  },
  {
    readableId: "MAT-CONFCOAT",
    name: "Conformal Coat Acrylic 400mL",
    type: "Material",
    standardCost: 62,
    unitOfMeasureCode: "EA",
    leadTime: 5
  }
];

export const CONSUMABLES: ItemSpec[] = [
  {
    readableId: "CN-MLI-001",
    name: "MLI Blanket Kit (pre-cut)",
    type: "Consumable",
    standardCost: 380,
    leadTime: 14
  },
  {
    readableId: "CN-GREASE-001",
    name: "Krytox 240 AC Lubricant",
    type: "Consumable",
    standardCost: 95,
    unitOfMeasureCode: "LB"
  }
];

export const TOOLS: ItemSpec[] = [
  {
    readableId: "TL-TORQUE-J1",
    name: "Torque Driver Set (Metric)",
    type: "Tool",
    standardCost: 450
  },
  {
    readableId: "TL-PROBE-VNA",
    name: "VNA Cable Calibration Kit",
    type: "Tool",
    standardCost: 2800
  }
];

export const SERVICES: ItemSpec[] = [
  {
    // A service's readableId is its name.
    readableId: "Thermal Vacuum Test",
    name: "Thermal Vacuum Test",
    type: "Service",
    thumbnail: "SVC-TVT",
    replenishment: "Buy",
    standardCost: 8500,
    leadTime: 30
  },
  {
    // Sold on the demo customer contract (sales.contracts); no bundled thumbnail.
    readableId: "Ground Segment Integration",
    name: "Ground Segment Integration",
    type: "Service",
    replenishment: "Buy",
    description:
      "Commissioning of a customer ground station against the bus telemetry and command interface.",
    standardCost: 32000
  },
  {
    // Sold on the demo customer contract (sales.contracts); no bundled thumbnail.
    readableId: "Mission Operations Support",
    name: "Mission Operations Support",
    type: "Service",
    replenishment: "Buy",
    description:
      "Flight dynamics, anomaly response and pass planning for a flying bus.",
    standardCost: 9500
  }
];

// Make parts — BOM/BOP built programmatically in the tier
export const MAKE_PARTS: ItemSpec[] = [
  {
    readableId: "SAT-1000",
    name: "ESPA-Class Smallsat Bus (Complete)",
    type: "Part",
    replenishment: "Make",
    // Serial-tracked: each satellite gets its own genealogy in traceability.
    trackingType: "Serial",
    standardCost: 990000,
    unitSalePrice: 1800000
  },
  {
    readableId: "BUS-STR-001",
    name: "Structural Frame Assembly",
    type: "Part",
    replenishment: "Make",
    standardCost: 24750,
    unitSalePrice: 45000
  },
  {
    readableId: "EPS-001",
    name: "Electrical Power Subsystem",
    type: "Part",
    replenishment: "Make",
    standardCost: 66000,
    unitSalePrice: 120000
  },
  {
    readableId: "SAW-001",
    name: "Solar Array Wing",
    type: "Part",
    replenishment: "Make",
    standardCost: 19250,
    unitSalePrice: 35000
  },
  {
    readableId: "PCB-EPS-R1",
    name: "EPS Control PCB Assembly",
    type: "Part",
    replenishment: "Make",
    standardCost: 2310,
    unitSalePrice: 4200
  },
  {
    readableId: "ADCS-001",
    name: "Attitude Determination & Control System",
    type: "Part",
    replenishment: "Make",
    standardCost: 52250,
    unitSalePrice: 95000
  },
  {
    readableId: "PCB-ADCS-R1",
    name: "ADCS Electronics Board",
    type: "Part",
    replenishment: "Make",
    standardCost: 3190,
    unitSalePrice: 5800
  },
  {
    readableId: "COMMS-001",
    name: "Communications Subsystem",
    type: "Part",
    replenishment: "Make",
    standardCost: 15400,
    unitSalePrice: 28000
  },
  {
    readableId: "ANT-PATCH-01",
    name: "Patch Antenna S-Band",
    type: "Part",
    replenishment: "Make",
    standardCost: 990,
    unitSalePrice: 1800
  },
  {
    readableId: "PROP-001",
    name: "Propulsion Module",
    type: "Part",
    replenishment: "Make",
    standardCost: 20900,
    unitSalePrice: 38000
  },
  {
    readableId: "HARNESS-001",
    name: "Spacecraft Wiring Harness",
    type: "Part",
    replenishment: "Make",
    standardCost: 6600,
    unitSalePrice: 12000
  }
];

// BOMs and BOPs, in the order they are inserted.
// Fractional per-unit quantities are kept to halves, quarters and eighths.
// Extended quantity is float multiplication, so 0.05 x 3 renders as
// 0.15000000000000002 on the shop floor — these values multiply out clean.
export const METHODS: MakeMethodSpec[] = [
  {
    readableId: "BUS-STR-001",
    bom: [
      { component: "MAT-AL7075-PLT", quantity: 4.5, order: 1 },
      { component: "FST-M4-TI", quantity: 48, order: 2 },
      { component: "FST-M6-A286", quantity: 24, order: 3 },
      { component: "BRG-6201", quantity: 4, order: 4 },
      { component: "CN-GREASE-001", quantity: 0.25, order: 5 }
    ],
    bop: [
      {
        process: "Machining",
        workCenter: "CNC Mill",
        description: "Machine structural panels",
        order: 1,
        setupTime: 0.75,
        laborTime: 4,
        machineTime: 3.5,
        parameters: [
          { key: "Fixture", value: "FX-BUS-PANEL-01" },
          { key: "Coolant", value: "Flood — water-soluble" }
        ]
      },
      {
        process: "Welding",
        workCenter: "TIG Welder Cell",
        description: "Weld bracket assemblies",
        order: 2,
        setupTime: 0.5,
        laborTime: 2
      },
      // Sent out to AstroMill for hard anodize between welding and assembly.
      {
        process: "Outside Processing",
        description: "Hard anodize (Type III) at supplier",
        order: 3,
        operationType: "Outside Processing",
        supplierProcess: "sp:AstroMill Machining:Outside Processing",
        operationLeadTime: 7,
        operationUnitCost: 240,
        laborTime: 0,
        laborUnit: "Total Hours"
      },
      {
        process: "Clean Room Assembly",
        workCenter: "Clean Room Bay A",
        description: "Final assembly & torque",
        order: 4,
        laborTime: 3,
        // Gives the MES operation screen an Instructions tab with real steps.
        procedure: "procedure:Structural Frame Assembly",
        tools: [{ tool: "TL-TORQUE-J1", quantity: 1 }],
        parameters: [
          { key: "Torque Spec", value: "9 Nm, star pattern" },
          { key: "Cleanliness Class", value: "ISO 7" }
        ]
      }
    ]
  },
  {
    readableId: "SAW-001",
    bom: [
      { component: "MAT-GAAS-CELL", quantity: 64, order: 1 },
      { component: "MAT-CF-LAM", quantity: 0.75, order: 2 },
      { component: "MAT-KAPTON", quantity: 2.5, order: 3 }
    ],
    bop: [
      {
        process: "Composite Layup",
        workCenter: "Clean Room Bay A",
        description: "Layup solar array substrate",
        order: 1,
        setupTime: 0.5,
        laborTime: 6,
        machineTime: 4
      },
      {
        process: "Clean Room Assembly",
        workCenter: "Clean Room Bay A",
        description: "Bond cells to substrate",
        order: 2,
        laborTime: 8
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "Electrical test",
        order: 3,
        laborTime: 2
      }
    ]
  },
  {
    readableId: "PCB-EPS-R1",
    bom: [
      { component: "PCB-BARE-REV3", quantity: 1, order: 1 },
      { component: "MAT-SYLGARD", quantity: 0.25, order: 2 },
      { component: "MAT-CONFCOAT", quantity: 0.125, order: 3 }
    ],
    bop: [
      {
        process: "PCB Assembly",
        workCenter: "PCB Lab",
        description: "SMT placement & reflow",
        order: 1,
        laborTime: 1.5
      },
      {
        process: "Potting & Conformal Coat",
        workCenter: "Potting Station",
        description: "Coat and pot",
        order: 2,
        laborTime: 0.5
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "Flying probe test",
        order: 3,
        laborTime: 1,
        operationType: "Inspection",
        inspectionPlan: "EPS-PCB-FPT"
      }
    ]
  },
  {
    readableId: "PCB-ADCS-R1",
    bom: [
      { component: "PCB-BARE-REV3", quantity: 1, order: 1 },
      { component: "MAT-CONFCOAT", quantity: 0.125, order: 2 }
    ],
    bop: [
      {
        process: "PCB Assembly",
        workCenter: "PCB Lab",
        description: "SMT placement & reflow",
        order: 1,
        setupTime: 0.5,
        laborTime: 1.5,
        machineTime: 0.25
      },
      {
        process: "Potting & Conformal Coat",
        workCenter: "Potting Station",
        description: "Conformal coat",
        order: 2,
        laborTime: 0.25
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "Functional test",
        order: 3,
        laborTime: 1
      }
    ]
  },
  {
    readableId: "EPS-001",
    bom: [
      { component: "SAW-001", quantity: 2, order: 1 },
      { component: "BAT-LIION-48V", quantity: 1, order: 2 },
      { component: "PCB-EPS-R1", quantity: 1, order: 3 },
      { component: "MAT-KAPTON", quantity: 1.0, order: 4 }
    ],
    bop: [
      {
        process: "Clean Room Assembly",
        workCenter: "Clean Room Bay A",
        description: "Integrate solar arrays & battery",
        order: 1,
        laborTime: 4
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "EPS functional test",
        order: 2,
        laborTime: 2
      }
    ]
  },
  {
    readableId: "ADCS-001",
    bom: [
      { component: "RW-010", quantity: 4, order: 1 },
      { component: "ST-050", quantity: 2, order: 2 },
      { component: "PCB-ADCS-R1", quantity: 1, order: 3 },
      { component: "BRG-6201", quantity: 8, order: 4 },
      { component: "FST-M4-TI", quantity: 24, order: 5 }
    ],
    bop: [
      {
        process: "Clean Room Assembly",
        workCenter: "Clean Room Bay A",
        description: "Install RW and star tracker",
        order: 1,
        laborTime: 5
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "ADCS functional test",
        order: 2,
        laborTime: 3
      }
    ]
  },
  {
    readableId: "ANT-PATCH-01",
    bom: [
      { component: "MAT-CF-LAM", quantity: 0.125, order: 1 },
      { component: "MAT-KAPTON", quantity: 0.25, order: 2 }
    ],
    bop: [
      {
        process: "Composite Layup",
        workCenter: "Clean Room Bay A",
        description: "Lay up antenna patch substrate",
        order: 1,
        laborTime: 2
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "RF performance test",
        order: 2,
        laborTime: 1
      }
    ]
  },
  {
    readableId: "COMMS-001",
    bom: [
      { component: "TXRX-SBAND", quantity: 1, order: 1 },
      { component: "ANT-PATCH-01", quantity: 2, order: 2 },
      { component: "MAT-KAPTON", quantity: 0.5, order: 3 }
    ],
    bop: [
      {
        process: "Clean Room Assembly",
        workCenter: "Clean Room Bay A",
        description: "Integrate transponder & antennas",
        order: 1,
        laborTime: 3
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "End-to-end link test",
        order: 2,
        laborTime: 2
      }
    ]
  },
  {
    readableId: "PROP-001",
    bom: [
      { component: "THR-HYDRA-1N", quantity: 2, order: 1 },
      { component: "TANK-TI-4L", quantity: 1, order: 2 },
      { component: "VLV-SOLENOID-LP", quantity: 4, order: 3 },
      { component: "FST-M6-A286", quantity: 16, order: 4 }
    ],
    bop: [
      {
        process: "Clean Room Assembly",
        workCenter: "Clean Room Bay A",
        description: "Assemble prop module",
        order: 1,
        laborTime: 6
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "Leak and proof pressure test",
        order: 2,
        laborTime: 4
      }
    ]
  },
  {
    readableId: "HARNESS-001",
    bom: [
      { component: "MAT-KAPTON", quantity: 5.0, order: 1 },
      { component: "FST-M4-TI", quantity: 12, order: 2 }
    ],
    bop: [
      {
        process: "Clean Room Assembly",
        workCenter: "Clean Room Bay A",
        description: "Lay and terminate harness",
        order: 1,
        laborTime: 8
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "Continuity & insulation test",
        order: 2,
        laborTime: 2
      }
    ]
  },
  {
    readableId: "SAT-1000",
    bom: [
      { component: "BUS-STR-001", quantity: 1, order: 1 },
      { component: "EPS-001", quantity: 1, order: 2 },
      { component: "ADCS-001", quantity: 1, order: 3 },
      { component: "COMMS-001", quantity: 1, order: 4 },
      { component: "PROP-001", quantity: 1, order: 5 },
      { component: "HARNESS-001", quantity: 1, order: 6 },
      { component: "CN-MLI-001", quantity: 1, order: 7 }
    ],
    bop: [
      // Assembly (not Process) so the MES routes this operation to the assembly
      // view, where tracked components are scanned into the serial being built.
      {
        process: "Clean Room Assembly",
        workCenter: "Clean Room Bay A",
        description: "Systems integration",
        order: 1,
        laborTime: 16,
        operationType: "Assembly",
        // Gives the MES assembly view its step checklist.
        procedure: "procedure:Satellite Systems Integration"
      },
      {
        process: "Thermal Vacuum Test",
        workCenter: "TVAC Chamber 1",
        description: "TVAC qualification test",
        order: 2,
        laborTime: 72,
        laborUnit: "Total Hours",
        procedure: "procedure:TVAC Qualification Test"
      },
      {
        process: "Final Inspection",
        workCenter: "QC Bench",
        description: "Acceptance test review",
        order: 3,
        laborTime: 4
      }
    ]
  }
];

// Which supplier can supply what
export const SUPPLIER_LINKS: SupplierLinkSpec[] = [
  {
    supplier: "CelestialElex",
    item: "PCB-BARE-REV3",
    price: 85,
    leadTime: 21
  },
  {
    supplier: "CelestialElex",
    item: "BAT-LIION-48V",
    price: 2400,
    leadTime: 60
  },
  {
    supplier: "CelestialElex",
    item: "TXRX-SBAND",
    price: 9500,
    leadTime: 90
  },
  {
    supplier: "SpaceGrade Fasteners",
    item: "FST-M4-TI",
    price: 2.5,
    leadTime: 14
  },
  {
    supplier: "SpaceGrade Fasteners",
    item: "FST-M6-A286",
    price: 5.5,
    leadTime: 14
  },
  {
    supplier: "SpaceGrade Fasteners",
    item: "BRG-6201",
    price: 18,
    leadTime: 10
  },
  {
    supplier: "Orbital Composites",
    item: "MAT-CF-LAM",
    price: 320,
    leadTime: 21
  },
  {
    supplier: "Orbital Composites",
    item: "MAT-AL7075-PLT",
    price: 12,
    leadTime: 10
  },
  {
    supplier: "PropTech Solutions",
    item: "THR-HYDRA-1N",
    price: 6800,
    leadTime: 120
  },
  {
    supplier: "PropTech Solutions",
    item: "TANK-TI-4L",
    price: 3200,
    leadTime: 60
  },
  {
    supplier: "PropTech Solutions",
    item: "VLV-SOLENOID-LP",
    price: 950,
    leadTime: 45
  },
  { supplier: "Deep Space RF", item: "RW-010", price: 14500, leadTime: 90 },
  { supplier: "Deep Space RF", item: "ST-050", price: 28000, leadTime: 120 },
  {
    supplier: "PropTech Solutions",
    item: "VLV-SOLENOID-LP2",
    price: 1050,
    leadTime: 30
  }
];

// PROP-001 still names VLV-SOLENOID-LP (8 on shelf A3-L2), so Consume First
// keeps pulling the old valve until the shelf is empty, then swaps to Gen2.
export const SUPERSESSIONS: SupersessionSpec[] = [
  {
    predecessor: "VLV-SOLENOID-LP",
    successor: "VLV-SOLENOID-LP2",
    mode: "Consume First",
    successorEffectivityOffset: -14
  }
];

export const CUSTOMER_PARTS: CustomerPartSpec[] = [
  {
    item: "SAT-1000",
    customer: "ORBSEC Defense",
    customerPartId: "ORB-BUS-4400",
    customerRevision: "C"
  },
  {
    item: "EPS-001",
    customer: "NovaSat Networks",
    customerPartId: "NS-PWR-201"
  }
];

export const PRICE_OVERRIDES: PriceOverrideSpec[] = [
  {
    item: "SAT-1000",
    customer: "NovaSat Networks",
    notes: "FY constellation block-buy pricing per MSA amendment 3.",
    breaks: [
      { quantity: 1, overridePrice: 1750000 },
      { quantity: 3, overridePrice: 1690000 }
    ]
  }
];

export const PRICING_RULES: PricingRuleSpec[] = [
  {
    name: "ORBSEC program discount",
    ruleType: "Discount",
    amountType: "Percentage",
    amount: 5,
    customer: "ORBSEC Defense",
    minQuantity: 2,
    priority: 10
  },
  {
    name: "Commercial operator spares markup",
    ruleType: "Markup",
    amountType: "Percentage",
    amount: 12,
    customerType: "Commercial",
    items: ["TXRX-SBAND", "THR-HYDRA-1N", "RW-010"],
    priority: 5
  },
  {
    name: "Flight fastener lot break",
    ruleType: "Discount",
    amountType: "Fixed",
    amount: 0.25,
    items: ["FST-M4-TI", "FST-M6-A286"],
    minQuantity: 250,
    priority: 1
  }
];

export const CONFIGURATION: ConfigurationSpec = {
  item: "SAT-1000",
  group: "Mission Configuration",
  parameters: [
    { key: "payload_mass_kg", label: "Payload Mass (kg)", dataType: "numeric" },
    {
      key: "orbit_regime",
      label: "Orbit Regime",
      dataType: "list",
      listOptions: ["LEO", "SSO", "GTO"]
    },
    {
      key: "propulsion_module",
      label: "Include Propulsion Module",
      dataType: "boolean"
    }
  ],
  rules: [
    {
      target: { component: "PROP-001" },
      field: "quantity",
      code: "return params.propulsion_module ? 1 : 0;"
    },
    {
      target: { operation: 2 },
      field: "laborTime",
      code: 'return params.orbit_regime === "GTO" ? 96 : 72;'
    }
  ],
  prices: [
    { key: "payload_mass_kg", amount: 100 },
    { key: "orbit_regime", value: "LEO", amount: 2000 },
    { key: "orbit_regime", value: "SSO", amount: 3000 },
    { key: "orbit_regime", value: "GTO", amount: 4000 },
    { key: "propulsion_module", value: "true", amount: 1000 }
  ]
};

export const REVISION_LADDER: RevisionLadderSpec[] = [
  {
    item: "ANT-PATCH-01",
    obsoleteRevision: "A",
    nextRevision: "B",
    nextStatus: "Prototype"
  }
];

// A sampling plan of its own makes the MES open an inspection lot, not a plain operation.
export const INSPECTION_PLANS: InspectionPlanSpec[] = [
  {
    key: "EPS-PCB-FPT",
    item: "PCB-EPS-R1",
    drawingNumber: "EPS-CTL-200 Rev D",
    aql: 1.0,
    features: [
      {
        label: "1",
        description: "3V3 bus regulation under 2 A load",
        nominalValue: "3.300",
        tolerancePlus: "0.050",
        toleranceMinus: "0.050",
        unit: "V"
      },
      {
        label: "2",
        description: "Battery charge FET gate threshold",
        nominalValue: "2.10",
        tolerancePlus: "0.25",
        toleranceMinus: "0.25",
        unit: "V"
      }
    ]
  }
];

export const ENFORCEMENT_RULES: EnforcementRuleSpec[] = [
  {
    family: "sales",
    name: "ITAR spacecraft — US ship-to only",
    description: "22 CFR 120: the bus and ADCS are defense articles.",
    message:
      "ITAR-controlled hardware can only ship to a US address. Route export requests through Trade Compliance.",
    severity: "error",
    surfaces: ["salesOrderLine", "salesInvoiceLine"],
    match: "all",
    conditions: [
      { field: "customer.location.countryCode", op: "in", value: ["US"] }
    ],
    items: ["SAT-1000", "ADCS-001"]
  },
  {
    family: "sales",
    name: "Research orders need program sign-off",
    message:
      "Flight subsystems quoted to a research institution need program office sign-off before pricing is released.",
    severity: "warn",
    surfaces: ["quoteLine", "salesOrderLine"],
    match: "all",
    conditions: [
      {
        field: "customer.customerTypeId",
        op: "notIn",
        value: { customerTypes: ["Research"] }
      }
    ],
    items: ["EPS-001", "COMMS-001"]
  },
  {
    family: "storage",
    targetType: "item",
    name: "Flight electronics stay at the plant",
    message:
      "Flight electronics are stored at the Houston plant only — pick a plant bin.",
    severity: "warn",
    surfaces: ["receipt", "stockTransfer"],
    match: "all",
    conditions: [
      {
        field: "storageUnit.locationId",
        op: "eq",
        value: { location: "Plant" }
      }
    ],
    items: ["TXRX-SBAND", "ST-050", "RW-010"]
  },
  {
    family: "storage",
    targetType: "item",
    name: "Propellant tanks on racks",
    message: "Titanium propellant tanks are racked, never binned.",
    severity: "warn",
    surfaces: ["place"],
    match: "all",
    conditions: [
      {
        field: "storageUnit.storageTypeId",
        op: "eq",
        value: { storageType: "Rack" }
      }
    ],
    items: ["TANK-TI-4L"]
  },
  {
    family: "storage",
    targetType: "workCenter",
    name: "Clean room bay in service",
    message:
      "This clean room bay is out of service — start the integration on another bay.",
    severity: "error",
    surfaces: ["operationStart"],
    match: "all",
    conditions: [{ field: "workCenter.active", op: "eq", value: true }],
    workCenters: ["Clean Room Bay A"]
  }
];

export const BATCH_PROPERTIES: BatchPropertySpec[] = [
  { item: "BAT-LIION-48V", label: "Cell lot code", dataType: "text" },
  { item: "BAT-LIION-48V", label: "Formation date", dataType: "date" },
  {
    item: "BAT-LIION-48V",
    label: "Capacity grade",
    dataType: "list",
    listOptions: ["A", "B"]
  },
  { item: "MAT-AL7075-PLT", label: "Heat number", dataType: "text" },
  { item: "MAT-AL7075-PLT", label: "Mill cert received", dataType: "boolean" }
];

export const satelliteItems: ItemsData = {
  assembly: satelliteAssembly,
  buyParts: BUY_PARTS,
  materials: MATERIALS,
  consumables: CONSUMABLES,
  tools: TOOLS,
  services: SERVICES,
  makeParts: MAKE_PARTS,
  methods: METHODS,
  supplierLinks: SUPPLIER_LINKS,
  supersessions: SUPERSESSIONS,
  customerParts: CUSTOMER_PARTS,
  priceOverrides: PRICE_OVERRIDES,
  pricingRules: PRICING_RULES,
  configuration: CONFIGURATION,
  revisionLadder: REVISION_LADDER,
  inspectionPlans: INSPECTION_PLANS,
  enforcementRules: ENFORCEMENT_RULES,
  batchProperties: BATCH_PROPERTIES
};