{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://suffect.com/schemas/0.2/signup-request.schema.json",
  "title": "Suffect signup request 0.2",
  "description": "POST {signup.endpoint}. See docs/05 section 4.",
  "type": "object",
  "required": [
    "suffect",
    "request_id",
    "consent",
    "attestation",
    "requested",
    "contact",
    "credential"
  ],
  "properties": {
    "suffect": {
      "type": "string",
      "pattern": "^0\\.2(\\.[0-9]+)?$"
    },
    "request_id": {
      "type": "string",
      "pattern": "^req_[0-9A-Z]{26}$"
    },
    "consent": {
      "$ref": "https://suffect.com/schemas/0.2/consent-record.schema.json"
    },
    "attestation": {
      "type": "string",
      "description": "JWS, EdDSA, over sha256(consent) + request_id + vendor.domain + iat + exp"
    },
    "requested": {
      "type": "object",
      "properties": {
        "plan": {
          "type": ["string", "null"]
        },
        "packs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "budget": {
          "type": "object",
          "required": ["amount", "currency", "period"],
          "properties": {
            "amount": {
              "type": "number",
              "minimum": 0
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "period": {
              "type": "string",
              "enum": ["month", "week", "day", "once"]
            }
          }
        }
      }
    },
    "contact": {
      "type": "object",
      "required": ["email"],
      "properties": {
        "email": {
          "type": "string",
          "format": "email"
        },
        "name": {
          "type": "string"
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        }
      }
    },
    "credential": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "type": "string",
          "enum": ["api_key", "oauth_client"]
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "payment": {
      "type": "object",
      "required": ["rail"],
      "properties": {
        "rail": {
          "type": "string",
          "enum": ["card", "mpp", "x402", "none"]
        },
        "token": {
          "type": "string"
        }
      }
    },
    "resource": {
      "type": "string",
      "description": "The account resource slug being created, when the manifest lists more than one."
    }
  }
}
