{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/good-grants/json-schema/good-grants-user-schema.json",
  "title": "User",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/good-grants-users-api-openapi.yml#/components/schemas/User",
  "allOf": [
    {
      "$ref": "#/$defs/UserSummary"
    },
    {
      "$ref": "#/$defs/UserDetail"
    }
  ],
  "$defs": {
    "UserDetail": {
      "type": "object",
      "description": "Detailed user fields returned only for a single user.",
      "properties": {
        "preferences": {
          "type": "object",
          "description": "Notification preferences selected by the user.",
          "properties": {
            "broadcast_emails": {
              "type": "boolean",
              "description": "Specifies whether the user receives broadcast emails."
            },
            "notification_emails": {
              "type": "boolean",
              "description": "Specifies whether the user receives notification emails."
            },
            "notification_sms": {
              "type": "boolean",
              "description": "Specifies whether the user receives notification text messages."
            }
          }
        },
        "social_sharing": {
          "type": "boolean",
          "description": "Specifies whether the user opted in to social sharing."
        },
        "user_fields": {
          "type": "array",
          "description": "Custom field responses captured on the user profile.",
          "items": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "description": "URL-safe identifier of the field."
              },
              "link": {
                "type": "string",
                "format": "uri",
                "description": "URL of the field resource."
              },
              "label": {
                "type": "object",
                "description": "Label of the field, keyed by locale code.",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "title": {
                "type": "object",
                "description": "Plain-text title of the field, keyed by locale code.",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "value": {
                "type": "string",
                "description": "Value submitted for the field."
              },
              "token": {
                "type": "string",
                "description": "File token for the uploaded file, present on file fields."
              },
              "translated": {
                "type": "object",
                "description": "Translated value of the field, keyed by locale code.",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "UserSummary": {
      "type": "object",
      "description": "Core user fields shared by the list and single-user responses.",
      "properties": {
        "analytics_cookies": {
          "type": "boolean",
          "description": "Specifies whether the user accepted analytics cookies."
        },
        "broadcast_emails": {
          "type": "boolean",
          "description": "Specifies whether the user accepted broadcast emails."
        },
        "comments": {
          "type": "string",
          "description": "Administrative notes recorded against the user, formatted for export."
        },
        "confirmation": {
          "type": "string",
          "description": "Account confirmation status of the user, such as `Confirmed` or `Invited`."
        },
        "confirmed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Date and time when the user confirmed the account, null until confirmed."
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Date and time when the user account was created."
        },
        "created_by": {
          "type": "string",
          "description": "Method by which the user account was created, such as `manual` or `registration`."
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email",
          "description": "Email address of the user, null if not recorded."
        },
        "first_name": {
          "type": "string",
          "description": "First name of the user."
        },
        "language": {
          "type": "object",
          "description": "Preferred language of the user.",
          "properties": {
            "code": {
              "type": "string",
              "description": "Locale code of the language, such as `en_GB`."
            },
            "language": {
              "type": "string",
              "description": "Display name of the language, such as `English (United Kingdom)`."
            }
          }
        },
        "last_name": {
          "type": "string",
          "description": "Last name of the user."
        },
        "marketing_cookies": {
          "type": "boolean",
          "description": "Specifies whether the user accepted marketing cookies."
        },
        "mobile": {
          "type": "string",
          "description": "Mobile phone number of the user."
        },
        "name": {
          "type": "string",
          "description": "Full name of the user."
        },
        "necessary_cookies": {
          "type": "boolean",
          "description": "Specifies whether the user accepted necessary cookies."
        },
        "notification_emails": {
          "type": "boolean",
          "description": "Specifies whether the user accepted notification emails."
        },
        "notification_sms": {
          "type": "boolean",
          "description": "Specifies whether the user accepted notification text messages."
        },
        "roles": {
          "type": "array",
          "description": "Roles assigned to the user within the account.",
          "items": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "description": "URL-safe identifier of the role."
              },
              "link": {
                "type": "string",
                "format": "uri",
                "description": "URL of the role resource."
              },
              "name": {
                "type": "object",
                "description": "Name of the role, keyed by locale code.",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        },
        "slug": {
          "type": "string",
          "description": "URL-safe identifier of the user."
        },
        "updated": {
          "type": "string",
          "format": "date-time",
          "description": "Date and time when the user account was last updated."
        }
      }
    }
  }
}