{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/contracts/v1/auth-session.v1.schema.json",
  "title": "AuthSession",
  "type": "object",
  "additionalProperties": false,
  "required": ["sessionId", "clientId", "subject", "scopes", "state", "issuedAt", "expiresAt"],
  "properties": {
    "sessionId": { "type": "string", "minLength": 8, "maxLength": 128 },
    "clientId": { "type": "string", "minLength": 1, "maxLength": 128 },
    "subject": {
      "type": "object",
      "additionalProperties": false,
      "required": ["imCoreUid"],
      "properties": {
        "imCoreUid": { "type": "integer", "minimum": 1 },
        "email": { "type": "string", "format": "email" }
      }
    },
    "scopes": { "type": "array", "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$" } },
    "state": { "type": "string", "enum": ["active", "revoked", "expired"] },
    "issuedAt": { "type": "string", "format": "date-time" },
    "expiresAt": { "type": "string", "format": "date-time" }
  }
}
