{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cosuno/json-schema/cosuno-file-tree-item-response-schema.json",
  "title": "FileTreeItemResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cosuno-bids-api-openapi.yml#/components/schemas/FileTreeItemResponse",
  "anyOf": [
    {
      "$ref": "#/$defs/FileTreeFileResponse"
    },
    {
      "$ref": "#/$defs/FileTreeFolderResponse"
    }
  ],
  "$defs": {
    "FileTreeFileResponse": {
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the file node."
        },
        "type": {
          "type": "string",
          "enum": [
            "file"
          ],
          "description": "Discriminator indicating that this item is a file."
        },
        "name": {
          "type": "string",
          "description": "File name (including extension)."
        },
        "path": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Path to the file expressed as an array of folder names from the root of the file tree down to (but not including) the file itself."
        },
        "parentId": {
          "type": "string",
          "description": "ID of the folder containing this file. Equal to `root` when the file sits at the top of the tree."
        },
        "size": {
          "type": "number",
          "format": "double",
          "description": "Size of the file in bytes."
        },
        "uploadedAt": {
          "type": "string",
          "description": "ISO 8601 timestamp at which the file was uploaded."
        },
        "uploadedBy": {
          "$ref": "#/$defs/UserResponse",
          "description": "User who uploaded the file, if known."
        }
      },
      "required": [
        "id",
        "type",
        "name",
        "path",
        "parentId",
        "size",
        "uploadedAt"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "FileTreeFolderResponse": {
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the folder node."
        },
        "type": {
          "type": "string",
          "enum": [
            "folder"
          ],
          "description": "Discriminator indicating that this item is a folder."
        },
        "name": {
          "type": "string",
          "description": "Folder name."
        },
        "path": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Path to the folder expressed as an array of folder names from the root of the file tree down to (but not including) the folder itself."
        },
        "parentId": {
          "type": "string",
          "description": "ID of the parent folder. Equal to `root` when the folder sits at the top of the tree."
        }
      },
      "required": [
        "id",
        "type",
        "name",
        "path",
        "parentId"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "USER_STATUS": {
      "type": "string",
      "enum": [
        "approvalPending",
        "adminApprovalPending",
        "invited",
        "inviteCanceled",
        "inviteFailed",
        "inviteRequested",
        "active",
        "inactive"
      ]
    },
    "USER_TYPE": {
      "type": "string",
      "enum": [
        "custom",
        "administrator",
        "employee",
        "guest",
        "collaborator",
        "manager"
      ]
    },
    "UserResponse": {
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the user."
        },
        "email": {
          "type": "string",
          "description": "Email address of the user. Also used as their login identifier."
        },
        "status": {
          "$ref": "#/$defs/USER_STATUS",
          "description": "Current status of the user."
        },
        "firstName": {
          "type": "string",
          "description": "Given name of the user."
        },
        "lastName": {
          "type": "string",
          "description": "Family name of the user."
        },
        "type": {
          "$ref": "#/$defs/USER_TYPE",
          "description": "Account type of the user. Values starting with `custom` indicate a custom user role (see `customUserRoleId`)."
        },
        "customUserRoleId": {
          "type": "string",
          "description": "ID of the custom user role assigned to the user. Present only when `type` refers to a custom user role."
        }
      },
      "required": [
        "id",
        "email",
        "status",
        "type"
      ],
      "type": "object",
      "additionalProperties": false
    }
  }
}