{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://arpelier.com/schema/flow-1.0.json",
  "title": "Arpelier flow API 1.0",
  "type": "object",
  "additionalProperties": false,
  "description": "Native authoring fields in nm. JSON Schema checks shape; validate() also checks domain tiling, process references, groups and current supported models. BONDING and PARTICLE require separate contracts and are not supported in v1.",
  "required": [
    "schema",
    "domain",
    "processes"
  ],
  "properties": {
    "schema": {
      "const": "https://arpelier.com/schema/flow-1.0.json"
    },
    "name": {
      "type": "string"
    },
    "note": {
      "type": "string"
    },
    "domain": {
      "type": "object",
      "required": [
        "LX",
        "LY",
        "dx",
        "dy"
      ],
      "additionalProperties": false,
      "properties": {
        "LX": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "LY": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "dx": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "dy": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      }
    },
    "gridResolution": {
      "type": "integer",
      "enum": [
        1,
        2,
        3
      ],
      "default": 2,
      "description": "XY spacing divisor: 1, 2 and 4 respectively."
    },
    "displayUnits": {
      "type": "object",
      "required": [
        "length"
      ],
      "additionalProperties": false,
      "properties": {
        "length": {
          "enum": [
            "nm",
            "um",
            "mm"
          ]
        }
      },
      "description": "Display preferences only; persisted geometric values remain nm."
    },
    "materials": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "color",
          "type"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "anyOf": [
              {
                "minimum": 3,
                "maximum": 24
              },
              {
                "minimum": 100,
                "maximum": 240
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        }
      }
    },
    "masks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "negpol",
          "domain",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,160}$"
          },
          "name": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "negpol": {
            "type": "boolean"
          },
          "domain": {
            "type": "object",
            "required": [
              "LX",
              "LY"
            ],
            "properties": {
              "LX": {
                "type": "number",
                "exclusiveMinimum": 0
              },
              "LY": {
                "type": "number",
                "exclusiveMinimum": 0
              }
            }
          },
          "data": {
            "type": "object",
            "required": [
              "objects"
            ],
            "properties": {
              "objects": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "type"
                  ],
                  "properties": {
                    "type": {
                      "enum": [
                        "rect",
                        "circle",
                        "polygon"
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "polarity": {
                          "enum": [
                            "positive",
                            "negative"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "processes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "GROUPSTART"
              },
              "name": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "unfolded": {
                "type": "boolean"
              },
              "isModule": {
                "type": "boolean"
              },
              "cycleCount": {
                "type": "integer",
                "minimum": 1
              },
              "iterationEnabled": {}
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "GROUPEND"
              },
              "name": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "unfolded": {
                "type": "boolean"
              },
              "isModule": {
                "type": "boolean"
              },
              "cycleCount": {
                "type": "integer",
                "minimum": 1
              },
              "iterationEnabled": {}
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "SUBSTR"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0,
                "exclusiveMinimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "substrateDoping": {
                "type": "string",
                "default": "-"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind",
              "material"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "DEPO"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ],
                "not": {
                  "enum": [
                    "",
                    "-"
                  ]
                }
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "conformality": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "bottomGrowthRatio": {
                "type": "number",
                "default": 1
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind",
              "material"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "ALD"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ],
                "not": {
                  "enum": [
                    "",
                    "-"
                  ]
                }
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "seed": {},
              "aldIsotropicAnalysis": {
                "type": "boolean",
                "default": false
              },
              "aldGrowthModel": {
                "type": "string",
                "default": "uniform"
              },
              "aldSurfaceRoughness": {
                "type": "number",
                "default": 0
              },
              "aldRoughnessSeed": {},
              "aldInitialNucleationCoverage": {
                "type": "number",
                "default": 20
              },
              "aldNucleationRatePerCycle": {
                "type": "number",
                "default": 5
              },
              "aldNucleusDiameter": {
                "type": "number",
                "default": 1
              },
              "aldCycleThickness": {
                "type": "number",
                "default": 2
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind",
              "material"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "SPIN COATING"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ],
                "not": {
                  "enum": [
                    "",
                    "-"
                  ]
                }
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {}
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind",
              "materialetch"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "ETCH"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "minProperties": 1,
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "conformality": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "bowing": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "materialetchSelectionMode": {
                "enum": [
                  "exact"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind",
              "materialetch"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "WET ETCH"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "minProperties": 1,
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "wetIsotropicAnalysis": {
                "type": "boolean",
                "default": false
              },
              "seam": {
                "type": "number",
                "minimum": 0,
                "maximum": 10,
                "description": "Gap height in nm: lateral WET access needs an open gap strictly taller than this."
              },
              "materialetchSelectionMode": {
                "enum": [
                  "exact"
                ]
              },
              "wetAdvancedEnabled": {
                "type": "boolean",
                "default": false
              },
              "wetReactionModel": {
                "type": "string",
                "default": "cyclic_self_limited"
              },
              "wetCycleCount": {
                "type": "number",
                "default": 10
              },
              "wetReactionDepth": {
                "type": "number",
                "default": 1
              },
              "wetSurfaceSaturation": {},
              "wetRemovalEfficiency": {}
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "CMP"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "stopper": {},
              "dishingMaterials": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "dishing": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "materialSelectionMode": {},
              "dishingMaterialsSelectionMode": {}
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "STRIP"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "liftOff": {
                "type": "boolean",
                "default": false
              },
              "liftOffRemoveAtSides": {
                "type": "boolean",
                "default": true
              },
              "stripMaterials": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "materialSelectionMode": {}
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "PHOTO"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "photoOpticalEnabled": {
                "type": "boolean",
                "default": false
              },
              "photoOpticalWavelength": {
                "type": "number",
                "default": 193
              },
              "photoOpticalNA": {
                "type": "number",
                "default": 1.35
              },
              "photoExposureThreshold": {
                "type": "number",
                "default": 0.5
              },
              "photoOpcCornerSerifEnabled": {
                "type": "boolean",
                "default": false
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "IMPLANT"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "dopingtype": {},
              "implantDepth": {
                "type": "number",
                "default": 0
              },
              "depthStraggle": {
                "type": "number",
                "default": 0
              },
              "diffusionLength": {
                "type": "number",
                "default": 0
              },
              "diffuseExistingDopants": {
                "type": "boolean",
                "default": false
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "OXIDATION"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "enhancedIsotropyEnabled": {
                "type": "boolean",
                "default": false
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,160}$"
              },
              "kind": {
                "const": "MODIFICATION"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "isignore": {
                "type": "boolean"
              },
              "mask": {},
              "maskPolarityInverted": {},
              "material": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 255
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "materialetch": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "thickness": {
                "type": "number",
                "minimum": 0
              },
              "generatedStepMeta": {},
              "implantAdvancedEnabled": {},
              "sourceMaterial": {
                "type": "string",
                "default": "-"
              },
              "targetMaterial": {
                "type": "string",
                "default": "-"
              },
              "volumeRatio": {
                "type": "number",
                "default": 2.27
              },
              "reactionDirectionality": {
                "type": "number",
                "default": 0
              },
              "enhancedIsotropyEnabled": {
                "type": "boolean",
                "default": false
              },
              "sourceMaterials": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "sourceMaterialSelectionMode": {}
            }
          }
        ]
      }
    }
  }
}
