{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peppolstatus-com/json-schema/peppolstatus-com-seat-view-schema.json",
  "title": "SeatView",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peppolstatus-com-seats-api-openapi.yml#/components/schemas/SeatView",
  "type": "object",
  "required": [
    "seat_id",
    "provider",
    "cert_org",
    "hosts"
  ],
  "properties": {
    "seat_id": {
      "type": "string"
    },
    "provider": {
      "$ref": "#/$defs/SeatProvider"
    },
    "cert_org": {
      "type": [
        "string",
        "null"
      ]
    },
    "participant_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Participants this Seat currently serves; null until the seat_org_stats rollup has a row (issue #451)."
    },
    "unique_organizations": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Unique organizations across the Seat's roster (distinct company_key); null until the rollup has computed it (issue #451)."
    },
    "ids_per_organization": {
      "type": [
        "number",
        "null"
      ],
      "description": "participant_count / unique_organizations; null under the <100-participant noise guard or before the rollup computes it (issue #451)."
    },
    "hosts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SeatHost"
      }
    }
  },
  "$defs": {
    "HostRole": {
      "type": "string",
      "enum": [
        "SMP",
        "AP"
      ]
    },
    "SeatHost": {
      "type": "object",
      "required": [
        "hostname",
        "role",
        "since"
      ],
      "properties": {
        "hostname": {
          "type": "string"
        },
        "role": {
          "$ref": "#/$defs/HostRole"
        },
        "since": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "SeatProvider": {
      "type": "object",
      "description": "Embedded provider for a seat, verified mapping or unverified CN fallback.",
      "required": [
        "slug",
        "name",
        "country",
        "verified"
      ],
      "properties": {
        "slug": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "type": [
            "string",
            "null"
          ]
        },
        "verified": {
          "type": "boolean"
        },
        "key": {
          "type": [
            "string",
            "null"
          ],
          "description": "The curated provider's OpenPeppol registry natural key, when the mapping carries one. It decides whether the seat's operator and a host's owner are the same party; it is not a /v1/aps route key and not the slug. Optional: absent on a cached response minted before the field shipped."
        }
      }
    }
  }
}