{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rctp.dev/schemas/listing-create-request.schema.json",
  "title": "Create listing request",
  "description": "Body of POST /listings (verb listing.create). Names the term set and may carry proposed_terms; the seller confirms the terms on the hosted page, and only what they confirm is stored (Draft 0.5 6.1; binding 4.2; INV-5).",
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 140
    },
    "category": {
      "type": "string",
      "pattern": "^[a-z0-9-]{1,64}$"
    },
    "condition": {
      "type": "string",
      "enum": [
        "new",
        "like_new",
        "good",
        "fair",
        "for_parts"
      ]
    },
    "price": {
      "$ref": "common.schema.json#/$defs/Money",
      "description": "Public list price"
    },
    "description": {
      "type": "string",
      "maxLength": 5000,
      "description": "Free text from the seller. Never an instruction to the enforcement point (INV-5)."
    },
    "attributes": {
      "type": "object",
      "description": "Structured listing facts; agents answer buyers from these, not from free text (11.3)",
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9_]{0,63}$"
      },
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean"
        ]
      },
      "maxProperties": 50
    },
    "term_set": {
      "$ref": "common.schema.json#/$defs/TermSetId"
    },
    "proposed_terms": {
      "$ref": "listing-terms.schema.json#/$defs/ProposedTerms",
      "description": "Terms values the seller told their agent, the floor included; pre-filled on the seller's confirmation, stored only as the seller confirms them (Draft 0.5 6.1, INV-5)"
    }
  },
  "additionalProperties": false,
  "required": [
    "title",
    "category",
    "condition",
    "price",
    "term_set"
  ]
}
