{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.calculatorx.com/schemas/electrical.timer_555.output.json",
  "title": "555 Timer — success output",
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "astableResult": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "f_Hz",
        "period_s",
        "high_time_s",
        "low_time_s",
        "duty"
      ],
      "properties": {
        "mode": {
          "const": "astable"
        },
        "f_Hz": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Astable frequency (Hz) from f=1/T with T=ln(2)·(R1+2R2)·C"
        },
        "period_s": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Period T = 1/f (s)"
        },
        "high_time_s": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Output high time tH ≈ duty·T (s)"
        },
        "low_time_s": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Output low time tL ≈ (1−duty)·T (s)"
        },
        "duty": {
          "type": "number",
          "exclusiveMinimum": 0.5,
          "exclusiveMaximum": 1,
          "description": "Duty cycle fraction (R1+R2)/(R1+2R2); standard wiring > 50%"
        },
        "duty_pct": {
          "type": "number",
          "exclusiveMinimum": 50,
          "exclusiveMaximum": 100,
          "description": "Duty cycle percent = duty×100"
        },
        "warnings": {
          "type": "array",
          "description": "Structured notices (also mirrored on the API envelope warnings[])",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "severity": {
                "type": "string"
              },
              "detail": {
                "type": "string"
              },
              "suggestion": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "monostableResult": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "pulse_width_s"
      ],
      "properties": {
        "mode": {
          "const": "monostable"
        },
        "pulse_width_s": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Monostable pulse width tw ≈ 1.1·R·C (s)"
        },
        "pulse_width_ms": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Pulse width in milliseconds"
        },
        "warnings": {
          "type": "array",
          "description": "Structured notices (also mirrored on the API envelope warnings[])",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "severity": {
                "type": "string"
              },
              "detail": {
                "type": "string"
              },
              "suggestion": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "calcResult": {
      "oneOf": [
        {
          "$ref": "#/$defs/astableResult"
        },
        {
          "$ref": "#/$defs/monostableResult"
        }
      ]
    }
  },
  "required": [
    "status",
    "capability_id",
    "engine",
    "inputs",
    "result",
    "result_detail",
    "calculation_version",
    "verification"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Requested tool id"
    },
    "status": {
      "const": "success"
    },
    "capability_id": {
      "const": "electrical.timer_555"
    },
    "tool": {
      "type": "string",
      "description": "Requested tool id"
    },
    "engine": {
      "type": "string"
    },
    "inputs": {
      "description": "Canonical echoed inputs after mode discrimination. Astable uses R1/R2/C; monostable uses R/C.",
      "type": "object",
      "oneOf": [
        {
          "title": "astable",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "mode",
            "R1",
            "R2",
            "C"
          ],
          "properties": {
            "mode": {
              "const": "astable"
            },
            "R1": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "R2": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "C": {
              "type": "number",
              "exclusiveMinimum": 0
            }
          }
        },
        {
          "title": "monostable",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "mode",
            "R",
            "C"
          ],
          "properties": {
            "mode": {
              "const": "monostable"
            },
            "R": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "C": {
              "type": "number",
              "exclusiveMinimum": 0
            }
          }
        }
      ]
    },
    "result": {
      "$ref": "#/$defs/calcResult"
    },
    "result_detail": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "value",
        "unit",
        "formatted"
      ],
      "properties": {
        "value": {
          "$ref": "#/$defs/calcResult"
        },
        "unit": {
          "type": [
            "string",
            "null"
          ]
        },
        "formatted": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "formula": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "string"
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string"
            },
            "expression": {
              "type": "string"
            },
            "label": {
              "type": "string"
            }
          }
        }
      ]
    },
    "assumptions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "severity": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "suggestion": {
            "type": "string"
          }
        }
      }
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "tier",
        "engine_tested",
        "expert_reviewed",
        "source_checked",
        "reviewed_by",
        "reviewer_role",
        "last_reviewed"
      ],
      "properties": {
        "tier": {
          "type": "string",
          "enum": [
            "candidate",
            "engine_tested",
            "internally_reviewed",
            "expert_verified"
          ]
        },
        "engine_tested": {
          "type": "boolean"
        },
        "expert_reviewed": {
          "type": "boolean"
        },
        "internally_reviewed": {
          "type": "boolean"
        },
        "review_kind": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_checked": {
          "type": "boolean"
        },
        "reviewed_by": {
          "type": [
            "string",
            "null"
          ]
        },
        "reviewer_role": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_reviewed": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "tier": {
                "const": "expert_verified"
              }
            },
            "required": [
              "tier"
            ]
          },
          "then": {
            "properties": {
              "engine_tested": {
                "const": true
              },
              "expert_reviewed": {
                "const": true
              },
              "source_checked": {
                "const": true
              },
              "reviewed_by": {
                "type": "string",
                "minLength": 1
              },
              "reviewer_role": {
                "type": "string",
                "minLength": 1
              },
              "last_reviewed": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "tier": {
                "const": "internally_reviewed"
              }
            },
            "required": [
              "tier"
            ]
          },
          "then": {
            "properties": {
              "engine_tested": {
                "const": true
              },
              "internally_reviewed": {
                "const": true
              },
              "source_checked": {
                "const": true
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "tier": {
                "const": "engine_tested"
              }
            },
            "required": [
              "tier"
            ]
          },
          "then": {
            "properties": {
              "engine_tested": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "calculation_version": {
      "type": "string",
      "const": "1.2.0"
    },
    "api_version": {
      "type": "string"
    },
    "api_contract_version": {
      "type": "string"
    },
    "spec_version": {
      "type": "string"
    },
    "page": {
      "type": [
        "string",
        "null"
      ],
      "description": "Canonical calculator page URL"
    },
    "links": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_input": {
          "type": "string",
          "format": "uri"
        },
        "schema_output": {
          "type": "string",
          "format": "uri"
        },
        "evidence": {
          "type": "string",
          "format": "uri"
        },
        "openapi": {
          "type": "string",
          "format": "uri"
        },
        "capabilities": {
          "type": "string",
          "format": "uri"
        },
        "mcp": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
