{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://genesiscode.org/spec/numeric-profile-v0.1.schema.json",
  "title": "GenesisCode Numeric Profile v0.1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "auditDate",
    "backends",
    "canonicalSpec",
    "canonicalSpecSha256",
    "contentIdentitySha256",
    "decimal",
    "float",
    "integer",
    "kind",
    "nonclaims",
    "schema",
    "schemaSha256",
    "sourceBindings",
    "version"
  ],
  "properties": {
    "auditDate": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"},
    "backends": {
      "type": "object",
      "additionalProperties": false,
      "required": ["compiledAst", "gcWasm", "gpu", "reference", "stage1", "stage2"],
      "properties": {
        "compiledAst": {"const": "reference-equivalent"},
        "gcWasm": {"const": "inherits-gc-kernel-reference"},
        "gpu": {"const": "no-core-arithmetic-v0.2"},
        "reference": {"const": "gc-kernel-arbitrary-precision"},
        "stage1": {"const": "arbitrary-precision-no-narrowing"},
        "stage2": {"const": "i64-candidate-exact-translation-validation-required-before-emission"}
      }
    },
    "canonicalSpec": {"const": "docs/spec/NUMERIC_PROFILE_v0.1.md"},
    "canonicalSpecSha256": {"$ref": "#/$defs/sha256"},
    "contentIdentitySha256": {"$ref": "#/$defs/sha256"},
    "decimal": {
      "type": "object",
      "additionalProperties": false,
      "required": ["canonicalEncoding", "canonicalString", "constructors", "errorCodes", "grammar", "maxScale", "normalization", "operations", "representation", "unsupported"],
      "properties": {
        "canonicalEncoding": {"const": "{:num/kind :fixed-decimal :num/scale Int :num/unscaled Int}"},
        "canonicalString": {"const": "ordinary-decimal-no-exponent-no-redundant-fractional-zeroes"},
        "constructors": {"const": ["dec/from-int", "dec/parse"]},
        "errorCodes": {
          "type": "object",
          "additionalProperties": false,
          "required": ["invalidNumericInput", "wrongType"],
          "properties": {
            "invalidNumericInput": {"const": "core/numeric-error"},
            "wrongType": {"const": "core/type-error"}
          }
        },
        "grammar": {"const": "[+-]?[0-9]+(\\.[0-9]+)?"},
        "maxScale": {"const": 4096},
        "normalization": {"const": "zero-scale-zero-and-remove-trailing-fractional-zeroes"},
        "operations": {"const": ["dec/add", "dec/eq?", "dec/from-int", "dec/lt?", "dec/mul", "dec/parse", "dec/sub", "dec/to-str"]},
        "representation": {"const": "opaque-Dec-over-canonical-map"},
        "unsupported": {"const": ["decimal-div", "decimal-literal", "exponent-syntax", "implicit-int-coercion", "rounding"]}
      }
    },
    "float": {
      "type": "object",
      "additionalProperties": false,
      "required": ["coreStatus", "hostBoundary", "semantics"],
      "properties": {
        "coreStatus": {"const": "unsupported"},
        "hostBoundary": {"const": "profile-scoped-bytes-or-data-not-core-number"},
        "semantics": {"const": ["no-infinity", "no-nan", "no-rounding-mode", "no-signed-zero", "no-subnormal"]}
      }
    },
    "integer": {
      "type": "object",
      "additionalProperties": false,
      "required": ["canonicalSerialization", "division", "grammar", "operations", "overflow", "representation", "zeroDivisorError"],
      "properties": {
        "canonicalSerialization": {"const": "normalized-base10-no-leading-zeroes"},
        "division": {"const": "euclidean-a=b*q+r-and-0<=r<abs(b)"},
        "grammar": {"const": "-?[0-9]+"},
        "operations": {"const": ["int/add", "int/div", "int/eq?", "int/lt?", "int/mod", "int/mul", "int/sub", "int/to-str"]},
        "overflow": {"const": "impossible-promote-never-wrap-saturate-or-trap"},
        "representation": {"const": "arbitrary-precision-signed"},
        "zeroDivisorError": {"const": "core/numeric-error"}
      }
    },
    "kind": {"const": "genesis/numeric-profile-v0.1"},
    "nonclaims": {"$ref": "#/$defs/nonemptyStrings"},
    "schema": {"const": "docs/spec/NUMERIC_PROFILE_v0.1.schema.json"},
    "schemaSha256": {"$ref": "#/$defs/sha256"},
    "sourceBindings": {
      "type": "array",
      "minItems": 9,
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "mode", "path"],
        "properties": {
          "id": {"type": "string", "minLength": 1},
          "mode": {"enum": ["canonical-data", "compiled", "optimizer", "prelude", "reference", "selfhost-preview", "type-inference", "wasm-inherited-reference", "wasm-validated-candidate"]},
          "path": {"type": "string", "minLength": 1}
        }
      }
    },
    "version": {"const": "0.1"}
  },
  "$defs": {
    "nonemptyStrings": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {"type": "string", "minLength": 1}
    },
    "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
  }
}
