{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/webman-package-recipe/latest.json",
  "title": "Webman package recipe",
  "description": "A package recipe for webman",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/candrewlee14/webman/main/schema/pkg_schema.json",
    "sourceSha256": "e165122841d61c9e14c4a6a2ebfa953e4d047ca1ea7e12083f2e3fd731fa2523",
    "fileMatch": [
      "*.webman-pkg.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "tagline": {
      "description": "Package tagline",
      "type": "string"
    },
    "about": {
      "description": "Package description",
      "type": "string"
    },
    "install_note": {
      "description": "Installation notes for this package",
      "type": "string"
    },
    "remove_note": {
      "description": "Removal notes for this package",
      "type": "string"
    },
    "info_url": {
      "description": "URL for information/documentation",
      "type": "string"
    },
    "releases_url": {
      "description": "URL for releases",
      "type": "string"
    },
    "base_download_url": {
      "description": "Base URL for downloading",
      "type": "string"
    },
    "git_user": {
      "description": "Git username",
      "type": "string"
    },
    "git_repo": {
      "description": "Git repository",
      "type": "string"
    },
    "gitea_url": {
      "description": "Gitea URL",
      "type": "string"
    },
    "source_url": {
      "description": "Source URL",
      "type": "string"
    },
    "filename_format": {
      "description": "Filename format",
      "type": "string"
    },
    "version_format": {
      "description": "Version format",
      "type": "string"
    },
    "latest_strategy": {
      "description": "Strategy for resolving latest release",
      "type": "string",
      "enum": [
        "github-release",
        "arch-linux-community",
        "gitea-release"
      ]
    },
    "force_latest": {
      "description": "Force latest release",
      "type": "boolean"
    },
    "allow_prerelease": {
      "description": "Allow pre-releases",
      "type": "boolean"
    },
    "arch_linux_pkg_name": {
      "description": "Arch Linux package name",
      "type": "string"
    },
    "os_map": {
      "description": "OS mappings",
      "type": "object",
      "properties": {
        "win": {
          "$ref": "#/$defs/os_mapping"
        },
        "macos": {
          "$ref": "#/$defs/os_mapping"
        },
        "linux": {
          "$ref": "#/$defs/os_mapping"
        }
      },
      "additionalProperties": false
    },
    "arch_map": {
      "description": "Architecture mappings",
      "type": "object",
      "properties": {
        "ppc64": {
          "type": "string"
        },
        "386": {
          "type": "string"
        },
        "amd64": {
          "type": "string"
        },
        "arm": {
          "type": "string"
        },
        "arm64": {
          "type": "string"
        },
        "wasm": {
          "type": "string"
        },
        "mips": {
          "type": "string"
        },
        "mips64": {
          "type": "string"
        },
        "mips64le": {
          "type": "string"
        },
        "mipsle": {
          "type": "string"
        },
        "ppc64le": {
          "type": "string"
        },
        "riscv64": {
          "type": "string"
        },
        "s390x": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "ignore": {
      "description": "Ignore mappings",
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "os",
          "arch"
        ],
        "properties": {
          "os": {
            "$ref": "#/$defs/os"
          },
          "arch": {
            "$ref": "#/$defs/arch"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "$defs": {
    "os": {
      "$comment": "go tool dist list",
      "description": "Operating system",
      "type": "string",
      "enum": [
        "win",
        "macos",
        "linux"
      ]
    },
    "arch": {
      "$comment": "go tool dist list",
      "description": "Architecture",
      "type": "string",
      "enum": [
        "ppc64",
        "386",
        "amd64",
        "arm",
        "arm64",
        "wasm",
        "mips",
        "mips64",
        "mips64le",
        "mipsle",
        "ppc64le",
        "riscv64",
        "s390x"
      ]
    },
    "os_mapping": {
      "description": "OS mapping",
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "ext": {
          "type": "string"
        },
        "bin_path": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "extract_has_root": {
          "description": "Extraction has root directory, generally the same name as the archive",
          "type": "boolean"
        },
        "is_raw_binary": {
          "description": "Download is a raw binary",
          "type": "boolean"
        },
        "filename_format_override": {
          "description": "Override for the global filename format",
          "type": "string"
        },
        "renames": {
          "description": "List of from-to pairs for renaming links to binaries",
          "type": "array",
          "items": {
            "properties": {
              "from": {
                "description": "string to replace",
                "type": "string"
              },
              "to": {
                "description": "string to insert",
                "type": "string"
              }
            }
          }
        },
        "install_note": {
          "description": "Installation notes for this OS",
          "type": "string"
        },
        "remove_note": {
          "description": "Removal notes for this OS",
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "anyOf": [
    {
      "properties": {
        "latest_strategy": {
          "const": "github-release"
        }
      },
      "required": [
        "git_user",
        "git_repo"
      ],
      "type": "object"
    },
    {
      "properties": {
        "latest_strategy": {
          "const": "arch-linux-community"
        }
      },
      "required": [
        "arch_linux_pkg_name"
      ],
      "type": "object"
    },
    {
      "properties": {
        "latest_strategy": {
          "const": "gitea-release"
        }
      },
      "required": [
        "git_user",
        "git_repo",
        "gitea_url"
      ],
      "type": "object"
    }
  ],
  "required": [
    "tagline",
    "about",
    "filename_format",
    "base_download_url",
    "latest_strategy",
    "os_map",
    "arch_map"
  ]
}
