{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "https://schema.hagicode.com/schemas/manifest/v1.schema.json",
  "title": "Package Manifest",
  "type": "object",
  "description": "Hagicode \u5E73\u53F0\u5305\u6E05\u5355\u4E3B\u6587\u4EF6\uFF0C\u5305\u542B\u5305\u4FE1\u606F\u3001\u4F9D\u8D56\u5173\u7CFB\u548C\u6587\u4EF6\u6E05\u5355\u5F15\u7528",
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": [
        "null",
        "string"
      ]
    },
    "manifestVersion": {
      "type": "string"
    },
    "package": {
      "$ref": "#/definitions/PackageInfo"
    },
    "dependencies": {
      "$ref": "#/definitions/DependenciesInfo"
    },
    "files": {
      "type": [
        "array",
        "null"
      ],
      "x-deprecated": true,
      "x-deprecatedMessage": "Use FilesReference instead. This property is kept for backward compatibility.",
      "items": {
        "$ref": "#/definitions/ManifestFile"
      }
    },
    "filesReference": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/FilesReferenceInfo"
        }
      ]
    },
    "metadata": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/MetadataInfo"
        }
      ]
    },
    "entryPoint": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/EntryPointInfo"
        }
      ]
    },
    "desktopCompatibility": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/DesktopCompatibilityInfo"
        }
      ]
    }
  },
  "definitions": {
    "PackageInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "buildTimestamp": {
          "type": "string"
        },
        "buildNumber": {
          "type": [
            "null",
            "string"
          ]
        },
        "gitCommit": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "DependenciesInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "node": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/definitions/SystemRuntimeDependency"
            }
          ]
        },
        "openspec": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/definitions/NpmPackageDependency"
            }
          ]
        },
        "system": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/definitions/SystemRequirementDependency"
            }
          ]
        }
      }
    },
    "SystemRuntimeDependency": {
      "allOf": [
        {
          "$ref": "#/definitions/DependencyInfo"
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "version": {
              "$ref": "#/definitions/RuntimeVersionInfo"
            },
            "installHint": {
              "type": [
                "null",
                "string"
              ]
            }
          }
        }
      ]
    },
    "RuntimeVersionInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "min": {
          "type": "string"
        },
        "max": {
          "type": [
            "null",
            "string"
          ]
        },
        "exact": {
          "type": [
            "null",
            "string"
          ]
        },
        "recommended": {
          "type": [
            "null",
            "string"
          ]
        },
        "description": {
          "type": [
            "null",
            "string"
          ]
        },
        "runtime": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/definitions/RuntimeVersionDetails"
            }
          ]
        }
      }
    },
    "RuntimeVersionDetails": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "min": {
          "type": "string"
        },
        "max": {
          "type": [
            "null",
            "string"
          ]
        },
        "exact": {
          "type": [
            "null",
            "string"
          ]
        },
        "recommended": {
          "type": [
            "null",
            "string"
          ]
        },
        "description": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "DependencyInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "NpmPackageDependency": {
      "allOf": [
        {
          "$ref": "#/definitions/DependencyInfo"
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "version": {
              "$ref": "#/definitions/PackageVersionInfo"
            }
          }
        }
      ]
    },
    "PackageVersionInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "min": {
          "type": "string"
        },
        "max": {
          "type": [
            "null",
            "string"
          ]
        },
        "exact": {
          "type": [
            "null",
            "string"
          ]
        },
        "recommended": {
          "type": [
            "null",
            "string"
          ]
        },
        "description": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "SystemRequirementDependency": {
      "allOf": [
        {
          "$ref": "#/definitions/DependencyInfo"
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "operatingSystems": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "architecture": {
              "type": "string"
            },
            "minimumDiskSpace": {
              "type": [
                "null",
                "string"
              ]
            },
            "minimumMemory": {
              "type": [
                "null",
                "string"
              ]
            }
          }
        }
      ]
    },
    "ManifestFile": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string"
        },
        "size": {
          "type": "integer",
          "format": "int64"
        },
        "checksum": {
          "type": "string"
        },
        "checksumAlgorithm": {
          "type": "string"
        }
      }
    },
    "FilesReferenceInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string"
        },
        "checksum": {
          "type": "string"
        },
        "format": {
          "type": "string"
        },
        "count": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "MetadataInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": [
            "null",
            "string"
          ]
        },
        "author": {
          "type": [
            "null",
            "string"
          ]
        },
        "license": {
          "type": [
            "null",
            "string"
          ]
        },
        "homepage": {
          "type": [
            "null",
            "string"
          ]
        },
        "documentation": {
          "type": [
            "null",
            "string"
          ]
        },
        "repository": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "EntryPointInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "start": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "DesktopCompatibilityInfo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "minVersion": {
          "type": "string"
        },
        "message": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    }
  }
}