{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/adspendspy/main/json-schema/adspendspy-projects-response-schema.json",
  "title": "ProjectsResponse",
  "description": "projects without public_id (or with brand_id); project with public_id.",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/adspendspy-api-openapi.json#/components/schemas/ProjectsResponse",
  "oneOf": [
    {
      "type": "object",
      "required": [
        "success",
        "projects"
      ],
      "properties": {
        "success": {
          "type": "boolean",
          "enum": [
            true
          ]
        },
        "projects": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Project"
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "success",
        "project"
      ],
      "properties": {
        "success": {
          "type": "boolean",
          "enum": [
            true
          ]
        },
        "project": {
          "$ref": "#/$defs/Project"
        }
      }
    }
  ],
  "$defs": {
    "Project": {
      "type": "object",
      "required": [
        "public_id",
        "project_name",
        "brand_count"
      ],
      "properties": {
        "public_id": {
          "type": "string"
        },
        "project_name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "color": {
          "type": [
            "string",
            "null"
          ]
        },
        "brand_count": {
          "type": "integer"
        },
        "contains_brand": {
          "type": "boolean",
          "description": "Only with brand_id: whether this project holds that brand."
        },
        "created_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "Server timestamp, format YYYY-MM-DD HH:MM:SS."
        },
        "updated_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "Server timestamp, format YYYY-MM-DD HH:MM:SS."
        },
        "brands": {
          "type": "array",
          "description": "Only with public_id: the actively tracked brands in this project.",
          "items": {
            "type": "object",
            "required": [
              "id",
              "page_id",
              "brand_name"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "description": "Internal brand record ID."
              },
              "page_id": {
                "type": "string",
                "pattern": "^[0-9]{5,25}$",
                "description": "Meta advertiser page ID, kept as a string."
              },
              "brand_name": {
                "type": "string"
              },
              "brand_image": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ad_count": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}