{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "ECC install state",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "installedAt",
    "target",
    "request",
    "resolution",
    "source",
    "operations"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "ecc.install.v1"
    },
    "installedAt": {
      "type": "string",
      "minLength": 1
    },
    "lastValidatedAt": {
      "type": "string",
      "minLength": 1
    },
    "target": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "root",
        "installStatePath"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "target": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "enum": [
            "home",
            "project"
          ]
        },
        "root": {
          "type": "string",
          "minLength": 1
        },
        "installStatePath": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "request": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "profile",
        "modules",
        "includeComponents",
        "excludeComponents",
        "legacyLanguages",
        "legacyMode"
      ],
      "properties": {
        "profile": {
          "type": [
            "string",
            "null"
          ]
        },
        "modules": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "includeComponents": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "excludeComponents": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "legacyLanguages": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "legacyMode": {
          "type": "boolean"
        }
      }
    },
    "resolution": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "selectedModules",
        "skippedModules"
      ],
      "properties": {
        "selectedModules": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "skippedModules": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "repoVersion",
        "repoCommit",
        "manifestVersion"
      ],
      "properties": {
        "repoVersion": {
          "type": [
            "string",
            "null"
          ]
        },
        "repoCommit": {
          "type": [
            "string",
            "null"
          ]
        },
        "manifestVersion": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "operations": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "kind",
          "moduleId",
          "sourceRelativePath",
          "destinationPath",
          "strategy",
          "ownership",
          "scaffoldOnly"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "moduleId": {
            "type": "string",
            "minLength": 1
          },
          "sourceRelativePath": {
            "type": "string",
            "minLength": 1
          },
          "destinationPath": {
            "type": "string",
            "minLength": 1
          },
          "strategy": {
            "type": "string",
            "minLength": 1
          },
          "ownership": {
            "type": "string",
            "minLength": 1
          },
          "scaffoldOnly": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
