{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://smmods.com/api/v1/publishing/upload-submission.schema.json",
  "title": "SMMODS Upload Submission Status",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "submissionId",
    "ownerAccountId",
    "modId",
    "version",
    "state",
    "packageFileName",
    "packageBytes",
    "packageSha256",
    "validationChecks",
    "review",
    "links",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "schema": {
      "const": "smmods.upload-submission.v1"
    },
    "submissionId": {
      "type": "string",
      "minLength": 1
    },
    "ownerAccountId": {
      "type": "string",
      "minLength": 1
    },
    "modId": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{1,63}$"
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:[-+][A-Za-z0-9.-]+)?$"
    },
    "state": {
      "enum": [
        "draft",
        "uploaded",
        "validating",
        "validation_failed",
        "cancelled",
        "pending_review",
        "changes_requested",
        "approved",
        "published",
        "rejected",
        "hidden",
        "superseded"
      ]
    },
    "packageFileName": {
      "type": "string",
      "minLength": 1
    },
    "packageBytes": {
      "type": "integer",
      "minimum": 1
    },
    "packageSha256": {
      "type": "string",
      "pattern": "^[A-Fa-f0-9]{64}$"
    },
    "targetGameBuild": {
      "type": "string",
      "pattern": "^[0-9]+$"
    },
    "dependencies": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "minLength": 1
      }
    },
    "validationChecks": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "message"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "enum": [
              "pending",
              "running",
              "passed",
              "failed",
              "skipped"
            ]
          },
          "message": {
            "type": "string"
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finishedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "details": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "review": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "notes"
      ],
      "properties": {
        "status": {
          "enum": [
            "not_ready",
            "pending_review",
            "approved",
            "rejected",
            "changes_requested",
            "hidden",
            "superseded"
          ]
        },
        "reviewerAccountId": {
          "type": [
            "string",
            "null"
          ]
        },
        "notes": {
          "type": "string"
        },
        "updatedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "links": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "self"
      ],
      "properties": {
        "self": {
          "type": "string",
          "pattern": "^https://smmods\\.com/api/v1/uploads/"
        },
        "detailUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "versionsUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "artifactUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "catalogUrl": {
          "const": "https://smmods.com/api/v1/catalog.json"
        }
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}
