{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://starkscan.co/schemas/starkscan-verification-submission-request-v1.schema.json",
  "title": "Starkscan public exact-verification Package V1 metadata",
  "description": "Metadata committed before the exact deterministic source archive is uploaded to the public asynchronous verification service. Acceptance is not a verification result.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "selectedClassHash",
    "uploadDigest",
    "uploadByteLength",
    "toolchainPolicyId",
    "packageName",
    "buildProfile",
    "targetKind",
    "targetName",
    "artifactId",
    "modulePath",
    "sourceVisibility",
    "retentionPolicyId"
  ],
  "properties": {
    "selectedClassHash": {"$ref": "#/$defs/canonicalStarknetClassHash"},
    "uploadDigest": {"$ref": "#/$defs/digest"},
    "uploadByteLength": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10485760,
      "description": "Mathematically integral JSON decimal and exponent spellings are normalized to the canonical unsigned base-10 integer before validation and idempotency processing."
    },
    "toolchainPolicyId": {"const": "starkscan-exact-v25"},
    "packageName": {"type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$"},
    "buildProfile": {"const": "release"},
    "targetKind": {"const": "starknet-contract"},
    "targetName": {"$ref": "#/$defs/selector"},
    "artifactId": {"$ref": "#/$defs/selector"},
    "modulePath": {"$ref": "#/$defs/selector"},
    "sourceVisibility": {
      "enum": ["private", "public"],
      "description": "Public selects public-30d-v1 intake retention; Package V1 does not publish source or record redistribution rights."
    },
    "retentionPolicyId": {
      "enum": ["private-24h-v1", "private-7d-v1", "public-30d-v1"],
      "description": "Source-retention policy. Source publication is a separate explicit contract and is not implemented by Package V1."
    }
  },
  "allOf": [
    {
      "if": {"properties": {"sourceVisibility": {"const": "public"}}, "required": ["sourceVisibility"]},
      "then": {"properties": {"retentionPolicyId": {"const": "public-30d-v1"}}},
      "else": {"properties": {"retentionPolicyId": {"enum": ["private-24h-v1", "private-7d-v1"]}}}
    }
  ],
  "$defs": {
    "digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
    "canonicalStarknetClassHash": {
      "type": "string",
      "description": "A nonzero lowercase canonical Starknet field element with no leading zero, strictly less than 0x800000000000011000000000000000000000000000000000000000000000001.",
      "pattern": "^0x(?:[1-7][0-9a-f]{0,62}|[89a-f][0-9a-f]{0,61}|80{12}(?:0[0-9a-f]{49}|10[0-9a-f]{48}|110{48}))$"
    },
    "selector": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:/-]{0,255}$"}
  }
}
