{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/medianfi-com/json-schema/medianfi-com-private-tax-plan-response-schema.json",
  "title": "PrivateTaxPlanResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/medianfi-com-companies-api-openapi.yml#/components/schemas/PrivateTaxPlanResponse",
  "type": "object",
  "required": [
    "success",
    "data"
  ],
  "properties": {
    "success": {
      "type": "boolean",
      "const": true
    },
    "data": {
      "type": "object",
      "required": [
        "release",
        "revision",
        "state",
        "result"
      ],
      "properties": {
        "release": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "id",
            "companyId",
            "householdId",
            "releaseHash",
            "engineHash",
            "sourceHash",
            "approvedAt",
            "payload"
          ],
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "companyId": {
              "type": "string",
              "format": "uuid"
            },
            "householdId": {
              "type": "string",
              "format": "uuid"
            },
            "releaseHash": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "engineHash": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "sourceHash": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "approvedAt": {
              "type": "string",
              "format": "date-time"
            },
            "payload": {
              "type": "object",
              "description": "Immutable reviewed model payload verified by releaseHash. Includes scenario calculation graphs, input-field definitions, payment calendars, withholding tables, source cutoff, assumptions and opportunities. Its contents are specific to the named release.\n",
              "additionalProperties": true
            }
          }
        },
        "revision": {
          "type": "integer",
          "minimum": 0
        },
        "state": {
          "$ref": "#/$defs/PrivateTaxPlanScenario"
        },
        "result": {
          "$ref": "#/$defs/PrivateTaxPlanCalculation"
        }
      }
    }
  },
  "$defs": {
    "PrivateTaxPlanCalculation": {
      "type": "object",
      "required": [
        "values",
        "year",
        "payments",
        "withholdingMethod",
        "debtExcluded",
        "funding",
        "fundingRemaining",
        "remainingOwnerWages"
      ],
      "properties": {
        "values": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "year": {
          "type": "integer"
        },
        "payments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "agency",
              "year",
              "liabilityCents",
              "withholdingCents",
              "appliedCents",
              "catchUpCents",
              "additionalCents",
              "balanceCents",
              "rows"
            ],
            "properties": {
              "agency": {
                "type": "string"
              },
              "year": {
                "type": "integer"
              },
              "liabilityCents": {
                "type": "integer",
                "minimum": 0
              },
              "withholdingCents": {
                "type": "integer",
                "minimum": 0
              },
              "appliedCents": {
                "type": "integer",
                "minimum": 0
              },
              "catchUpCents": {
                "type": "integer",
                "minimum": 0
              },
              "additionalCents": {
                "type": "integer",
                "minimum": 0
              },
              "balanceCents": {
                "type": "integer"
              },
              "rows": {
                "type": "array",
                "minItems": 4,
                "maxItems": 4,
                "items": {
                  "type": "object",
                  "required": [
                    "date",
                    "amountCents"
                  ],
                  "properties": {
                    "date": {
                      "type": "string",
                      "format": "date"
                    },
                    "amountCents": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          }
        },
        "withholdingMethod": {
          "type": "string",
          "enum": [
            "salary-estimate",
            "entered-total",
            "actual-and-remaining"
          ]
        },
        "debtExcluded": {
          "type": "number",
          "minimum": 0
        },
        "health": {
          "type": "object",
          "required": [
            "credit",
            "repayment",
            "deduction"
          ],
          "properties": {
            "credit": {
              "type": "number",
              "minimum": 0
            },
            "repayment": {
              "type": "number",
              "minimum": 0
            },
            "deduction": {
              "type": "number",
              "minimum": 0
            }
          }
        },
        "funding": {
          "type": "object",
          "required": [
            "employee",
            "employer",
            "unclassified",
            "priorYearCash",
            "rollover"
          ],
          "properties": {
            "employee": {
              "type": "number",
              "minimum": 0
            },
            "employer": {
              "type": "number",
              "minimum": 0
            },
            "unclassified": {
              "type": "number",
              "minimum": 0
            },
            "priorYearCash": {
              "type": "number",
              "minimum": 0
            },
            "rollover": {
              "type": "number",
              "minimum": 0
            }
          }
        },
        "fundingRemaining": {
          "type": "object",
          "required": [
            "employee",
            "employer"
          ],
          "properties": {
            "employee": {
              "type": "number",
              "minimum": 0
            },
            "employer": {
              "type": "number",
              "minimum": 0
            }
          }
        },
        "remainingOwnerWages": {
          "type": "number",
          "minimum": 0
        }
      }
    },
    "PrivateTaxPlanScenario": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "scenarioId",
        "inputs",
        "payments",
        "withholding"
      ],
      "properties": {
        "scenarioId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 150
        },
        "inputs": {
          "type": "object",
          "propertyNames": {
            "maxLength": 100
          },
          "additionalProperties": {
            "type": "number",
            "minimum": -1000000000,
            "maximum": 1000000000
          }
        },
        "health": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "year",
            "householdSize",
            "otherMagi",
            "months"
          ],
          "properties": {
            "year": {
              "type": "integer",
              "minimum": 2026,
              "maximum": 2027
            },
            "householdSize": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            },
            "otherMagi": {
              "type": "number",
              "minimum": 0,
              "maximum": 1000000000
            },
            "months": {
              "type": "array",
              "minItems": 12,
              "maxItems": 12,
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "premium",
                  "benchmark",
                  "advance",
                  "eligible",
                  "deductible"
                ],
                "properties": {
                  "premium": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "benchmark": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "advance": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "eligible": {
                    "type": "boolean"
                  },
                  "deductible": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "debt": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "year",
            "discharged",
            "gross",
            "liabilities",
            "assets"
          ],
          "properties": {
            "year": {
              "type": "integer",
              "minimum": 2020,
              "maximum": 2100
            },
            "discharged": {
              "type": "boolean"
            },
            "gross": {
              "type": "number",
              "minimum": 0,
              "maximum": 1000000000
            },
            "liabilities": {
              "type": "number",
              "minimum": 0,
              "maximum": 1000000000
            },
            "assets": {
              "type": "number",
              "minimum": 0,
              "maximum": 1000000000
            }
          }
        },
        "funding": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "year",
              "paidDate",
              "type",
              "amount"
            ],
            "properties": {
              "year": {
                "type": "integer",
                "minimum": 2020,
                "maximum": 2100
              },
              "paidDate": {
                "type": "string",
                "format": "date",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "type": {
                "type": "string",
                "enum": [
                  "employee",
                  "employer",
                  "rollover",
                  "unclassified"
                ]
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000000000
              }
            }
          }
        },
        "payments": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "agency",
              "year",
              "date",
              "amountCents",
              "status"
            ],
            "properties": {
              "agency": {
                "type": "string",
                "enum": [
                  "federal-personal",
                  "state-personal",
                  "nyc-ubt",
                  "nyc-gct",
                  "nys-ptet",
                  "nyc-ptet"
                ]
              },
              "year": {
                "type": "integer",
                "minimum": 2020,
                "maximum": 2100
              },
              "date": {
                "type": "string",
                "format": "date",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "amountCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000000000
              },
              "status": {
                "type": "string",
                "enum": [
                  "paid",
                  "planned"
                ]
              }
            }
          }
        },
        "withholding": {
          "type": "object",
          "propertyNames": {
            "pattern": "^20\\d{2}$"
          },
          "additionalProperties": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "mode",
              "federalCents",
              "stateCents",
              "wagesPaidCents",
              "federalPaidCents"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "salary-estimate",
                  "entered-total",
                  "actual-and-remaining"
                ]
              },
              "federalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000000000
              },
              "stateCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000000000
              },
              "wagesPaidCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000000000
              },
              "federalPaidCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000000000
              }
            }
          }
        }
      }
    }
  }
}