{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://buildchain.libkungfu.dev/schemas/kfd-product-gate-input-v1.schema.json",
  "title": "Buildchain KFD product gate input v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "contract",
    "standard",
    "standardRevision",
    "source",
    "evidenceCut",
    "records",
    "evidence",
    "responsibility",
    "nonClaims"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "contract": {
      "const": "kungfu-buildchain-kfd-product-gate-input"
    },
    "standard": {
      "enum": [
        "kfd-4",
        "kfd-5",
        "kfd-7"
      ]
    },
    "standardRevision": {
      "type": "integer",
      "minimum": 1
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "repository",
        "sha"
      ],
      "properties": {
        "repository": {
          "type": "string",
          "minLength": 1
        },
        "sha": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}(?:[0-9a-f]{24})?$"
        }
      }
    },
    "evidenceCut": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "generatedAt",
        "expiresAt"
      ],
      "properties": {
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "records": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "role",
          "path",
          "sha256"
        ],
        "properties": {
          "role": {
            "type": "string",
            "minLength": 1
          },
          "path": {
            "type": "string",
            "minLength": 1
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      }
    },
    "evidence": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "kind",
          "path",
          "sha256"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "path": {
            "type": "string",
            "minLength": 1
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      }
    },
    "responsibility": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "owner",
        "evidenceOwner",
        "proofOwner"
      ],
      "properties": {
        "owner": {
          "type": "string",
          "minLength": 1
        },
        "evidenceOwner": {
          "type": "string",
          "minLength": 1
        },
        "proofOwner": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "nonClaims": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    }
  }
}
