{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:sitla:job-requests:1:schema:job-request",
  "$comment": "SPDX-License-Identifier: CC0-1.0. Current JPY-only admission shape; signature, status, rights and temporal verification remain separate.",
  "type": "object",
  "properties": {
    "@context": {
      "type": "array",
      "minItems": 1,
      "contains": {
        "const": "https://www.w3.org/ns/credentials/v2"
      },
      "items": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "object"
          }
        ]
      }
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
    },
    "type": {
      "const": [
        "VerifiableCredential",
        "urn:sitla:credential:JobRequest:1"
      ]
    },
    "issuer": {
      "type": "string",
      "pattern": "^did:sitla:"
    },
    "validFrom": {
      "type": "string",
      "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.\\d{3})?Z$"
    },
    "validUntil": {
      "type": "string",
      "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.\\d{3})?Z$"
    },
    "licenses": {
      "const": [
        "CC0-1.0"
      ]
    },
    "didAllowList": {
      "const": []
    },
    "credentialStatus": {
      "type": "object"
    },
    "credentialSubject": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^did:sitla:"
        },
        "claims": {
          "type": "object",
          "properties": {
            "estimatedExpenses": {
              "$ref": "#/$defs/money"
            },
            "reward": {
              "allOf": [
                {
                  "$ref": "#/$defs/money"
                },
                {
                  "type": "object",
                  "properties": {
                    "amountMinor": {
                      "type": "integer",
                      "minimum": 500
                    }
                  }
                }
              ]
            },
            "completionLicenses": {
              "type": "array",
              "minItems": 1,
              "maxItems": 100,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2048
              },
              "anyOf": [
                {
                  "const": [
                    "CC0-1.0"
                  ]
                },
                {
                  "contains": {
                    "const": "LicenseRef-SITLA-Internal-1.0"
                  },
                  "not": {
                    "contains": {
                      "const": "CC0-1.0"
                    }
                  }
                }
              ]
            },
            "eligibility": {
              "type": "string",
              "maxLength": 8192
            },
            "desiredDueAt": {
              "type": "string",
              "pattern": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.\\d{3})?Z$"
            },
            "summary": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "details": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32768
            },
            "extensions": {
              "type": "object"
            }
          },
          "required": [
            "estimatedExpenses",
            "reward",
            "completionLicenses",
            "eligibility",
            "desiredDueAt",
            "summary",
            "details",
            "extensions"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "id",
        "claims"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "@context",
    "id",
    "type",
    "issuer",
    "validFrom",
    "validUntil",
    "licenses",
    "credentialSubject"
  ],
  "additionalProperties": false,
  "$defs": {
    "money": {
      "type": "object",
      "properties": {
        "amountMinor": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "currency": {
          "const": "JPY"
        },
        "currencyExponent": {
          "const": 0
        }
      },
      "required": [
        "amountMinor",
        "currency",
        "currencyExponent"
      ],
      "additionalProperties": false
    }
  }
}
