{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/good-grants/json-schema/good-grants-assignment-schema.json",
  "title": "Assignment",
  "description": "Single scoring task for an application, addressed to either a reviewer or a role within a given round and score set.",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/good-grants-openapi.yaml#/components/schemas/Assignment",
  "type": "object",
  "properties": {
    "application": {
      "type": "object",
      "description": "Application the assignment refers to.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the application."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the application resource."
        },
        "title": {
          "type": "string",
          "description": "Title of the application as submitted by the applicant."
        }
      }
    },
    "category": {
      "type": "object",
      "description": "Category the application belongs to.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the category."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the category resource."
        },
        "name": {
          "type": "object",
          "description": "Translated name of the category, keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "chapter": {
      "type": "object",
      "description": "Chapter the category belongs to.",
      "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": "Translated name of the chapter, keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "comments": {
      "type": [
        "object",
        "null"
      ],
      "description": "Comments attached to the assignment, `null` for role-based assignments.",
      "properties": {
        "judging": {
          "type": "array",
          "description": "Comments left by the reviewer during scoring.",
          "items": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "description": "Short URL-safe identifier for the comment."
              },
              "comment": {
                "type": "string",
                "description": "Comment body as an HTML fragment, empty when the user saved a comment with no content."
              },
              "created_at": {
                "type": "string",
                "format": "date-time",
                "description": "Date and time when the comment was created."
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "description": "Date and time when the comment was last updated."
              },
              "user": {
                "type": "object",
                "description": "User who left the comment.",
                "properties": {
                  "slug": {
                    "type": "string",
                    "description": "Short URL-safe identifier for the user."
                  },
                  "link": {
                    "type": "string",
                    "format": "uri",
                    "description": "Canonical URL for the user resource."
                  },
                  "name": {
                    "type": "string",
                    "description": "Full display name of the user."
                  },
                  "first_name": {
                    "type": "string",
                    "description": "Given name of the user."
                  },
                  "last_name": {
                    "type": "string",
                    "description": "Family name of the user."
                  }
                }
              }
            }
          }
        },
        "abstention": {
          "type": "array",
          "description": "Comments left when the reviewer marked the application as abstained.",
          "items": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "description": "Short URL-safe identifier for the comment."
              },
              "comment": {
                "type": "string",
                "description": "Comment body as an HTML fragment, empty when the user saved a comment with no content."
              },
              "created_at": {
                "type": "string",
                "format": "date-time",
                "description": "Date and time when the comment was created."
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "description": "Date and time when the comment was last updated."
              },
              "user": {
                "type": "object",
                "description": "User who left the comment.",
                "properties": {
                  "slug": {
                    "type": "string",
                    "description": "Short URL-safe identifier for the user."
                  },
                  "link": {
                    "type": "string",
                    "format": "uri",
                    "description": "Canonical URL for the user resource."
                  },
                  "name": {
                    "type": "string",
                    "description": "Full display name of the user."
                  },
                  "first_name": {
                    "type": "string",
                    "description": "Given name of the user."
                  },
                  "last_name": {
                    "type": "string",
                    "description": "Family name of the user."
                  }
                }
              }
            }
          }
        },
        "conflict": {
          "type": "array",
          "description": "Comments left when the reviewer flagged a conflict of interest.",
          "items": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "description": "Short URL-safe identifier for the comment."
              },
              "comment": {
                "type": "string",
                "description": "Comment body as an HTML fragment, empty when the user saved a comment with no content."
              },
              "created_at": {
                "type": "string",
                "format": "date-time",
                "description": "Date and time when the comment was created."
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "description": "Date and time when the comment was last updated."
              },
              "user": {
                "type": "object",
                "description": "User who left the comment.",
                "properties": {
                  "slug": {
                    "type": "string",
                    "description": "Short URL-safe identifier for the user."
                  },
                  "link": {
                    "type": "string",
                    "format": "uri",
                    "description": "Canonical URL for the user resource."
                  },
                  "name": {
                    "type": "string",
                    "description": "Full display name of the user."
                  },
                  "first_name": {
                    "type": "string",
                    "description": "Given name of the user."
                  },
                  "last_name": {
                    "type": "string",
                    "description": "Family name of the user."
                  }
                }
              }
            }
          }
        },
        "criteria": {
          "type": "array",
          "description": "Comments grouped by score-set criterion.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "Display name of the criterion, in the account's default locale."
              },
              "comments": {
                "type": "array",
                "description": "Comments left against this criterion.",
                "items": {
                  "type": "object",
                  "properties": {
                    "slug": {
                      "type": "string",
                      "description": "Short URL-safe identifier for the comment."
                    },
                    "comment": {
                      "type": "string",
                      "description": "Comment body as an HTML fragment, empty when the user saved a comment with no content."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Date and time when the comment was created."
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Date and time when the comment was last updated."
                    },
                    "user": {
                      "type": "object",
                      "description": "User who left the comment.",
                      "properties": {
                        "slug": {
                          "type": "string",
                          "description": "Short URL-safe identifier for the user."
                        },
                        "link": {
                          "type": "string",
                          "format": "uri",
                          "description": "Canonical URL for the user resource."
                        },
                        "name": {
                          "type": "string",
                          "description": "Full display name of the user."
                        },
                        "first_name": {
                          "type": "string",
                          "description": "Given name of the user."
                        },
                        "last_name": {
                          "type": "string",
                          "description": "Family name of the user."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "created": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time when the assignment was created."
    },
    "form": {
      "type": "string",
      "description": "Slug of the form attached to the application."
    },
    "method": {
      "type": "string",
      "description": "How the assignment was created, for example `Manual`, `Automatic (Panel)`, `Recused`, or `Stray`."
    },
    "panels": {
      "type": "array",
      "description": "Panels the assignment is associated with.",
      "items": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "description": "Short URL-safe identifier for the panel."
          },
          "link": {
            "type": "string",
            "format": "uri",
            "description": "Canonical URL for the panel resource."
          },
          "name": {
            "type": "object",
            "description": "Translated name of the panel, keyed by locale code.",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      }
    },
    "reviewer": {
      "type": [
        "object",
        "null"
      ],
      "description": "Reviewer assigned to score the application, `null` for role-based assignments.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the reviewer."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the reviewer resource."
        },
        "name": {
          "type": "string",
          "description": "Full display name of the reviewer."
        }
      }
    },
    "role": {
      "type": [
        "object",
        "null"
      ],
      "description": "Role assigned to score the application, `null` for reviewer-specific assignments.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the role."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the role resource."
        },
        "name": {
          "type": "object",
          "description": "Translated name of the role, keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "rounds": {
      "type": "array",
      "description": "Rounds the assignment applies to.",
      "items": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "description": "Short URL-safe identifier for the round."
          },
          "link": {
            "type": "string",
            "format": "uri",
            "description": "Canonical URL for the round resource."
          },
          "name": {
            "type": "object",
            "description": "Translated name of the round, keyed by locale code.",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      }
    },
    "score": {
      "type": [
        "object",
        "null"
      ],
      "description": "Score for this assignment, formatted per the score-set mode, `null` when no score has been recorded."
    },
    "score_set": {
      "type": [
        "object",
        "null"
      ],
      "description": "Score set used to evaluate the application.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the score set."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the score set resource."
        },
        "name": {
          "type": "object",
          "description": "Translated name of the score set, keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "slug": {
      "type": "string",
      "description": "Short URL-safe identifier for the assignment."
    },
    "status": {
      "type": "string",
      "description": "Current state of the assignment, for example `To be scored`, `In progress`, or `Complete`."
    },
    "updated": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time when the assignment was last updated."
    }
  }
}