{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/good-grants/json-schema/good-grants-category-schema.json",
  "title": "Category",
  "description": "Grant category that applications are submitted to.",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/good-grants-openapi.yaml#/components/schemas/Category",
  "allOf": [
    {
      "$ref": "#/$defs/CategoryBase"
    },
    {
      "type": "object",
      "properties": {
        "chapters": {
          "type": "array",
          "description": "Chapters the category is available in.",
          "items": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "description": "Short URL-safe identifier for the chapter."
              },
              "link": {
                "type": "string",
                "format": "uri",
                "description": "Canonical URL for the chapter resource."
              },
              "name": {
                "type": "object",
                "description": "Map of translated strings keyed by locale code (for example, `en_GB` or `fr_FR`).",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        },
        "applicant_max_applications": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Maximum number of applications a single applicant may submit to this category, or `null` if uncapped."
        },
        "application_name_label": {
          "type": "object",
          "description": "Custom label for the application-name field shown to applicants, as a map of translated strings keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "fill_application_name": {
          "type": "boolean",
          "description": "Specifies whether applicants are asked to name their application when submitting to this category."
        },
        "image_heading": {
          "type": "object",
          "description": "Heading shown above the category images, as a map of translated strings keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "images": {
          "type": "array",
          "description": "Images attached to the category.",
          "items": {
            "type": "object",
            "properties": {
              "token": {
                "type": "string",
                "description": "Token identifying the image file."
              },
              "link": {
                "type": "string",
                "format": "uri",
                "description": "Canonical URL for the file resource."
              },
              "filename": {
                "type": "string",
                "description": "Original filename as uploaded."
              },
              "download": {
                "type": "string",
                "format": "uri",
                "description": "Time-limited download URL for the image."
              }
            }
          }
        },
        "max_image_width": {
          "type": "integer",
          "description": "Maximum display width for the category images, in pixels."
        },
        "packing_slip_instructions": {
          "type": "object",
          "description": "Instructions shown on the packing slip for the category, as a map of translated strings keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "pdf_packing_slip": {
          "type": "boolean",
          "description": "Specifies whether a PDF packing slip is enabled for the category."
        }
      }
    }
  ],
  "$defs": {
    "CategoryBase": {
      "type": "object",
      "properties": {
        "created": {
          "type": "string",
          "format": "date-time",
          "description": "Date and time when the category was created."
        },
        "description": {
          "type": "object",
          "description": "Description shown to applicants on the category, as an HTML fragment map keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "divisions": {
          "type": "integer",
          "minimum": 1,
          "description": "Number of divisions configured for the category, always at least `1`."
        },
        "form": {
          "type": "object",
          "description": "Application form attached to the category.",
          "properties": {
            "slug": {
              "type": "string",
              "description": "Short URL-safe identifier for the form."
            },
            "link": {
              "type": "string",
              "format": "uri",
              "description": "Canonical URL for the form resource."
            },
            "name": {
              "type": "object",
              "description": "Map of translated strings keyed by locale code (for example, `en_GB` or `fr_FR`).",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        },
        "name": {
          "type": "object",
          "description": "Display name of the category, as a map of translated strings keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "parent": {
          "type": [
            "object",
            "null"
          ],
          "description": "Parent category this category sits under, or `null` for a top-level category.",
          "properties": {
            "slug": {
              "type": "string",
              "description": "Short URL-safe identifier for the parent category."
            },
            "link": {
              "type": "string",
              "format": "uri",
              "description": "Canonical URL for the parent category resource."
            },
            "name": {
              "type": "object",
              "description": "Map of translated strings keyed by locale code (for example, `en_GB` or `fr_FR`).",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        },
        "promoted": {
          "type": [
            "integer",
            "null"
          ],
          "enum": [
            0,
            1,
            null
          ],
          "description": "Promotion state of the category, `1` when promoted, `0` when not, and `null` when unset."
        },
        "season": {
          "type": "object",
          "description": "Season the category belongs to.",
          "properties": {
            "slug": {
              "type": "string",
              "description": "Short URL-safe identifier for the season."
            },
            "link": {
              "type": "string",
              "format": "uri",
              "description": "Canonical URL for the season resource."
            },
            "name": {
              "type": "object",
              "description": "Map of translated strings keyed by locale code (for example, `en_GB` or `fr_FR`).",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        },
        "shortcode": {
          "type": "object",
          "description": "Short code used to reference the category, as a map of translated strings keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the category."
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "inactive"
          ],
          "description": "Current state of the category."
        },
        "updated": {
          "type": "string",
          "format": "date-time",
          "description": "Date and time when the category was last updated."
        }
      }
    }
  }
}