{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.calculatorx.com/schemas/electrical.thermal.heatsink_rth/1.1.0/input.json",
  "title": "Heatsink Thermal Resistance — input",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "mode": {
      "type": "string",
      "enum": [
        "junction_effective_ja",
        "junction_heatsink_stack",
        "required_heatsink_sa",
        "rise",
        "rth"
      ],
      "description": "Canonical: junction_effective_ja | junction_heatsink_stack | required_heatsink_sa. Aliases: rise → junction_effective_ja, rth → required_heatsink_sa."
    },
    "Ta_C": {
      "type": "number",
      "description": "Ambient temperature (°C)"
    },
    "P_W": {
      "type": "number",
      "description": "Device power dissipation converted to heat (W). ≥ 0 on rise models; > 0 when solving θSA."
    },
    "Rth_JA": {
      "type": "number",
      "exclusiveMinimum": 0,
      "description": "Effective / application junction-to-ambient thermal resistance (°C/W ≡ K/W)"
    },
    "Rth_JC": {
      "type": "number",
      "exclusiveMinimum": 0,
      "description": "Junction-to-case thermal resistance (°C/W)"
    },
    "Rth_CS": {
      "type": "number",
      "minimum": 0,
      "description": "Case-to-sink / TIM interface thermal resistance (°C/W). 0 means the interface is neglected."
    },
    "Rth_SA": {
      "type": "number",
      "exclusiveMinimum": 0,
      "description": "Sink-to-ambient thermal resistance (°C/W) — the heatsink. Input on stack mode; output as Rth_SA_required on required mode."
    },
    "Tj_max_C": {
      "type": "number",
      "description": "Required on required_heatsink_sa. Optional on rise models for thermal margin."
    }
  },
  "required": [
    "Ta_C",
    "P_W"
  ],
  "oneOf": [
    {
      "title": "junction_effective_ja",
      "description": "Effective θJA rise: Tj = Ta + P·θJA. P ≥ 0.",
      "required": [
        "mode",
        "Rth_JA"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "junction_effective_ja",
            "rise"
          ]
        },
        "P_W": {
          "type": "number",
          "minimum": 0
        }
      },
      "allOf": [
        {
          "not": {
            "required": [
              "Rth_JC"
            ]
          }
        },
        {
          "not": {
            "required": [
              "Rth_CS"
            ]
          }
        },
        {
          "not": {
            "required": [
              "Rth_SA"
            ]
          }
        }
      ]
    },
    {
      "title": "junction_heatsink_stack",
      "description": "Explicit heatsink path: Tj = Ta + P·(θJC+θCS+θSA). P ≥ 0.",
      "required": [
        "mode",
        "Rth_JC",
        "Rth_CS",
        "Rth_SA"
      ],
      "properties": {
        "mode": {
          "const": "junction_heatsink_stack"
        },
        "P_W": {
          "type": "number",
          "minimum": 0
        }
      },
      "not": {
        "required": [
          "Rth_JA"
        ]
      }
    },
    {
      "title": "required_heatsink_sa",
      "description": "Required heatsink: θSA,max = (Tj,max−Ta)/P − θJC − θCS. P > 0.",
      "required": [
        "mode",
        "Tj_max_C",
        "Rth_JC",
        "Rth_CS"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "required_heatsink_sa",
            "rth"
          ]
        },
        "P_W": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "allOf": [
        {
          "not": {
            "required": [
              "Rth_JA"
            ]
          }
        },
        {
          "not": {
            "required": [
              "Rth_SA"
            ]
          }
        }
      ]
    }
  ],
  "description": "Junction temperature from effective θJA or θJC+θCS+θSA, or required heatsink θSA,max = (Tj,max−Ta)/P − θJC − θCS. (calculation_version 1.1.0)"
}
