{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "act-v4.bishop-factory-cck-profile/v1",
  "title": "Read-only ACT V4 Hybrid CCK projection of owner-created agent or app",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "id",
    "kind",
    "concept",
    "features",
    "modules",
    "nodes",
    "layers",
    "fields",
    "owner",
    "source",
    "status",
    "proof",
    "operator_explanation"
  ],
  "properties": {
    "schema": {
      "const": "act-v4.bishop-factory-cck-profile/v1"
    },
    "id": {
      "type": "string",
      "minLength": 1
    },
    "kind": {
      "enum": [
        "agent",
        "app"
      ]
    },
    "concept": {
      "type": "object",
      "required": [
        "id",
        "meaning"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "meaning": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "features": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/record"
      }
    },
    "modules": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/record"
      }
    },
    "nodes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/node"
      }
    },
    "layers": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "molecule",
        "cell",
        "bone",
        "muscle",
        "skin",
        "follicle"
      ],
      "properties": {
        "molecule": {
          "type": "string",
          "minLength": 1
        },
        "cell": {
          "type": "string",
          "minLength": 1
        },
        "bone": {
          "type": "string",
          "minLength": 1
        },
        "muscle": {
          "type": "string",
          "minLength": 1
        },
        "skin": {
          "type": "string",
          "minLength": 1
        },
        "follicle": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "fields": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "id",
          "type",
          "owner",
          "source_field_id",
          "verification"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "owner": {
            "type": "string"
          },
          "source_field_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "verification": {
            "enum": [
              "candidate",
              "owner-verified",
              "not-applicable"
            ]
          }
        }
      }
    },
    "owner": {
      "type": "object",
      "required": [
        "form",
        "function",
        "data",
        "execution",
        "presentation",
        "authorization"
      ],
      "additionalProperties": {
        "type": "string",
        "minLength": 1
      }
    },
    "source": {
      "type": "object",
      "required": [
        "repository",
        "revision",
        "artifact",
        "provenance"
      ],
      "properties": {
        "repository": {
          "type": "string"
        },
        "revision": {
          "type": "string"
        },
        "artifact": {
          "type": "string"
        },
        "provenance": {
          "type": "string"
        }
      }
    },
    "status": {
      "type": "object",
      "required": [
        "specified",
        "built",
        "live",
        "verified",
        "authorized"
      ],
      "additionalProperties": false,
      "properties": {
        "specified": {
          "type": "boolean"
        },
        "built": {
          "type": "boolean"
        },
        "live": {
          "type": "boolean"
        },
        "verified": {
          "type": "boolean"
        },
        "authorized": {
          "type": "boolean"
        }
      }
    },
    "proof": {
      "type": "object",
      "required": [
        "source",
        "schema",
        "runtime",
        "consumer",
        "approval",
        "limitations"
      ],
      "additionalProperties": {
        "type": "string"
      }
    },
    "operator_explanation": {
      "type": "object",
      "required": [
        "what",
        "why",
        "does_now",
        "not_yet",
        "inputs",
        "outputs",
        "visible_effect",
        "actions",
        "placement",
        "relationships",
        "strongest_alternative",
        "reversal_evidence",
        "next_remedy"
      ],
      "additionalProperties": {
        "type": "string"
      }
    },
    "being": {
      "type": "object",
      "required": [
        "skills",
        "rules",
        "capabilities",
        "talents",
        "soul",
        "philosophy",
        "consciousness",
        "emotion",
        "tone"
      ],
      "properties": {
        "skills": {
          "$ref": "#/$defs/stringList"
        },
        "rules": {
          "$ref": "#/$defs/stringList"
        },
        "capabilities": {
          "$ref": "#/$defs/stringList"
        },
        "talents": {
          "$ref": "#/$defs/stringList"
        },
        "soul": {
          "type": "string",
          "minLength": 1
        },
        "philosophy": {
          "type": "string",
          "minLength": 1
        },
        "consciousness": {
          "type": "string",
          "minLength": 1
        },
        "emotion": {
          "type": "string",
          "minLength": 1
        },
        "tone": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "birth": {
      "type": "object",
      "required": [
        "bishop_manifest",
        "certificate",
        "passport",
        "registry",
        "commissioned"
      ],
      "properties": {
        "bishop_manifest": {
          "type": "string"
        },
        "certificate": {
          "type": "string"
        },
        "passport": {
          "type": "string"
        },
        "registry": {
          "type": "string"
        },
        "commissioned": {
          "type": "boolean"
        }
      }
    },
    "app_generation": {
      "type": "object",
      "required": [
        "factory",
        "package",
        "product_owner",
        "release_state"
      ],
      "properties": {
        "factory": {
          "type": "string"
        },
        "package": {
          "type": "string"
        },
        "product_owner": {
          "type": "string"
        },
        "release_state": {
          "type": "string"
        }
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "kind": {
            "const": "agent"
          }
        }
      },
      "then": {
        "required": [
          "being",
          "birth"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "app"
          }
        }
      },
      "then": {
        "required": [
          "app_generation"
        ]
      }
    }
  ],
  "$defs": {
    "stringList": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "record": {
      "type": "object",
      "required": [
        "id",
        "meaning"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "meaning": {
          "type": "string"
        }
      }
    },
    "node": {
      "type": "object",
      "required": [
        "id",
        "meaning",
        "inputs",
        "outputs"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "meaning": {
          "type": "string"
        },
        "inputs": {
          "$ref": "#/$defs/stringList"
        },
        "outputs": {
          "$ref": "#/$defs/stringList"
        }
      }
    }
  }
}
