{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/4chems-com/json-schema/4chems-com-tenant-access-out-schema.json",
  "title": "TenantAccessOut",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/4chems-com-authz-api-openapi.yml#/components/schemas/TenantAccessOut",
  "properties": {
    "tenant": {
      "type": "string",
      "title": "Tenant"
    },
    "level": {
      "$ref": "#/$defs/Level"
    },
    "via": {
      "type": "string",
      "title": "Via"
    },
    "subscription": {
      "$ref": "#/$defs/SubscriptionOut"
    }
  },
  "type": "object",
  "required": [
    "tenant",
    "level",
    "via",
    "subscription"
  ],
  "$defs": {
    "Level": {
      "type": "string",
      "enum": [
        "none",
        "requester",
        "viewer",
        "member",
        "admin",
        "owner"
      ],
      "title": "Level"
    },
    "SubscriptionOut": {
      "properties": {
        "state": {
          "$ref": "#/$defs/SubscriptionState"
        },
        "expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expires At"
        },
        "grace_ends_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Grace Ends At"
        }
      },
      "type": "object",
      "required": [
        "state",
        "expires_at",
        "grace_ends_at"
      ],
      "title": "SubscriptionOut"
    },
    "SubscriptionState": {
      "type": "string",
      "enum": [
        "trialing",
        "expired",
        "erased",
        "active"
      ],
      "title": "SubscriptionState",
      "description": "Commercial state (UC-096, UC-086 D7); `TrialStatus` is provisioning only."
    }
  }
}