{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eightfold-ai/json-schema/eightfold-ai-ext-demand-org-unit-schema-schema.json",
  "title": "ExtDemandOrgUnitSchema",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eightfold-ai-ext-demand-org-unit-api-openapi.yml#/components/schemas/ExtDemandOrgUnitSchema",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "active",
        "archived"
      ],
      "description": "Status of the org unit. Possible values: ['active', 'archived']"
    },
    "updatedBy": {
      "type": [
        "string",
        "null"
      ],
      "description": "Email of the updater of the org unit"
    },
    "userGroups": {
      "description": "User groups associated with the org unit",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/RmUserGroup"
      }
    },
    "extOrgUnitId": {
      "type": "string",
      "description": "Org unit id in the external system"
    },
    "_type": {
      "type": "string",
      "enum": [
        "program",
        "project"
      ],
      "description": "Type of the org unit. Possible values: ['program', 'project']"
    },
    "mainOwner": {
      "description": "Main owner of the org unit",
      "allOf": [
        {
          "$ref": "#/$defs/DemandOrgUnitOwnerSchema"
        }
      ]
    },
    "endDate": {
      "type": [
        "string",
        "null"
      ],
      "description": "End date of the org unit in ISO format (YYYY-MM-DD)"
    },
    "createdBy": {
      "type": "string",
      "description": "Email of the creator of the org unit"
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Description of the org unit"
    },
    "otherOwners": {
      "description": "Other owners of the org unit",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/DemandOrgUnitOwnerSchema"
      }
    },
    "parentExtId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Parent org unit id in the external system"
    },
    "startDate": {
      "type": "string",
      "description": "Start date of the org unit in ISO format (YYYY-MM-DD)"
    },
    "updatedAt": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "description": "Updated timestamp for the org unit"
    },
    "customFields": {
      "type": [
        "object",
        "null"
      ],
      "description": "Custom fields for the org unit"
    },
    "title": {
      "type": "string",
      "description": "Title of the org unit"
    },
    "tags": {
      "description": "Tags associated with the org unit",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/EntityTag"
      }
    }
  },
  "required": [
    "_type",
    "createdBy",
    "extOrgUnitId",
    "startDate",
    "status",
    "title"
  ],
  "$defs": {
    "DemandOrgUnitOwnerSchema": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "description": "Email of the owner"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the owner"
        }
      },
      "required": [
        "email"
      ]
    },
    "EntityTag": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "user",
            "system"
          ],
          "description": "Type of the tag (user/system)"
        },
        "name": {
          "type": "string",
          "description": "Name of the tag"
        },
        "category": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "inherited_tag",
            null
          ],
          "description": "Category of the tag (e.g. inherited_tag)"
        }
      },
      "required": [
        "name",
        "type"
      ]
    },
    "RmUserGroup": {
      "type": "object",
      "properties": {
        "userGroupId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Unique identifier for the user group"
        }
      }
    }
  }
}