{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://shipping.gimmickguy.com/quote-request.schema.json",
  "title": "BASS-1 Shipment Quote Request",
  "description": "Request format for an authorized agent or human operator asking GGX for a local shipment quote or handoff confirmation.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "protocol",
    "service",
    "request_type",
    "coverage_area",
    "pickup",
    "dropoff",
    "item",
    "timing",
    "requester_contact",
    "user_authorized"
  ],
  "properties": {
    "protocol": {
      "const": "BASS-1"
    },
    "service": {
      "const": "bay_area_shipping_service"
    },
    "request_type": {
      "enum": ["shipment_quote", "shipment_handoff"]
    },
    "coverage_area": {
      "type": "string",
      "minLength": 2,
      "description": "Expected primary value is San Francisco. Broader Bay Area requests require explicit GGX confirmation."
    },
    "pickup": {
      "$ref": "#/$defs/location_contact"
    },
    "dropoff": {
      "$ref": "#/$defs/location_contact"
    },
    "item": {
      "type": "object",
      "additionalProperties": false,
      "required": ["description", "package_count"],
      "properties": {
        "description": {
          "type": "string",
          "minLength": 3
        },
        "package_count": {
          "type": "integer",
          "minimum": 1,
          "maximum": 25
        },
        "dimensions": {
          "type": "string"
        },
        "weight": {
          "type": "string"
        },
        "declared_constraints": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "timing": {
      "type": "string",
      "minLength": 3,
      "description": "Requested pickup or delivery window. GGX must confirm timing before it is treated as scheduled."
    },
    "reference_id": {
      "type": "string",
      "description": "Customer, order, or agent reference. Do not invent one if none exists."
    },
    "requester_contact": {
      "type": "string",
      "minLength": 3,
      "description": "Agent-monitored or user-approved reply contact."
    },
    "user_authorized": {
      "const": true,
      "description": "Must be true only after the user authorizes sharing the shipment details with GGX."
    },
    "agent_notes": {
      "type": "string"
    }
  },
  "$defs": {
    "location_contact": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "address"],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "address": {
          "type": "string",
          "minLength": 5
        },
        "contact": {
          "type": "string",
          "description": "Optional user-authorized contact method for coordination."
        },
        "notes": {
          "type": "string"
        }
      }
    }
  }
}
