{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/politicalcomms-com/json-schema/politicalcomms-com-hierarchy-organization-schema.json",
  "title": "HierarchyOrganization",
  "description": "Organization node in the hierarchy tree (recursive).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/politicalcomms-com-organizations-api-openapi.yml#/components/schemas/HierarchyOrganization",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "parentId": {
      "type": [
        "string",
        "null"
      ],
      "description": "null for the root organization of the returned tree."
    },
    "status": {
      "type": "string"
    },
    "contactEmail": {
      "type": [
        "string",
        "null"
      ]
    },
    "contactFirstName": {
      "type": [
        "string",
        "null"
      ]
    },
    "contactLastName": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "brands": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "campaigns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true
      }
    },
    "childOrganizations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/HierarchyOrganization"
      },
      "description": "Child organization nodes, recursively."
    }
  },
  "additionalProperties": true,
  "$defs": {
    "HierarchyOrganization": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "parentId": {
          "type": [
            "string",
            "null"
          ],
          "description": "null for the root organization of the returned tree."
        },
        "status": {
          "type": "string"
        },
        "contactEmail": {
          "type": [
            "string",
            "null"
          ]
        },
        "contactFirstName": {
          "type": [
            "string",
            "null"
          ]
        },
        "contactLastName": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "brands": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "organizationId": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "campaigns": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "additionalProperties": true
                }
              }
            },
            "additionalProperties": true
          }
        },
        "childOrganizations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/HierarchyOrganization"
          },
          "description": "Child organization nodes, recursively."
        }
      },
      "additionalProperties": true,
      "description": "Organization node in the hierarchy tree (recursive)."
    }
  }
}