{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://th-hotel.local/schemas/booking-business-agent-compact-input-v1.schema.json", "title": "Booking Business Agent Compact Input V1", "type": "object", "additionalProperties": false, "required": [ "contract_name", "output_contract_name", "source_input_hash", "contract_meta", "current_message", "email_history", "attachments", "direction", "decision_units", "semantic_materials", "relationships", "rooming_list_options", "input_issues" ], "properties": { "contract_name": { "const": "booking-business-agent-compact-input-v1" }, "output_contract_name": { "const": "booking-business-agent-compact-decision-v1" }, "source_input_hash": { "$ref": "#/$defs/sha256" }, "contract_meta": { "type": "object", "additionalProperties": false, "required": [ "contract_version", "catalog_version", "parser_version", "agent_profile_version", "processing_run_id", "source_message_id", "source_revision" ], "properties": { "contract_version": { "const": "booking-contracts-v2" }, "catalog_version": { "$ref": "#/$defs/nonBlank" }, "parser_version": { "$ref": "#/$defs/nonBlank" }, "agent_profile_version": { "$ref": "#/$defs/nonBlank" }, "processing_run_id": { "$ref": "#/$defs/nonBlank" }, "source_message_id": { "$ref": "#/$defs/nonBlank" }, "source_revision": { "type": "integer", "minimum": 0 } } }, "current_message": { "type": "object", "additionalProperties": false, "required": ["subject_ref", "subject", "body_ref", "body_text"], "properties": { "subject_ref": { "$ref": "#/$defs/sourceRef" }, "subject": { "type": "string" }, "body_ref": { "$ref": "#/$defs/sourceRef" }, "body_text": { "type": "string" } } }, "email_history": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["ref", "sequence", "body_text"], "properties": { "ref": { "$ref": "#/$defs/sourceRef" }, "sequence": { "type": "integer", "minimum": 0 }, "body_text": { "type": "string" } } } }, "attachments": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["attachment_ref", "file_name", "media_type"], "properties": { "attachment_ref": { "$ref": "#/$defs/sourceRef" }, "file_name": { "type": "string" }, "media_type": { "$ref": "#/$defs/nonBlank" } } } }, "direction": { "type": "object", "additionalProperties": false, "required": ["source_direction", "confidence"], "properties": { "source_direction": { "enum": ["INBOUND", "OUTBOUND", "INTERNAL", "UNKNOWN"] }, "confidence": { "enum": ["EXACT", "UNRESOLVED", "CONFLICT"] } } }, "decision_units": { "type": "array", "items": { "$ref": "#/$defs/decisionUnit" } }, "semantic_materials": { "type": "array", "items": { "$ref": "#/$defs/semanticMaterial" } }, "relationships": { "type": "array", "items": { "$ref": "#/$defs/relationship" } }, "rooming_list_options": { "type": "array", "items": { "$ref": "#/$defs/roomingOption" } }, "input_issues": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["code", "severity", "scope", "target_ref"], "properties": { "code": { "$ref": "#/$defs/nonBlank" }, "severity": { "enum": ["INFO", "WARNING", "ERROR", "BLOCKER"] }, "scope": { "enum": ["MESSAGE", "MATERIAL", "TARGET", "FIELD", "RELATIONSHIP"] }, "target_ref": { "$ref": "#/$defs/nullableSourceRef" } } } } }, "$defs": { "nonBlank": { "type": "string", "minLength": 1 }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "sourceRef": { "type": "string", "pattern": "^[A-Z][1-9][0-9]*$" }, "nullableSourceRef": { "anyOf": [ { "$ref": "#/$defs/sourceRef" }, { "type": "null" } ] }, "nullableString": { "type": ["string", "null"] }, "actionSignal": { "type": "object", "additionalProperties": false, "required": ["role", "source_value", "value"], "properties": { "role": { "$ref": "#/$defs/nonBlank" }, "source_value": {}, "value": {} } }, "room": { "type": "object", "additionalProperties": false, "required": [ "room_ref", "source_room_raw", "source_room_name", "quantity", "resolved_room_type", "room_type_status" ], "properties": { "room_ref": { "$ref": "#/$defs/sourceRef" }, "source_room_raw": { "$ref": "#/$defs/nullableString" }, "source_room_name": { "$ref": "#/$defs/nullableString" }, "quantity": { "type": ["integer", "null"], "minimum": 1 }, "resolved_room_type": { "$ref": "#/$defs/nullableString" }, "room_type_status": { "enum": ["RESOLVED", "UNRESOLVED", "NOT_APPLICABLE"] } } }, "rateStatus": { "type": "object", "additionalProperties": false, "required": ["booking_types", "status", "reason_code"], "properties": { "booking_types": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["FIT", "GROUP"] } }, "status": { "enum": ["RESOLVED", "UNRESOLVED", "NOT_APPLICABLE"] }, "reason_code": { "$ref": "#/$defs/nonBlank" } } }, "decisionUnit": { "type": "object", "additionalProperties": false, "required": [ "unit_ref", "target_ref", "group_code", "source_profile_code", "action_signals", "arrival_date", "departure_date", "rooms", "rate_option_status" ], "properties": { "unit_ref": { "$ref": "#/$defs/sourceRef" }, "target_ref": { "$ref": "#/$defs/sourceRef" }, "group_code": { "$ref": "#/$defs/nullableString" }, "source_profile_code": { "enum": ["QBD", "LIANTAI"] }, "action_signals": { "type": "array", "items": { "$ref": "#/$defs/actionSignal" } }, "arrival_date": { "$ref": "#/$defs/nullableString" }, "departure_date": { "$ref": "#/$defs/nullableString" }, "rooms": { "type": "array", "items": { "$ref": "#/$defs/room" } }, "rate_option_status": { "type": "array", "items": { "$ref": "#/$defs/rateStatus" } } } }, "semanticMaterial": { "type": "object", "required": ["ref", "kind", "target_ref"], "properties": { "ref": { "$ref": "#/$defs/sourceRef" }, "kind": { "$ref": "#/$defs/nonBlank" }, "target_ref": { "$ref": "#/$defs/nullableSourceRef" }, "semantic_code": { "type": "string" }, "scope": { "type": "string" }, "content": {}, "source_label": { "type": "string" }, "text": { "type": "string" } }, "additionalProperties": false }, "relationship": { "type": "object", "additionalProperties": false, "required": [ "relationship_ref", "relationship_type", "from_target_ref", "from_group_code", "to_target_ref", "to_group_code" ], "properties": { "relationship_ref": { "$ref": "#/$defs/sourceRef" }, "relationship_type": { "enum": [ "ALLOTMENT_SOURCE_TO_ACTUAL", "GROUP_CODE_REPLACEMENT", "SOURCE_TO_TARGET", "OTHER_NEUTRAL" ] }, "from_target_ref": { "$ref": "#/$defs/sourceRef" }, "from_group_code": { "$ref": "#/$defs/nullableString" }, "to_target_ref": { "$ref": "#/$defs/sourceRef" }, "to_group_code": { "$ref": "#/$defs/nullableString" } } }, "roomingOption": { "type": "object", "additionalProperties": false, "required": [ "rooming_ref", "attachment_ref", "current_excel", "rooming_list_label", "tour_code", "target_status", "reason_code" ], "properties": { "rooming_ref": { "$ref": "#/$defs/sourceRef" }, "attachment_ref": { "$ref": "#/$defs/sourceRef" }, "current_excel": { "type": "boolean" }, "rooming_list_label": { "type": "boolean" }, "tour_code": { "$ref": "#/$defs/nullableString" }, "target_status": { "enum": ["RESOLVED", "UNRESOLVED", "NOT_APPLICABLE"] }, "reason_code": { "$ref": "#/$defs/nonBlank" } } } } }