{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/coderpad/json-schema/coderpad-campaigns-page-schema.json",
  "title": "campaigns_page",
  "description": "Paginated list of test campaigns",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coderpad-campaigns-api-openapi.yml#/components/schemas/campaigns_page",
  "type": "object",
  "properties": {
    "campaigns": {
      "type": "array",
      "description": "the test campaigns of the current page",
      "items": {
        "$ref": "#/$defs/CampaignSummary"
      }
    },
    "pagination": {
      "$ref": "#/$defs/cursor_pagination_config"
    }
  },
  "$defs": {
    "CampaignCandidatesSummary": {
      "type": "object",
      "properties": {
        "total": {
          "type": "integer",
          "description": "how many candidates the test holds",
          "format": "int32"
        },
        "by_test_status": {
          "type": "array",
          "description": "how many candidates each test status holds",
          "items": {
            "$ref": "#/$defs/CampaignStatusCountInsights"
          }
        }
      },
      "description": "the candidates of a test, counted the same way as in the test insights"
    },
    "CampaignStatusCountInsights": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "description": "the status the candidates are counted under"
        },
        "count": {
          "type": "integer",
          "description": "how many candidates hold the status",
          "format": "int32"
        }
      },
      "description": "how many candidates a status holds"
    },
    "CampaignSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "the test id, the one the other /v1.1 endpoints take",
          "format": "int32"
        },
        "name": {
          "type": "string",
          "description": "the test name"
        },
        "pinned": {
          "type": "boolean",
          "description": "true if the test is pinned"
        },
        "archived": {
          "type": "boolean",
          "description": "true if the test is archived"
        },
        "languages": {
          "type": "array",
          "description": "the languages allowed for the test",
          "items": {
            "type": "string",
            "description": "the languages allowed for the test"
          }
        },
        "candidates": {
          "$ref": "#/$defs/CampaignCandidatesSummary"
        },
        "domains": {
          "type": "array",
          "description": "the domains of the questions of the test",
          "items": {
            "type": "string",
            "description": "the domains of the questions of the test"
          }
        },
        "question_count": {
          "type": [
            "integer",
            "null"
          ],
          "description": "the number of questions of the test, an average over several draws when the test holds random question sets. Null when it has not been computed yet",
          "format": "int32"
        },
        "question_count_exact": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "false when question_count is an estimate, because the test holds random question sets"
        },
        "duration_seconds": {
          "type": "integer",
          "description": "the duration of the test in seconds: the duration of each question plus the target duration of each random question set",
          "format": "int64"
        },
        "creator_id": {
          "type": "string",
          "description": "the recruiter who created the test",
          "format": "uuid"
        },
        "team_id": {
          "type": "string",
          "description": "the team the test belongs to",
          "format": "uuid"
        },
        "creation_time": {
          "type": "string",
          "description": "when the test was created, ISO 8601 in UTC"
        },
        "modification_time": {
          "type": [
            "string",
            "null"
          ],
          "description": "when the test was last modified, ISO 8601 in UTC"
        },
        "last_activity_time": {
          "type": [
            "string",
            "null"
          ],
          "description": "the last activity of a candidate of the test, ISO 8601 in UTC"
        }
      },
      "description": "a test campaign of a paginated list"
    },
    "cursor_pagination_config": {
      "type": "object",
      "properties": {
        "limit": {
          "type": "integer",
          "description": "the maximum number of elements returned",
          "format": "int32"
        },
        "total": {
          "type": "integer",
          "description": "the total number of available elements",
          "format": "int32"
        },
        "has_more_items": {
          "type": "boolean",
          "description": "true if there are still some elements to be fetched"
        },
        "next_cursor": {
          "type": "string",
          "description": "if has_more_items is true, the cursor to send to fetch the next page"
        },
        "next_page": {
          "type": "string",
          "description": "if has_more_items is true, the URL of the next page: the query parameters of the current page with the next cursor"
        }
      },
      "description": "the pagination config"
    }
  }
}