[
  {
    "id": "project_quote_margin",
    "version": "1",
    "title": "Project quote margin",
    "description": "Check a project quote against delivery costs and a target margin. Margin is profit divided by revenue, not markup.",
    "inputs": {
      "quote": {
        "title": "Quoted revenue",
        "description": "Quoted revenue, in the run's currency.",
        "minimum": 0,
        "maximum": 10000000,
        "exclusiveMinimum": true,
        "unit": "money"
      },
      "hours": {
        "title": "Delivery hours",
        "description": "Delivery hours; include all delivery time.",
        "minimum": 0,
        "maximum": 10000,
        "exclusiveMinimum": false,
        "unit": "hours"
      },
      "loaded_hourly_cost": {
        "title": "Loaded labor cost per hour",
        "description": "Loaded labor cost per hour, in the run's currency.",
        "minimum": 0,
        "maximum": 10000000,
        "exclusiveMinimum": false,
        "unit": "money"
      },
      "external_costs": {
        "title": "External costs",
        "description": "External costs, in the run's currency.",
        "minimum": 0,
        "maximum": 10000000,
        "exclusiveMinimum": false,
        "unit": "money"
      },
      "target_margin": {
        "title": "Target margin",
        "description": "Target margin as a fraction: 0.30 means 30%.",
        "minimum": 0,
        "maximum": 0.99,
        "unit": "ratio"
      }
    },
    "formulas": [
      "labor_cost = hours * loaded_hourly_cost",
      "delivery_cost = labor_cost + external_costs",
      "profit = quote - delivery_cost",
      "margin = profit / quote",
      "minimum_quote_raw = delivery_cost / (1 - target_margin)",
      "minimum_quote = minimum_quote_raw rounded up to nearest 0.01"
    ],
    "outputs": {
      "delivery_cost": {
        "title": "Delivery cost",
        "format": "currency"
      },
      "profit": {
        "title": "Profit",
        "format": "currency"
      },
      "margin": {
        "title": "Margin",
        "format": "percent"
      },
      "minimum_quote": {
        "title": "Minimum quote",
        "format": "currency",
        "round": "up"
      }
    },
    "example": {
      "quote": 4200,
      "hours": 100,
      "loaded_hourly_cost": 25,
      "external_costs": 200,
      "target_margin": 0.3
    },
    "assumptions": [
      "All monetary inputs use one currency; no exchange rates are fetched.",
      "Inputs are caller-supplied assumptions, not verified facts.",
      "Calculations use floating-point arithmetic; displayed money rounds to cents.",
      "Loaded labor cost includes the overhead you choose to include. Sales taxes and financing are outside this model."
    ]
  },
  {
    "id": "contracting_hourly_rate",
    "version": "1",
    "title": "Required contracting rate",
    "description": "Calculate monthly revenue and an hourly rate from the production contracting model's explicit assumptions.",
    "inputs": {
      "desired_net_monthly": {
        "title": "Desired net monthly income",
        "description": "Desired net monthly income, in the run's currency.",
        "minimum": 0,
        "maximum": 10000000,
        "exclusiveMinimum": true,
        "unit": "money"
      },
      "business_costs_monthly": {
        "title": "Monthly business costs",
        "description": "Monthly business costs, in the run's currency.",
        "minimum": 0,
        "maximum": 10000000,
        "exclusiveMinimum": false,
        "unit": "money"
      },
      "tax_rate": {
        "title": "Assumed tax rate",
        "description": "Assumed tax rate as a fraction: 0.30 means 30%.",
        "minimum": 0,
        "maximum": 0.99,
        "unit": "ratio"
      },
      "billable_hours_monthly": {
        "title": "Monthly billable hours",
        "description": "Monthly billable hours; include all delivery time.",
        "minimum": 0,
        "maximum": 10000,
        "exclusiveMinimum": true,
        "unit": "hours"
      },
      "nonbillable_hours_monthly": {
        "title": "Monthly non-billable hours",
        "description": "Monthly non-billable hours; include all delivery time.",
        "minimum": 0,
        "maximum": 10000,
        "exclusiveMinimum": false,
        "unit": "hours"
      }
    },
    "formulas": [
      "committed_hours_monthly = billable_hours_monthly + nonbillable_hours_monthly",
      "utilization_rate = billable_hours_monthly / committed_hours_monthly",
      "revenue_target_monthly = (desired_net_monthly + business_costs_monthly) / (1 - tax_rate)",
      "required_hourly_rate_raw = revenue_target_monthly / billable_hours_monthly",
      "required_hourly_rate = required_hourly_rate_raw rounded up to nearest 0.01"
    ],
    "outputs": {
      "revenue_target_monthly": {
        "title": "Monthly revenue target",
        "format": "currency"
      },
      "required_hourly_rate": {
        "title": "Required hourly rate",
        "format": "currency",
        "round": "up"
      },
      "committed_hours_monthly": {
        "title": "Committed hours",
        "format": "number"
      },
      "utilization_rate": {
        "title": "Billable share",
        "format": "percent"
      }
    },
    "example": {
      "desired_net_monthly": 5000,
      "business_costs_monthly": 700,
      "tax_rate": 0.25,
      "billable_hours_monthly": 110,
      "nonbillable_hours_monthly": 35
    },
    "assumptions": [
      "All monetary inputs use one currency; no exchange rates are fetched.",
      "Inputs are caller-supplied assumptions, not verified facts.",
      "Calculations use floating-point arithmetic; displayed money rounds to cents.",
      "Uses the existing contracting model: (net income + business costs) / (1 - tax rate). This is a simplified assumption, not a tax calculation."
    ]
  },
  {
    "id": "retainer_capacity",
    "version": "1",
    "title": "Retainer capacity",
    "description": "Check monthly retainer profitability and hours available at a target margin.",
    "inputs": {
      "monthly_fee": {
        "title": "Monthly fee",
        "description": "Monthly fee, in the run's currency.",
        "minimum": 0,
        "maximum": 10000000,
        "exclusiveMinimum": true,
        "unit": "money"
      },
      "delivery_hours": {
        "title": "Monthly delivery hours",
        "description": "Monthly delivery hours; include all delivery time.",
        "minimum": 0,
        "maximum": 10000,
        "exclusiveMinimum": true,
        "unit": "hours"
      },
      "loaded_hourly_cost": {
        "title": "Loaded labor cost per hour",
        "description": "Loaded labor cost per hour, in the run's currency.",
        "minimum": 0,
        "maximum": 10000000,
        "exclusiveMinimum": true,
        "unit": "money"
      },
      "external_costs": {
        "title": "Monthly external costs",
        "description": "Monthly external costs, in the run's currency.",
        "minimum": 0,
        "maximum": 10000000,
        "exclusiveMinimum": false,
        "unit": "money"
      },
      "target_margin": {
        "title": "Target margin",
        "description": "Target margin as a fraction: 0.30 means 30%.",
        "minimum": 0,
        "maximum": 0.99,
        "unit": "ratio"
      }
    },
    "formulas": [
      "delivery_cost = delivery_hours * loaded_hourly_cost + external_costs",
      "profit = monthly_fee - delivery_cost",
      "margin = profit / monthly_fee",
      "effective_hourly_revenue = monthly_fee / delivery_hours",
      "maximum_hours_raw = (monthly_fee * (1 - target_margin) - external_costs) / loaded_hourly_cost",
      "maximum_hours = maximum_hours_raw rounded down to nearest 0.01"
    ],
    "outputs": {
      "delivery_cost": {
        "title": "Monthly delivery cost",
        "format": "currency"
      },
      "profit": {
        "title": "Monthly profit",
        "format": "currency"
      },
      "margin": {
        "title": "Margin",
        "format": "percent"
      },
      "effective_hourly_revenue": {
        "title": "Revenue per delivery hour",
        "format": "currency"
      },
      "maximum_hours": {
        "title": "Hours available at target",
        "format": "number",
        "round": "down"
      }
    },
    "example": {
      "monthly_fee": 3000,
      "delivery_hours": 60,
      "loaded_hourly_cost": 30,
      "external_costs": 200,
      "target_margin": 0.3
    },
    "assumptions": [
      "All monetary inputs use one currency; no exchange rates are fetched.",
      "Inputs are caller-supplied assumptions, not verified facts.",
      "Calculations use floating-point arithmetic; displayed money rounds to cents.",
      "A negative maximum-hours result means external costs alone exceed the target cost allowance."
    ]
  }
]
