{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "OTO Barème Commissions Ventes · plan de sortie",
  "type": "object",
  "required": ["manifest", "commission_plan"],
  "additionalProperties": false,
  "properties": {
    "manifest": {
      "type": "object",
      "required": [
        "generated_from", "rbac_source", "workflow_source", "doctype_source",
        "source_version", "bareme_name", "counts", "roles_rbac_utilises", "note_taux"
      ],
      "additionalProperties": false,
      "properties": {
        "generated_from": { "type": "string" },
        "rbac_source": { "type": "string" },
        "workflow_source": { "type": "string" },
        "doctype_source": { "type": "string" },
        "source_version": { "type": "string" },
        "bareme_name": { "type": "string" },
        "counts": {
          "type": "object",
          "required": ["evenements", "roles", "taux_a_confirmer"],
          "additionalProperties": false,
          "properties": {
            "evenements": { "type": "integer" },
            "roles": { "type": "integer" },
            "taux_a_confirmer": { "type": "integer" }
          }
        },
        "roles_rbac_utilises": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["role_id", "erpnext_role_name"],
            "additionalProperties": false,
            "properties": {
              "role_id": { "type": "string" },
              "erpnext_role_name": { "type": "string" }
            }
          }
        },
        "note_taux": { "type": "string" }
      }
    },
    "commission_plan": {
      "type": "object",
      "required": ["name", "devise_field", "evenements"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "devise_field": { "type": "string" },
        "evenements": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "update_value", "role_id", "erpnext_role_name", "base_field",
              "libelle", "taux_pct", "source", "a_confirmer"
            ],
            "additionalProperties": false,
            "properties": {
              "update_value": { "type": "string" },
              "role_id": { "type": "string" },
              "erpnext_role_name": { "type": "string" },
              "base_field": { "type": "string" },
              "libelle": { "type": "string" },
              "taux_pct": { "type": ["number", "string", "null"] },
              "source": { "type": ["string", "null"] },
              "a_confirmer": { "type": "boolean" }
            }
          }
        }
      }
    }
  }
}
