{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/chadwin/json-schema/chadwin-company-kpis-response-schema.json",
  "title": "CompanyKpisResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/chadwin-company-kpis-api-openapi.yml#/components/schemas/CompanyKpisResponse",
  "type": "object",
  "properties": {
    "issuer": {
      "type": "object",
      "properties": {
        "cik": {
          "type": "string",
          "pattern": "^[0-9]{10}$"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "ticker": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "cik",
        "name",
        "ticker"
      ],
      "additionalProperties": false
    },
    "periods": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CompanyKpiPeriod"
      },
      "description": "Completed reviews only. An empty kpis array means the period was reviewed and no eligible values were found. An omitted period has not completed review."
    }
  },
  "required": [
    "issuer",
    "periods"
  ],
  "additionalProperties": false,
  "$defs": {
    "CompanyKpi": {
      "type": "object",
      "properties": {
        "kpi_id": {
          "type": "string",
          "pattern": "^[0-9]{10}\\.[a-z][a-z0-9]*(_[a-z0-9]+)*$"
        },
        "group": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "definition": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "unit": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "period_end_date": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Reported fiscal-period end date, or null if unavailable. Independent of source filing dates."
        },
        "value": {
          "type": "string",
          "pattern": "^(?!-0(?:\\.0+)?$)-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
          "description": "Unscaled exact decimal string. Currency uses base units, counts use the stated entity, percentages use percentage points. No exponent notation or negative zero."
        },
        "value_operator": {
          "type": "string",
          "enum": [
            "eq",
            "gt",
            "gte",
            "lt",
            "lte",
            "approx"
          ],
          "description": "eq: unqualified reported amount; gt/lt: strict bounds; gte/lte: inclusive bounds; approx: explicitly approximate disclosure. Display rounding alone does not imply approx. Two-sided ranges are outside this response."
        },
        "source": {
          "$ref": "#/$defs/CompanyKpiSource"
        }
      },
      "required": [
        "kpi_id",
        "group",
        "name",
        "definition",
        "unit",
        "period_end_date",
        "value",
        "value_operator",
        "source"
      ],
      "additionalProperties": false
    },
    "CompanyKpiPeriod": {
      "type": "object",
      "properties": {
        "fiscal_year": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "fiscal_period": {
          "type": "string",
          "enum": [
            "FY",
            "H1",
            "H2",
            "Q1",
            "Q2",
            "Q3",
            "Q4"
          ]
        },
        "kpis": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CompanyKpi"
          }
        }
      },
      "required": [
        "fiscal_year",
        "fiscal_period",
        "kpis"
      ],
      "additionalProperties": false
    },
    "CompanyKpiSource": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "sec_filing"
          ]
        },
        "form": {
          "type": "string",
          "enum": [
            "10-K",
            "10-K/A",
            "10-Q",
            "10-Q/A",
            "20-F",
            "20-F/A",
            "40-F",
            "40-F/A",
            "8-K",
            "8-K/A",
            "6-K",
            "6-K/A"
          ]
        },
        "accession_number": {
          "type": "string",
          "pattern": "^[0-9]{10}-[0-9]{2}-[0-9]{6}$"
        },
        "document": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
          "description": "Exact filename in the original SEC filing package, including substantive exhibits. Independent of Chadwin report rendering."
        },
        "location": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S",
          "description": "Human-readable section, table or passage in the original SEC document."
        },
        "xbrl_concept": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "pattern": "\\S"
        }
      },
      "required": [
        "type",
        "form",
        "accession_number",
        "document",
        "location",
        "xbrl_concept"
      ],
      "additionalProperties": false
    }
  }
}