{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/powerexpertindia-com/json-schema/powerexpertindia-com-sources-envelope-schema.json",
  "title": "SourcesEnvelope",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/powerexpertindia-com-openapi.json#/components/schemas/SourcesEnvelope",
  "allOf": [
    {
      "$ref": "#/$defs/SuccessEnvelope"
    },
    {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SourceRecord"
          }
        },
        "meta": {
          "type": "object",
          "required": [
            "state_code",
            "verification_tier",
            "source_ref_count",
            "schedule_rows_mapped",
            "source_raw_text_sha256"
          ],
          "properties": {
            "state_code": {
              "type": "string",
              "const": "BR"
            },
            "verification_tier": {
              "type": "string",
              "const": "verified_strict"
            },
            "source_ref_count": {
              "type": "integer",
              "minimum": 1
            },
            "schedule_rows_mapped": {
              "type": "integer",
              "const": 34
            },
            "source_raw_text_sha256": {
              "$ref": "#/$defs/Sha256"
            }
          }
        }
      }
    }
  ],
  "$defs": {
    "Sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "SourceRecord": {
      "type": "object",
      "required": [
        "source_ref",
        "state_code",
        "financial_year",
        "verification_tier",
        "release_id",
        "mapped_subcategory_codes",
        "mapped_category_labels",
        "mapped_section_numbers",
        "mapped_schedule_row_count"
      ],
      "properties": {
        "source_ref": {
          "type": "string",
          "pattern": "^src_[A-Za-z0-9_]+$"
        },
        "source_document_id": {
          "type": [
            "integer",
            "string",
            "null"
          ]
        },
        "document_id": {
          "type": [
            "integer",
            "string",
            "null"
          ]
        },
        "order_title": {
          "type": [
            "string",
            "null"
          ]
        },
        "order_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "financial_year": {
          "type": "string"
        },
        "effective_from": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "effective_to": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "page": {
          "type": [
            "integer",
            "string",
            "null"
          ]
        },
        "page_number": {
          "type": [
            "integer",
            "string",
            "null"
          ]
        },
        "table": {
          "type": [
            "string",
            "null"
          ]
        },
        "table_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "clause": {
          "type": [
            "string",
            "null"
          ]
        },
        "clause_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "verification_origin": {
          "type": [
            "string",
            "null"
          ]
        },
        "verification_tier": {
          "type": "string",
          "const": "verified_strict"
        },
        "source_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "official_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "raw_text_sha256": {
          "oneOf": [
            {
              "$ref": "#/$defs/Sha256"
            },
            {
              "type": "null"
            }
          ]
        },
        "evidence_sha256": {
          "oneOf": [
            {
              "$ref": "#/$defs/Sha256"
            },
            {
              "type": "null"
            }
          ]
        },
        "state_code": {
          "type": "string",
          "const": "BR"
        },
        "release_id": {
          "type": "string",
          "const": "BR-2026-27-VERIFIED-STRICT-BASE-V1"
        },
        "release_source_raw_text_sha256": {
          "$ref": "#/$defs/Sha256"
        },
        "mapped_subcategory_codes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "mapped_category_labels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "mapped_section_numbers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "mapped_schedule_row_count": {
          "type": "integer",
          "minimum": 1
        }
      },
      "additionalProperties": false
    },
    "SuccessEnvelope": {
      "type": "object",
      "required": [
        "status",
        "api_version",
        "request_id",
        "data",
        "meta"
      ],
      "properties": {
        "status": {
          "type": "string",
          "const": "ok"
        },
        "api_version": {
          "type": "string",
          "const": "PEI Verified Tariff API V1.2.0"
        },
        "request_id": {
          "type": "string",
          "pattern": "^req_[A-Za-z0-9]+$"
        },
        "data": [],
        "meta": {
          "type": "object"
        }
      }
    }
  }
}