{
  "schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/FabinGurung/JP_Cost_Estimation/blob/research/open-estimation-engine-v0.1/templates/calculation-notes/v1/manifest.schema.json",
  "title": "A9 Calculation Note Source Manifest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "documentId",
    "projectId",
    "organizationId",
    "workItemId",
    "workType",
    "sourceEvidenceId",
    "sourceRevision",
    "status",
    "unit",
    "review"
  ],
  "properties": {
    "schema": {
      "const": "jp.calculation-note.manifest.v1"
    },
    "documentId": {
      "type": "string",
      "minLength": 3
    },
    "projectId": {
      "type": "string",
      "minLength": 3
    },
    "organizationId": {
      "type": "string",
      "minLength": 2
    },
    "workItemId": {
      "type": "string",
      "minLength": 2
    },
    "workType": {
      "type": "string",
      "minLength": 2
    },
    "sourceEvidenceId": {
      "type": "string",
      "minLength": 3
    },
    "sourceRevision": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "enum": [
        "CAPTURED",
        "WORKING_DRAFT",
        "VERIFIED",
        "APPROVED",
        "REJECTED",
        "SUPERSEDED"
      ]
    },
    "unit": {
      "type": [
        "string",
        "null"
      ]
    },
    "quantity": {
      "type": [
        "number",
        "null"
      ],
      "exclusiveMinimum": 0
    },
    "review": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "reviewer",
        "date",
        "decision"
      ],
      "properties": {
        "reviewer": {
          "type": [
            "string",
            "null"
          ]
        },
        "date": {
          "type": [
            "string",
            "null"
          ]
        },
        "decision": {
          "enum": [
            "PENDING",
            "ACCEPTED",
            "REJECTED"
          ]
        }
      }
    },
    "relatedOriginalUri": {
      "type": [
        "string",
        "null"
      ]
    },
    "contentSha256": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[a-f0-9]{64}$"
    },
    "notes": {
      "type": "string"
    }
  }
}
