{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/faxforagents/json-schema/faxforagents-oauth-consent-schema.json",
  "title": "OAuthConsent",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/faxforagents-oauth-api-openapi.yml#/components/schemas/OAuthConsent",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "client": {
      "$ref": "#/$defs/OAuthConsentClient"
    },
    "redirect_host": {
      "type": "string",
      "title": "Redirect Host"
    },
    "scopes_requested": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Scopes Requested"
    },
    "organizations": {
      "items": {
        "$ref": "#/$defs/OAuthConsentOrganization"
      },
      "type": "array",
      "title": "Organizations"
    },
    "default_environment": {
      "type": "string",
      "enum": [
        "live",
        "test"
      ],
      "title": "Default Environment"
    },
    "expires_at": {
      "type": "string",
      "title": "Expires At"
    }
  },
  "additionalProperties": true,
  "type": "object",
  "required": [
    "id",
    "client",
    "redirect_host",
    "scopes_requested",
    "organizations",
    "default_environment",
    "expires_at"
  ],
  "$defs": {
    "OAuthConsentClient": {
      "properties": {
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name",
          "description": "The client's own name, shown as text beside the host."
        },
        "host": {
          "type": "string",
          "title": "Host",
          "description": "The host the person is sending a credential to: the trust anchor."
        },
        "loopback": {
          "type": "boolean",
          "title": "Loopback",
          "description": "The redirect goes to the person's own computer (an app they started)."
        },
        "first_seen": {
          "type": "boolean",
          "title": "First Seen",
          "description": "This client was registered during this request."
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "name",
        "host",
        "loopback",
        "first_seen"
      ],
      "title": "OAuthConsentClient"
    },
    "OAuthConsentOrganization": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "role": {
          "type": "string",
          "title": "Role"
        },
        "scopes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Scopes",
          "description": "What the grant would carry for this organization and role."
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "id",
        "name",
        "role",
        "scopes"
      ],
      "title": "OAuthConsentOrganization"
    }
  }
}