{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://coolpowerindex.com/schema/v1/project.json",
 "title": "Campus / project / phase / building",
 "description": "Roles are distinct arrays. A leased hyperscaler hall is ONE project record with operator_ids (colo) and occupier_ids (hyperscaler). Phases point to their campus with parent_id.",
 "x-folder": "projects",
 "allOf": [
  {
   "$ref": "_common.json#/$defs/baseRecord"
  }
 ],
 "type": "object",
 "required": [
  "type",
  "level",
  "stage"
 ],
 "properties": {
  "type": {
   "const": "project"
  },
  "level": {
   "type": "string",
   "enum": [
    "campus",
    "phase",
    "building",
    "project"
   ]
  },
  "parent_id": {
   "$ref": "_common.json#/$defs/slug"
  },
  "country_id": {
   "$ref": "_common.json#/$defs/slug"
  },
  "state_region": {
   "type": "string"
  },
  "metro_id": {
   "$ref": "_common.json#/$defs/slug"
  },
  "country_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "owner_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "operator_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "developer_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "occupier_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "investor_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "technology_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "policy_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "cloud_region_ids": {
   "$ref": "_common.json#/$defs/idArray"
  },
  "stage": {
   "type": "string",
   "enum": [
    "announced",
    "planning",
    "permitted",
    "under-construction",
    "commissioned",
    "operating",
    "delayed",
    "on-hold",
    "cancelled",
    "unknown",
    "provisional-allocation"
   ]
  },
  "grid_status": {
   "type": "string",
   "enum": [
    "not-disclosed",
    "applied",
    "offer",
    "contracted",
    "energised",
    "unknown",
    "existing-allocation"
   ]
  },
  "commercial_availability": {
   "type": "string",
   "enum": [
    "not-disclosed",
    "own-use",
    "pre-leased",
    "available",
    "fully-leased",
    "unknown",
    "scheduled"
   ]
  },
  "expected_operating_date": {
   "type": "object",
   "properties": {
    "value": {
     "type": [
      "string",
      "null"
     ]
    },
    "confidence": {
     "type": "string",
     "enum": [
      "announced",
      "estimated",
      "unknown"
     ]
    },
    "source_url": {
     "type": "string"
    }
   }
  },
  "cooling_architecture": {
   "type": [
    "object",
    "null"
   ],
   "properties": {
    "summary": {
     "type": "string"
    },
    "source_url": {
     "type": "string"
    }
   }
  },
  "power_architecture": {
   "type": [
    "object",
    "null"
   ],
   "properties": {
    "summary": {
     "type": "string"
    },
    "source_url": {
     "type": "string"
    }
   }
  },
  "contractors": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "name",
     "role",
     "source_url"
    ],
    "properties": {
     "name": {
      "type": "string"
     },
     "organisation_id": {
      "$ref": "_common.json#/$defs/slug"
     },
     "role": {
      "type": "string"
     },
     "source_url": {
      "type": "string"
     }
    }
   }
  },
  "supplier_links": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "supplier_id",
     "relation"
    ],
    "properties": {
     "supplier_id": {
      "$ref": "_common.json#/$defs/slug"
     },
     "relation": {
      "type": "string",
      "enum": [
       "capability-match",
       "verified-contract"
      ]
     },
     "source_url": {
      "type": "string"
     }
    }
   }
  },
  "latest_change": {
   "type": "object",
   "properties": {
    "date": {
     "$ref": "_common.json#/$defs/date"
    },
    "summary": {
     "type": "string"
    },
    "source_url": {
     "type": "string"
    }
   }
  }
 }
}