{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jpegconvert.com/data/upload-requirements/v1/catalog.schema.json",
  "title": "JPEGConvert upload requirements catalog v1",
  "description": "Selected source-linked upload requirements and default local-check links. This resource does not execute conversions or guarantee destination acceptance. Dates are ISO calendar dates; effectiveUntil is inclusive. sourceCheckedThrough is the latest recorded profile review, not the freshness of every record.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schemaVersion",
    "id",
    "siteUrl",
    "asOf",
    "sourceCheckedThrough",
    "referenceUrl",
    "documentationUrl",
    "coverage",
    "profiles"
  ],
  "properties": {
    "$schema": {
      "const": "https://jpegconvert.com/data/upload-requirements/v1/catalog.schema.json"
    },
    "schemaVersion": {
      "const": 1
    },
    "id": {
      "const": "https://jpegconvert.com/data/upload-requirements/v1/catalog.json"
    },
    "siteUrl": {
      "const": "https://jpegconvert.com"
    },
    "asOf": {
      "type": "string",
      "format": "date"
    },
    "sourceCheckedThrough": {
      "type": "string",
      "format": "date"
    },
    "referenceUrl": {
      "const": "/upload-requirements"
    },
    "documentationUrl": {
      "const": "/upload-requirements/data"
    },
    "coverage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "description",
        "sourceReviewMeaning",
        "ruleKinds",
        "defaultChecks",
        "byteNormalization",
        "acceptance",
        "toolLimits",
        "sourceTerms"
      ],
      "properties": {
        "description": {
          "type": "string",
          "minLength": 3
        },
        "sourceReviewMeaning": {
          "type": "string",
          "minLength": 3
        },
        "ruleKinds": {
          "type": "string",
          "minLength": 3
        },
        "defaultChecks": {
          "type": "string",
          "minLength": 3
        },
        "byteNormalization": {
          "type": "string",
          "minLength": 3
        },
        "acceptance": {
          "type": "string",
          "minLength": 3
        },
        "toolLimits": {
          "type": "string",
          "minLength": 3
        },
        "sourceTerms": {
          "type": "string",
          "minLength": 3
        }
      }
    },
    "profiles": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/profile"
      }
    }
  },
  "$defs": {
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "publisher",
        "title",
        "url",
        "official"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "publisher": {
          "type": "string",
          "minLength": 3
        },
        "title": {
          "type": "string",
          "minLength": 3
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "official": {
          "const": true
        },
        "language": {
          "type": "string",
          "pattern": "^[a-zA-Z]{2,3}(?:-[a-zA-Z0-9]{2,8})*$"
        },
        "publishedOn": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "format": "date"
            }
          ]
        },
        "reviewedOn": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "rule": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "kind",
        "label",
        "description",
        "sourceIds",
        "check"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "kind": {
          "enum": [
            "requirement",
            "recommendation",
            "guidance"
          ]
        },
        "label": {
          "type": "string",
          "minLength": 3
        },
        "description": {
          "type": "string",
          "minLength": 3
        },
        "sourceIds": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/id"
          },
          "description": "IDs in the containing profile sources array. These references must resolve."
        },
        "check": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/check"
            }
          ]
        },
        "effectiveFrom": {
          "type": "string",
          "format": "date"
        },
        "effectiveUntil": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "check": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "coverage",
            "maxBytes",
            "displayValue",
            "byteBasis",
            "normalizationNote"
          ],
          "properties": {
            "type": {
              "const": "file-size"
            },
            "coverage": {
              "enum": [
                "complete",
                "partial",
                "format-limited"
              ]
            },
            "coverageNote": {
              "type": "string",
              "minLength": 3
            },
            "applicableFormats": {
              "type": "array",
              "minItems": 1,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9]+$"
              }
            },
            "maxBytes": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "displayValue": {
              "type": "string",
              "minLength": 3
            },
            "byteBasis": {
              "enum": [
                "decimal",
                "binary",
                "source-defined"
              ]
            },
            "normalizationNote": {
              "type": "string",
              "minLength": 20
            },
            "sourceUnitDefinition": {
              "type": "string",
              "minLength": 3
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "coverage": {
                    "enum": [
                      "partial",
                      "format-limited"
                    ]
                  }
                }
              },
              "then": {
                "required": [
                  "coverageNote"
                ],
                "properties": {
                  "coverageNote": {}
                }
              }
            }
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "coverage",
            "allowedFormats"
          ],
          "properties": {
            "type": {
              "const": "formats"
            },
            "coverage": {
              "enum": [
                "complete",
                "partial",
                "format-limited"
              ]
            },
            "coverageNote": {
              "type": "string",
              "minLength": 3
            },
            "applicableFormats": {
              "type": "array",
              "minItems": 1,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9]+$"
              }
            },
            "allowedFormats": {
              "type": "array",
              "minItems": 1,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9]+$"
              }
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "coverage": {
                    "enum": [
                      "partial",
                      "format-limited"
                    ]
                  }
                }
              },
              "then": {
                "required": [
                  "coverageNote"
                ],
                "properties": {
                  "coverageNote": {}
                }
              }
            }
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "coverage"
          ],
          "properties": {
            "type": {
              "const": "image-dimensions"
            },
            "coverage": {
              "enum": [
                "complete",
                "partial",
                "format-limited"
              ]
            },
            "coverageNote": {
              "type": "string",
              "minLength": 3
            },
            "applicableFormats": {
              "type": "array",
              "minItems": 1,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9]+$"
              }
            },
            "minWidth": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "minHeight": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "maxWidth": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "maxHeight": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "maxPixels": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "coverage": {
                    "enum": [
                      "partial",
                      "format-limited"
                    ]
                  }
                }
              },
              "then": {
                "required": [
                  "coverageNote"
                ],
                "properties": {
                  "coverageNote": {}
                }
              }
            }
          ],
          "anyOf": [
            {
              "required": [
                "minWidth"
              ],
              "properties": {
                "minWidth": {}
              }
            },
            {
              "required": [
                "minHeight"
              ],
              "properties": {
                "minHeight": {}
              }
            },
            {
              "required": [
                "maxWidth"
              ],
              "properties": {
                "maxWidth": {}
              }
            },
            {
              "required": [
                "maxHeight"
              ],
              "properties": {
                "maxHeight": {}
              }
            },
            {
              "required": [
                "maxPixels"
              ],
              "properties": {
                "maxPixels": {}
              }
            }
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "coverage"
          ],
          "properties": {
            "type": {
              "const": "image-features"
            },
            "coverage": {
              "enum": [
                "complete",
                "partial",
                "format-limited"
              ]
            },
            "coverageNote": {
              "type": "string",
              "minLength": 3
            },
            "applicableFormats": {
              "type": "array",
              "minItems": 1,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9]+$"
              }
            },
            "allowAnimation": {
              "type": "boolean"
            },
            "allowTransparency": {
              "type": "boolean"
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "coverage": {
                    "enum": [
                      "partial",
                      "format-limited"
                    ]
                  }
                }
              },
              "then": {
                "required": [
                  "coverageNote"
                ],
                "properties": {
                  "coverageNote": {}
                }
              }
            }
          ],
          "anyOf": [
            {
              "required": [
                "allowAnimation"
              ],
              "properties": {
                "allowAnimation": {}
              }
            },
            {
              "required": [
                "allowTransparency"
              ],
              "properties": {
                "allowTransparency": {}
              }
            }
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "coverage",
            "maxPages",
            "applicableFormats"
          ],
          "properties": {
            "type": {
              "const": "pdf-pages"
            },
            "coverage": {
              "enum": [
                "complete",
                "partial",
                "format-limited"
              ]
            },
            "coverageNote": {
              "type": "string",
              "minLength": 3
            },
            "applicableFormats": {
              "const": [
                "pdf"
              ]
            },
            "maxPages": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "coverage": {
                    "enum": [
                      "partial",
                      "format-limited"
                    ]
                  }
                }
              },
              "then": {
                "required": [
                  "coverageNote"
                ],
                "properties": {
                  "coverageNote": {}
                }
              }
            }
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "coverage",
            "requireSearchable",
            "applicableFormats"
          ],
          "properties": {
            "type": {
              "const": "pdf-text"
            },
            "coverage": {
              "enum": [
                "complete",
                "partial",
                "format-limited"
              ]
            },
            "coverageNote": {
              "type": "string",
              "minLength": 3
            },
            "applicableFormats": {
              "const": [
                "pdf"
              ]
            },
            "requireSearchable": {
              "const": true
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "coverage": {
                    "enum": [
                      "partial",
                      "format-limited"
                    ]
                  }
                }
              },
              "then": {
                "required": [
                  "coverageNote"
                ],
                "properties": {
                  "coverageNote": {}
                }
              }
            }
          ]
        }
      ]
    },
    "caveat": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "text",
        "sourceIds"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "text": {
          "type": "string",
          "minLength": 3
        },
        "sourceIds": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/id"
          }
        }
      }
    },
    "profile": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "id",
        "label",
        "destination",
        "category",
        "appliesTo",
        "summary",
        "reviewedOn",
        "nextReviewOn",
        "sources",
        "rules",
        "caveats",
        "acceptanceDisclaimer",
        "activeCheckRuleIds",
        "referenceUrl",
        "checkUrl"
      ],
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "id": {
          "$ref": "#/$defs/id"
        },
        "label": {
          "type": "string",
          "minLength": 3
        },
        "destination": {
          "type": "string",
          "minLength": 3,
          "description": "The particular upload surface or account context, not just the vendor name."
        },
        "category": {
          "$ref": "#/$defs/id"
        },
        "appliesTo": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/id"
          }
        },
        "summary": {
          "type": "string",
          "minLength": 3
        },
        "reviewedOn": {
          "type": "string",
          "format": "date"
        },
        "nextReviewOn": {
          "type": "string",
          "format": "date"
        },
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/source"
          }
        },
        "rules": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/rule"
          }
        },
        "caveats": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/caveat"
          }
        },
        "acceptanceDisclaimer": {
          "type": "string",
          "minLength": 3
        },
        "activeCheckRuleIds": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/id"
          },
          "description": "Rule IDs loaded by the default preset form. This is form selection, not temporal policy status or an acceptance result."
        },
        "referenceUrl": {
          "type": "string",
          "pattern": "^/upload-requirements#[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "checkUrl": {
          "type": "string",
          "pattern": "^/(?:check-my-file|prepare-for-ai)\\?destination=[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "effectiveFrom": {
          "type": "string",
          "format": "date"
        },
        "effectiveUntil": {
          "type": "string",
          "format": "date"
        },
        "successorPresetId": {
          "$ref": "#/$defs/id"
        }
      }
    }
  }
}
