{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://open-coder-ai.github.io/chock/schemas/v0/manifest.artifact-conditionals.json",
  "title": "ChockArtifactConditionals",
  "description": "Per-artifact conditional requirements for the v3 manifest.",
  "allOf": [
    {
      "if": {
        "properties": {
          "artifact": {
            "const": "rule"
          }
        }
      },
      "then": {
        "required": [
          "rule"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "artifact": {
            "const": "hook"
          }
        }
      },
      "then": {
        "required": [
          "hook"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "artifact": {
            "const": "skill"
          }
        }
      },
      "then": {
        "allOf": [
          {
            "required": [
              "skill"
            ]
          },
          {
            "if": {
              "properties": {
                "skill": {
                  "properties": {
                    "skill_type": {
                      "enum": [
                        "code",
                        "hybrid"
                      ]
                    }
                  }
                }
              }
            },
            "then": {
              "allOf": [
                {
                  "required": [
                    "input_schema",
                    "output_schema",
                    "evaluation",
                    "security"
                  ]
                },
                {
                  "properties": {
                    "skill": {
                      "required": [
                        "approval"
                      ]
                    }
                  }
                }
              ]
            }
          }
        ],
        "properties": {
          "skill": {
            "allOf": [
              {
                "$ref": "https://open-coder-ai.github.io/chock/schemas/v0/manifest.skill.json"
              },
              {
                "required": [
                  "skill_type",
                  "entry",
                  "effects"
                ]
              }
            ]
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "artifact": {
            "const": "workflow"
          }
        }
      },
      "then": {
        "required": [
          "workflow"
        ]
      }
    }
  ]
}
