{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/insourcia-io/json-schema/insourcia-io-company-graph-schema.json",
  "title": "CompanyGraph",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/insourcia-io-openapi.yaml#/components/schemas/CompanyGraph",
  "type": "object",
  "properties": {
    "siren": {
      "type": "string"
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Nœud entreprise (`id` = \"co:<siren>\", ou \"co:ext:<slug>\" pour un parent étranger hors index) ou personne physique (`id` = \"pp:<nom>|<prenom>|<AAAA-MM>\").\n",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "entreprise",
              "personne"
            ]
          },
          "siren": {
            "type": "string"
          },
          "denomination": {
            "type": "string"
          },
          "forme_juridique": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "libelle": {
                "type": "string"
              }
            }
          },
          "statut": {
            "type": "string",
            "enum": [
              "actif",
              "cesse"
            ]
          },
          "est_racine": {
            "type": "boolean"
          },
          "pays": {
            "type": "string"
          },
          "nom": {
            "type": "string"
          },
          "prenom": {
            "type": "string"
          },
          "date_naissance": {
            "type": "string",
            "description": "Précision mois (AAAA-MM)"
          },
          "niveau": {
            "type": "integer"
          }
        }
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Arête orientée source -> target",
        "properties": {
          "source": {
            "type": "string"
          },
          "target": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "mandat_pm",
              "filiale",
              "parent_ultime",
              "mandat_pp"
            ]
          },
          "role": {
            "type": "string"
          },
          "date_debut": {
            "type": "string",
            "format": "date"
          },
          "date_fin": {
            "type": "string",
            "format": "date"
          },
          "est_actif": {
            "type": "boolean"
          }
        }
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "depth": {
          "type": "integer"
        },
        "counts": {
          "type": "object",
          "properties": {
            "entreprises": {
              "type": "integer"
            },
            "personnes": {
              "type": "integer"
            },
            "edges": {
              "type": "integer"
            }
          }
        },
        "truncated": {
          "type": "object",
          "properties": {
            "nodes": {
              "type": "boolean"
            },
            "edges": {
              "type": "boolean"
            },
            "filiales_par_noeud": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "dirigees_par_noeud": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "expansion_personnes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "expansion_niveau_2": {
              "type": "boolean"
            }
          }
        },
        "filters": {
          "type": "object",
          "properties": {
            "include_personnes": {
              "type": "boolean"
            },
            "include_sci": {
              "type": "boolean"
            },
            "include_ceased": {
              "type": "boolean"
            },
            "expand_persons": {
              "type": "boolean"
            }
          }
        }
      }
    }
  }
}