{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/samva-dev/json-schema/samva-dev-contact-group-page-schema.json",
  "title": "ContactGroupPage",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/samva-dev-contact-groups-api-openapi.yml#/components/schemas/ContactGroupPage",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/$defs/ContactGroupId"
          },
          "organizationId": {
            "$ref": "#/$defs/OrganizationId"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "static",
              "dynamic",
              "smart"
            ]
          },
          "criteria": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/$defs/JsonValue"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "color": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "clay",
                  "sand",
                  "moss",
                  "sky",
                  "plum",
                  "rose"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "The list's label color, one of six families, or null for the neutral chip. Customer-chosen and purely presentational; it carries no meaning the API enforces."
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "parentGroupId": {
            "anyOf": [
              {
                "$ref": "#/$defs/ContactGroupId"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastCalculatedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "isActive": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "organizationId",
          "name",
          "description",
          "type",
          "criteria",
          "color",
          "icon",
          "parentGroupId",
          "contactCount",
          "lastCalculatedAt",
          "isActive",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    },
    "nextCursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "items",
    "nextCursor"
  ],
  "additionalProperties": false,
  "$defs": {
    "ContactGroupId": {
      "type": "string",
      "pattern": "^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "ContactGroupId"
    },
    "JsonValue": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        }
      ]
    },
    "OrganizationId": {
      "type": "string",
      "pattern": "^org_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "OrganizationId"
    }
  }
}