{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/coactive/main/json-schema/coactive-client-response-schema.json",
  "title": "ClientResponse",
  "description": "System-level credentials",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coactive-system-credentials-api-openapi.yml#/components/schemas/ClientResponse",
  "type": "object",
  "properties": {
    "client_id": {
      "type": "string",
      "description": "OAuth client ID"
    },
    "client_secret": {
      "type": "string",
      "description": "OAuth client secret (only returned on creation)"
    },
    "name": {
      "type": "string",
      "description": "Display name for the OAuth client"
    },
    "roles": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Role"
      },
      "description": "List of roles assigned to the client"
    }
  },
  "required": [
    "client_id",
    "client_secret",
    "name",
    "roles"
  ],
  "$defs": {
    "Role": {
      "type": "object",
      "properties": {
        "role_id": {
          "type": "string",
          "description": "Name of the role (e.g., 'admin', 'editor', 'viewer')"
        },
        "resource": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional resource type the role applies to (e.g., 'dataset')"
        },
        "resource_instance": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional resource instance ID the role applies to"
        }
      },
      "required": [
        "role_id"
      ],
      "description": "Role model for user and client roles",
      "title": "Role"
    }
  }
}