{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raccoonflow.ai/submission.schema.json",
  "title": "Raccoon Flow Submission Schema",
  "description": "Public intake contract for owners and providers submitting an agent trader, vault, profile JSON, adapter, claim, and evidence package to Raccoon Flow review.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "submissionId",
    "status",
    "submittedAt",
    "submitter",
    "agent",
    "vault",
    "venue",
    "requestedListingStatus",
    "artifacts",
    "contact"
  ],
  "properties": {
    "schema": {
      "const": "raccoonflow.submission.v0.1"
    },
    "submissionId": {
      "type": "string",
      "pattern": "^rfsub_[a-z0-9_]+$"
    },
    "status": {
      "type": "string",
      "enum": ["Draft", "Submitted", "In Review", "Needs Evidence", "Accepted", "Rejected", "Withdrawn"]
    },
    "submittedAt": {
      "type": "string",
      "format": "date-time"
    },
    "submitter": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "type", "role"],
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": ["Individual", "Company", "DAO", "Agent", "Service Provider"]
        },
        "role": {
          "type": "string",
          "enum": ["Owner", "Operator", "Provider", "Researcher", "Delegate", "Other"]
        },
        "website": {
          "type": "string",
          "format": "uri"
        },
        "xHandle": {
          "type": "string"
        },
        "github": {
          "type": "string"
        }
      }
    },
    "owner": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": ["Individual", "Company", "DAO", "Agent", "Unknown"]
        },
        "website": {
          "type": "string",
          "format": "uri"
        },
        "relationshipToSubmitter": {
          "type": "string",
          "enum": ["Same", "Client", "Employer", "Protocol", "Unknown", "Other"]
        }
      }
    },
    "agent": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "type"],
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": ["Human-assisted agent", "Company-owned agent", "Autonomous agent"]
        },
        "erc8004AgentId": {
          "type": "string"
        },
        "walletAddress": {
          "type": "string"
        },
        "runtime": {
          "type": "string"
        },
        "strategySummary": {
          "type": "string"
        },
        "publicUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "vault": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "type", "baseAsset"],
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": ["Vault", "Managed Account", "Copy-trading Account", "Fund of Funds", "Paper Portfolio", "Other"]
        },
        "baseAsset": {
          "type": "string"
        },
        "aumUsd": {
          "type": "number",
          "minimum": 0
        },
        "vaultAddress": {
          "type": "string"
        },
        "profileSlug": {
          "type": "string"
        },
        "profileJson": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "venue": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "type"],
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": ["Hyperliquid", "AFX", "DEX", "CEX", "On-chain Vault", "Other"]
        },
        "accountId": {
          "type": "string"
        },
        "chainId": {
          "type": "integer",
          "minimum": 1
        },
        "accountUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "executionControls": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "model": {
          "type": "string",
          "enum": ["Gateway", "Venue-native permissions", "Smart contract policy", "Scoped key", "Manual supervision", "Unknown", "Other"]
        },
        "withdrawalsAllowed": {
          "type": "boolean"
        },
        "riskLimitSummary": {
          "type": "string"
        },
        "killSwitch": {
          "type": "string",
          "enum": ["Present", "Missing", "Unknown", "Not Applicable"]
        },
        "controlPolicyHash": {
          "type": "string"
        }
      }
    },
    "requestedListingStatus": {
      "type": "string",
      "enum": ["Private review", "Public candidate", "Public demo", "Listed rating"]
    },
    "artifacts": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "profileJsonUrl": {
          "type": "string",
          "format": "uri"
        },
        "claimUrl": {
          "type": "string",
          "format": "uri"
        },
        "adapterUrl": {
          "type": "string",
          "format": "uri"
        },
        "evidenceUrl": {
          "type": "string",
          "format": "uri"
        },
        "strategyDocUrl": {
          "type": "string",
          "format": "uri"
        },
        "sourceRepoUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "evidenceSummary": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["type", "status"],
        "properties": {
          "type": {
            "type": "string",
            "enum": ["Wallet Signature", "Venue Account Proof", "DNS TXT Record", "Website File", "Email Domain Proof", "GitHub Proof", "Social Proof", "Execution Control Proof", "Data Freshness Proof", "Attestation", "Manual Review Artifact"]
          },
          "status": {
            "type": "string",
            "enum": ["Missing", "Submitted", "Verified", "Rejected", "Expired", "Revoked"]
          },
          "evidenceId": {
            "type": "string",
            "pattern": "^rfev_[a-z0-9_]+$"
          },
          "notes": {
            "type": "string"
          }
        }
      }
    },
    "contact": {
      "type": "object",
      "additionalProperties": false,
      "required": ["email"],
      "properties": {
        "email": {
          "type": "string",
          "format": "email"
        },
        "xHandle": {
          "type": "string"
        },
        "telegram": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      }
    }
  }
}
