{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://cityresourcegraph.com/schemas/match.json", "title": "Match Entity", "description": "Match between resource flows with state management and conflict resolution", "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique match identifier" }, "compatibility_score": { "type": "number", "minimum": 0, "maximum": 1, "description": "Overall compatibility score (0-1)" }, "economic_value": { "type": "number", "description": "Estimated annual economic value (€)" }, "distance_km": { "type": "number", "minimum": 0, "description": "Distance between sites (km)" }, "source_resource_id": { "type": "string", "format": "uuid", "description": "Source resource flow ID" }, "target_resource_id": { "type": "string", "format": "uuid", "description": "Target resource flow ID" }, "status": { "type": "string", "enum": ["suggested", "negotiating", "reserved", "contracted", "live", "failed", "cancelled"], "default": "suggested", "description": "Current match state" }, "priority": { "type": "integer", "minimum": 1, "maximum": 10, "description": "Match priority (higher number = higher priority)" }, "reserved_until": { "type": "string", "format": "date-time", "description": "When reservation expires (for reserved status)" }, "transportation_estimate": { "type": "object", "properties": { "cost_per_year": {"type": "number"}, "method": {"type": "string"}, "feasibility_score": {"type": "number", "minimum": 0, "maximum": 1} } }, "risk_assessment": { "type": "object", "properties": { "technical_risk": {"type": "number", "minimum": 0, "maximum": 1}, "regulatory_risk": {"type": "number", "minimum": 0, "maximum": 1}, "market_risk": {"type": "number", "minimum": 0, "maximum": 1} } }, "negotiation_history": { "type": "array", "items": { "type": "object", "properties": { "timestamp": {"type": "string", "format": "date-time"}, "actor": {"type": "string", "format": "uuid"}, "action": {"type": "string"}, "notes": {"type": "string", "maxLength": 1000} }, "required": ["timestamp", "actor", "action"] }, "description": "History of negotiation activities" }, "contract_details": { "type": "object", "properties": { "contract_id": {"type": "string", "format": "uuid"}, "signed_at": {"type": "string", "format": "date-time"}, "effective_from": {"type": "string", "format": "date-time"}, "value_per_year": {"type": "number"}, "terms_url": {"type": "string", "format": "uri"} }, "description": "Contract details when status is contracted or live" }, "failure_reason": { "type": "string", "maxLength": 500, "description": "Reason for failure (when status is failed)" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": ["id", "compatibility_score", "economic_value", "source_resource_id", "target_resource_id"], "additionalProperties": false }