{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://botshelfvampire.com/schemas/demand-request-v0.1.json",
  "title": "BSV Demand Request",
  "type": "object",
  "required": [
    "schemaVersion",
    "requestId",
    "job",
    "domains",
    "visibility",
    "status",
    "createdAt"
  ],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "const": "0.1"
    },
    "requestId": {
      "type": "string",
      "pattern": "^req_[a-z0-9_-]+$"
    },
    "job": {
      "type": "string",
      "minLength": 20,
      "maxLength": 2000
    },
    "domains": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    },
    "platforms": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "desiredInputs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "desiredOutputs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "freeSolutionAcceptable": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "willingnessToPay": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "min": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "max": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "currency": {
          "type": "string"
        }
      }
    },
    "deadline": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "visibility": {
      "enum": [
        "PUBLIC",
        "PRIVATE"
      ]
    },
    "status": {
      "enum": [
        "OPEN",
        "CLAIMED",
        "FULFILLED",
        "CLOSED",
        "REJECTED"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "fulfilledByCapabilityId": {
      "type": [
        "string",
        "null"
      ]
    },
    "evidenceSignals": {
      "type": "object",
      "properties": {
        "uniqueRequesters": {
          "type": "integer",
          "minimum": 0
        },
        "noResultSearches": {
          "type": "integer",
          "minimum": 0
        },
        "explicitWtpCount": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  }
}
