{
  "version": "1",
  "url": "https://app.customknits.ru/project/new",
  "query": {
    "eachParameterAtMostOnce": true,
    "unknownParameters": "ignored"
  },
  "askUser": {
    "ifMissing": "Ask the user for the value if they have not provided it.",
    "onlyIfProvided": "Include only when the user already supplied or chose a value.",
    "automatic": "Set this from the contract without asking."
  },
  "parameters": {
    "v": {
      "type": "string",
      "const": "1",
      "required": false,
      "askUser": "automatic",
      "default": {
        "mode": "literal",
        "value": "1"
      }
    },
    "preset": {
      "type": "string",
      "enum": [
        "hat_ribbed_basic",
        "hat_wedges_basic"
      ],
      "required": true,
      "askUser": "automatic"
    }
  },
  "models": {
    "hat_ribbed_basic": {
      "title": "Шапка резинкой",
      "instructions": "https://www.customknits.ru/for-ai/ribbed-hat",
      "parameters": {
        "headCircumference": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 10,
          "maximum": 80,
          "unit": "cm",
          "askUser": "ifMissing",
          "required": true
        },
        "finishedHeight": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 5,
          "maximum": 150,
          "unit": "cm",
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "calculated",
            "from": [
              "headCircumference"
            ]
          }
        },
        "hasFoldedCuff": {
          "type": "string",
          "enum": [
            "0",
            "1"
          ],
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "conditional",
            "value": "0",
            "whenPresent": {
              "cuffHeight": "1"
            }
          }
        },
        "cuffHeight": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 0.1,
          "maximum": 80,
          "unit": "cm",
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "calculated",
            "when": {
              "hasFoldedCuff": "1"
            }
          }
        },
        "ribVariant": {
          "type": "string",
          "enum": [
            "1x1",
            "2x2"
          ],
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "literal",
            "value": "2x2"
          }
        },
        "rows": {
          "type": "string",
          "enum": [
            "circular",
            "flat"
          ],
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "editorSetting"
          }
        },
        "direction": {
          "type": "string",
          "enum": [
            "bottom-up",
            "top-down"
          ],
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "editorSetting"
          }
        },
        "stitchesPer10cm": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 1,
          "maximum": 200,
          "required": true,
          "askUser": "ifMissing",
          "unit": "stitches/10cm"
        },
        "rowsPer10cm": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 1,
          "maximum": 200,
          "required": true,
          "askUser": "ifMissing",
          "unit": "rows/10cm"
        },
        "yarnColor": {
          "type": "string",
          "pattern": "^[0-9A-Fa-f]{6}$",
          "format": "RRGGBB",
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "editorDefault"
          }
        }
      },
      "rules": [
        {
          "when": {
            "present": "cuffHeight",
            "unless": {
              "hasFoldedCuff": "0"
            }
          },
          "set": {
            "hasFoldedCuff": "1"
          }
        },
        {
          "when": {
            "hasFoldedCuff": "0"
          },
          "ignore": [
            "cuffHeight"
          ]
        },
        {
          "when": {
            "hasFoldedCuff": "1"
          },
          "compare": {
            "left": "cuffHeight",
            "operator": "<",
            "right": "finishedHeight"
          },
          "checkedIn": "patternForm"
        }
      ]
    },
    "hat_wedges_basic": {
      "title": "Шапка с клиньями",
      "instructions": "https://www.customknits.ru/for-ai/wedge-hat",
      "parameters": {
        "headCircumference": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 10,
          "maximum": 80,
          "unit": "cm",
          "askUser": "ifMissing",
          "required": true
        },
        "stitchesPer10cm": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 1,
          "maximum": 200,
          "required": true,
          "askUser": "ifMissing",
          "unit": "stitches/10cm"
        },
        "rowsPer10cm": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 1,
          "maximum": 200,
          "required": true,
          "askUser": "ifMissing",
          "unit": "rows/10cm"
        },
        "ribbingHeight": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 0.1,
          "maximum": 80,
          "unit": "cm",
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "calculated",
            "from": [
              "headCircumference",
              "finishedHeight"
            ]
          }
        },
        "ribVariant": {
          "type": "string",
          "enum": [
            "1x1",
            "2x2"
          ],
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "editorDefault"
          }
        },
        "hasFoldedCuff": {
          "type": "string",
          "enum": [
            "0",
            "1"
          ],
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "conditional",
            "value": "0",
            "whenPresent": {
              "cuffHeight": "1"
            }
          }
        },
        "cuffHeight": {
          "type": "number",
          "pattern": "^\\d+(?:\\.\\d+)?$",
          "minimum": 0.1,
          "maximum": 80,
          "unit": "cm",
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "calculated",
            "when": {
              "hasFoldedCuff": "1"
            }
          }
        },
        "wedges": {
          "type": "integer",
          "pattern": "^\\d+$",
          "minimum": 3,
          "maximum": 16,
          "unit": null,
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "literal",
            "value": 4
          }
        },
        "yarnColor": {
          "type": "string",
          "pattern": "^[0-9A-Fa-f]{6}$",
          "format": "RRGGBB",
          "askUser": "onlyIfProvided",
          "default": {
            "mode": "editorDefault"
          }
        }
      },
      "rules": [
        {
          "when": {
            "present": "cuffHeight",
            "unless": {
              "hasFoldedCuff": "0"
            }
          },
          "set": {
            "hasFoldedCuff": "1"
          }
        },
        {
          "when": {
            "hasFoldedCuff": "0"
          },
          "ignore": [
            "cuffHeight"
          ]
        },
        {
          "when": {
            "hasFoldedCuff": "1"
          },
          "compare": {
            "left": "cuffHeight",
            "operator": "<",
            "right": "finishedHeight"
          },
          "checkedIn": "patternForm"
        },
        {
          "when": {
            "present": "ribbingHeight"
          },
          "compare": {
            "left": "ribbingHeight",
            "operator": "<=",
            "right": "finishedHeight"
          },
          "checkedIn": "patternForm"
        }
      ]
    }
  }
}
