{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Bundle Workspaces ERPNext · 5 portails role (OTO DTP Sprint 4)",
  "type": "object",
  "additionalProperties": false,
  "required": ["manifest", "workspace"],
  "properties": {
    "manifest": { "$ref": "#/definitions/manifest" },
    "workspace": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5,
      "items": { "$ref": "#/definitions/workspace" }
    }
  },
  "definitions": {
    "manifest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "generated_from", "spec_version", "source_version", "roadmap_ref",
        "counts", "brand", "module_note", "doctypes_custom_a_creer", "workspaces"
      ],
      "properties": {
        "generated_from": { "type": "string", "minLength": 1 },
        "spec_version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
        "source_version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
        "roadmap_ref": { "type": "string", "minLength": 1 },
        "counts": {
          "type": "object",
          "additionalProperties": false,
          "required": ["workspaces", "roles_couverts", "liens_total", "raccourcis_total"],
          "properties": {
            "workspaces": { "type": "integer", "minimum": 5, "maximum": 5 },
            "roles_couverts": { "type": "integer", "minimum": 1 },
            "liens_total": { "type": "integer", "minimum": 1 },
            "raccourcis_total": { "type": "integer", "minimum": 1 }
          }
        },
        "brand": { "$ref": "#/definitions/brand" },
        "module_note": { "type": "string", "minLength": 1 },
        "doctypes_custom_a_creer": {
          "type": "array",
          "uniqueItems": true,
          "items": { "type": "string", "minLength": 1 }
        },
        "workspaces": {
          "type": "array",
          "minItems": 5,
          "maxItems": 5,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["portail", "workspace", "nb_cartes", "nb_raccourcis", "nb_liens", "nb_roles", "doctypes_custom"],
            "properties": {
              "portail": { "type": "string", "enum": ["ventes", "construction", "achat", "compta", "direction"] },
              "workspace": { "type": "string", "minLength": 1 },
              "nb_cartes": { "type": "integer", "minimum": 1 },
              "nb_raccourcis": { "type": "integer", "minimum": 1 },
              "nb_liens": { "type": "integer", "minimum": 1 },
              "nb_roles": { "type": "integer", "minimum": 1 },
              "doctypes_custom": {
                "type": "array",
                "uniqueItems": true,
                "items": { "type": "string", "minLength": 1 }
              }
            }
          }
        }
      }
    },
    "brand": {
      "type": "object",
      "additionalProperties": false,
      "required": ["note", "fond", "accent", "polices"],
      "properties": {
        "note": { "type": "string", "minLength": 1 },
        "fond": { "$ref": "#/definitions/token" },
        "accent": { "$ref": "#/definitions/token" },
        "polices": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/definitions/token" }
        }
      }
    },
    "token": {
      "type": "object",
      "additionalProperties": false,
      "required": ["valeur", "source"],
      "properties": {
        "valeur": { "type": "string", "minLength": 1 },
        "source": { "type": "string", "minLength": 1 }
      }
    },
    "workspace": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "doctype", "name", "title", "label", "public", "is_hidden", "module",
        "icon", "indicator_color", "sequence_id", "parent_page", "for_user",
        "content", "shortcuts", "links", "roles"
      ],
      "properties": {
        "doctype": { "type": "string", "const": "Workspace" },
        "name": { "type": "string", "minLength": 1 },
        "title": { "type": "string", "minLength": 1 },
        "label": { "type": "string", "minLength": 1 },
        "public": { "type": "integer", "minimum": 1, "maximum": 1 },
        "is_hidden": { "type": "integer", "minimum": 0, "maximum": 0 },
        "module": { "type": "null" },
        "icon": { "type": "string", "minLength": 1 },
        "indicator_color": { "type": "string", "minLength": 1 },
        "sequence_id": { "type": "number", "minimum": 1 },
        "parent_page": { "type": "string" },
        "for_user": { "type": "string" },
        "content": { "type": "string", "minLength": 2 },
        "shortcuts": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/definitions/shortcut" }
        },
        "links": {
          "type": "array",
          "minItems": 2,
          "items": { "$ref": "#/definitions/link" }
        },
        "roles": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/definitions/has_role" }
        }
      }
    },
    "shortcut": {
      "type": "object",
      "additionalProperties": false,
      "required": ["doctype", "parentfield", "parenttype", "type", "link_to", "label", "color", "doc_view"],
      "properties": {
        "doctype": { "type": "string", "const": "Workspace Shortcut" },
        "parentfield": { "type": "string", "const": "shortcuts" },
        "parenttype": { "type": "string", "const": "Workspace" },
        "type": { "type": "string", "const": "DocType" },
        "link_to": { "type": "string", "minLength": 1 },
        "label": { "type": "string", "minLength": 1 },
        "color": { "type": "string", "minLength": 1 },
        "doc_view": { "type": "string", "const": "List" }
      }
    },
    "link": {
      "type": "object",
      "additionalProperties": false,
      "required": ["doctype", "parentfield", "parenttype", "type", "label", "onboard", "hidden"],
      "properties": {
        "doctype": { "type": "string", "const": "Workspace Link" },
        "parentfield": { "type": "string", "const": "links" },
        "parenttype": { "type": "string", "const": "Workspace" },
        "type": { "type": "string", "enum": ["Card Break", "Link"] },
        "label": { "type": "string", "minLength": 1 },
        "link_count": { "type": "integer", "minimum": 0 },
        "link_type": { "type": "string", "const": "DocType" },
        "link_to": { "type": "string", "minLength": 1 },
        "is_query_report": { "type": "integer", "minimum": 0, "maximum": 0 },
        "dependencies": { "type": "string" },
        "onboard": { "type": "integer", "minimum": 0, "maximum": 0 },
        "hidden": { "type": "integer", "minimum": 0, "maximum": 0 }
      }
    },
    "has_role": {
      "type": "object",
      "additionalProperties": false,
      "required": ["doctype", "parentfield", "parenttype", "role"],
      "properties": {
        "doctype": { "type": "string", "const": "Has Role" },
        "parentfield": { "type": "string", "const": "roles" },
        "parenttype": { "type": "string", "const": "Workspace" },
        "role": { "type": "string", "minLength": 1 }
      }
    }
  }
}
