{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://zeitmint.com/utility-manifest.schema.json",
  "title": "ZeitMint Utility Manifest",
  "description": "A portable declaration of a token project's working utility and community mission.",
  "type": "object",
  "required": ["$schema", "schemaVersion", "generatedAt", "source", "project", "utility", "mission", "integrity", "handoff"],
  "properties": {
    "$schema": { "const": "https://zeitmint.com/utility-manifest.schema.json" },
    "schemaVersion": { "const": "1.0" },
    "generatedAt": { "type": "string", "format": "date-time" },
    "source": {
      "type": "object",
      "required": ["name", "url"],
      "properties": {
        "name": { "const": "ZeitMint" },
        "url": { "type": "string", "format": "uri" }
      },
      "additionalProperties": false
    },
    "project": {
      "type": "object",
      "required": ["name", "symbol", "chain"],
      "properties": {
        "name": { "type": "string", "minLength": 2, "maxLength": 80 },
        "symbol": { "type": "string", "pattern": "^[A-Z0-9]{2,10}$" },
        "chain": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$" }
      },
      "additionalProperties": false
    },
    "utility": {
      "type": "object",
      "required": ["type", "objective", "userAction", "benefit", "status"],
      "properties": {
        "type": { "const": "community-bounties" },
        "objective": { "const": "fund-contributors" },
        "userAction": { "const": "submit-original-work" },
        "benefit": { "const": "approved-contribution-reward" },
        "status": { "const": "draft" }
      },
      "additionalProperties": false
    },
    "mission": {
      "type": "object",
      "required": ["id", "title", "deliverable", "submissionRequirements", "deadline", "reward", "funding", "approval"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "title": { "type": "string", "minLength": 8 },
        "deliverable": { "type": "string", "minLength": 40 },
        "submissionRequirements": { "type": "string", "minLength": 20 },
        "deadline": { "type": "string", "format": "date" },
        "reward": {
          "type": "object",
          "required": ["primary", "bonus"],
          "properties": {
            "primary": { "$ref": "#/$defs/reward" },
            "bonus": { "anyOf": [{ "$ref": "#/$defs/reward" }, { "type": "null" }] }
          },
          "additionalProperties": false
        },
        "funding": {
          "type": "object",
          "required": ["source", "status", "verification"],
          "properties": {
            "source": { "enum": ["creator-funded", "community-treasury", "programmable-fees"] },
            "status": { "enum": ["planned", "self-declared-funded"] },
            "verification": { "const": "self-declared" }
          },
          "additionalProperties": false
        },
        "approval": { "enum": ["creator-review", "community-vote", "hybrid"] }
      },
      "additionalProperties": false
    },
    "integrity": {
      "type": "object",
      "required": ["originalWorkRequired", "engagementFarmingProhibited", "automatedPayout", "rewardCustody", "utilityProof"],
      "properties": {
        "originalWorkRequired": { "const": true },
        "engagementFarmingProhibited": { "const": true },
        "automatedPayout": { "const": false },
        "rewardCustody": { "const": "outside-zeitmint" },
        "utilityProof": { "const": "unverified-until-completion" }
      },
      "additionalProperties": false
    },
    "handoff": {
      "type": "object",
      "required": ["preferredLaunchpad", "preferredChain", "launchpadControls"],
      "properties": {
        "preferredLaunchpad": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$" },
        "preferredChain": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$" },
        "launchpadControls": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }
      },
      "additionalProperties": false
    }
  },
  "$defs": {
    "reward": {
      "type": "object",
      "required": ["amount", "asset"],
      "properties": {
        "amount": { "type": "string", "minLength": 1 },
        "asset": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
