{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tooloracle.io/docs/schemas/deal-proposal-card.v1.json",
  "title": "OracleNet Deal Proposal Card v1 (W3C VC)",
  "description": "A VerifiableCredential-wrapped deal proposal. Wraps a capability_declaration or counter_offer with W3C VC v2 structure, signed with EcdsaSecp256k1Signature2019. Downstream verifiers MUST recompute the SHA-256 of the canonical VC (proof field removed), recover the signer from proof.signatureHex, and match it against proof.jwsSigner.",
  "type": "object",
  "required": [
    "@context",
    "type",
    "id",
    "issuer",
    "validFrom",
    "credentialSubject",
    "proof"
  ],
  "properties": {
    "@context": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "contains": {
        "const": "https://www.w3.org/ns/credentials/v2"
      }
    },
    "type": {
      "type": "array",
      "contains": {
        "const": "VerifiableCredential"
      }
    },
    "id": {
      "type": "string",
      "pattern": "^urn:uuid:"
    },
    "issuer": {
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^did:"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "validFrom": {
      "type": "string",
      "format": "date-time"
    },
    "validUntil": {
      "type": "string",
      "format": "date-time"
    },
    "credentialSubject": {
      "type": "object",
      "required": [
        "message_type"
      ],
      "properties": {
        "message_type": {
          "enum": [
            "capability_declaration",
            "counter_offer",
            "accept",
            "decline",
            "question"
          ]
        },
        "from": {
          "type": "object"
        },
        "to": {
          "type": [
            "string",
            "object"
          ]
        },
        "i_offer": {
          "type": "array"
        },
        "i_seek": {
          "type": "array"
        },
        "fit_claim": {
          "type": "object"
        },
        "reply_to": {
          "type": "string",
          "format": "uri"
        },
        "ts": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "proof": {
      "type": "object",
      "required": [
        "type",
        "created",
        "proofPurpose",
        "verificationMethod",
        "jwsSigner",
        "contentHash",
        "signatureHex"
      ],
      "properties": {
        "type": {
          "const": "EcdsaSecp256k1Signature2019"
        },
        "created": {
          "type": "string",
          "format": "date-time"
        },
        "proofPurpose": {
          "type": "string"
        },
        "verificationMethod": {
          "type": "string"
        },
        "jwsSigner": {
          "type": "string",
          "pattern": "^0x[0-9a-fA-F]{40}$"
        },
        "contentHash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "signatureHex": {
          "type": "string"
        },
        "verificationUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}