Files
th-hotel-simple/docs/project/requirements/schemas/booking-business-agent-compact-decision-v1.schema.json
T
鲨鱼辣椒 694c4317a3 checkpoint: complete recoverable V2 pre-separation baseline
Complete the selective V2 checkpoint with its minimal AgentBus, object-storage, replay persistence, and validated-workbench shared dependency closure.
2026-08-20 17:09:00 +08:00

251 lines
7.8 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://th-hotel.local/schemas/booking-business-agent-compact-decision-v1.schema.json",
"title": "Booking Business Agent Compact Decision V1",
"type": "object",
"additionalProperties": false,
"required": [
"contract_name",
"ignored_direction",
"decisions",
"derived_actions",
"risk_items",
"unclassified_texts"
],
"properties": {
"contract_name": { "const": "booking-business-agent-compact-decision-v1" },
"ignored_direction": { "type": "boolean" },
"decisions": {
"type": "array",
"items": { "$ref": "#/$defs/decision" }
},
"derived_actions": {
"type": "array",
"items": { "$ref": "#/$defs/derivedAction" }
},
"risk_items": {
"type": "array",
"items": { "$ref": "#/$defs/riskItem" }
},
"unclassified_texts": {
"type": "array",
"items": { "$ref": "#/$defs/unclassifiedText" }
}
},
"allOf": [
{
"if": {
"properties": { "ignored_direction": { "const": true } },
"required": ["ignored_direction"]
},
"then": {
"properties": {
"decisions": { "maxItems": 0 },
"derived_actions": { "maxItems": 0 },
"risk_items": { "maxItems": 0 },
"unclassified_texts": { "maxItems": 0 }
}
}
}
],
"$defs": {
"nonBlank": { "type": "string", "minLength": 1 },
"sourceRef": { "type": "string", "pattern": "^[A-Z][1-9][0-9]*$" },
"nullableSourceRef": {
"anyOf": [
{ "$ref": "#/$defs/sourceRef" },
{ "type": "null" }
]
},
"sourceRefs": {
"type": "array",
"uniqueItems": true,
"items": { "$ref": "#/$defs/sourceRef" }
},
"traceItem": {
"type": "object",
"additionalProperties": false,
"required": ["service_type", "service_text", "room_type", "quantity", "source_refs"],
"properties": {
"service_type": { "enum": ["GENERAL_SERVICE", "EXTRA_BED"] },
"service_text": { "$ref": "#/$defs/nonBlank" },
"room_type": { "type": ["string", "null"] },
"quantity": { "type": ["number", "null"], "exclusiveMinimum": 0 },
"source_refs": { "$ref": "#/$defs/sourceRefs" }
}
},
"decision": {
"type": "object",
"additionalProperties": false,
"required": [
"decision_ref",
"business_type",
"unit_ref",
"target_ref",
"booking_type",
"trace_items",
"department_code",
"rooming_ref",
"linked_relationship_refs",
"source_refs"
],
"properties": {
"decision_ref": { "$ref": "#/$defs/nonBlank" },
"business_type": {
"enum": [
"NEW_BOOKING",
"UPDATE_BOOKING",
"CANCEL_BOOKING",
"TRACE_RESERVATION_NOTES",
"ROOMING_LIST"
]
},
"unit_ref": { "$ref": "#/$defs/nullableSourceRef" },
"target_ref": { "$ref": "#/$defs/nullableSourceRef" },
"booking_type": { "enum": ["FIT", "GROUP", null] },
"trace_items": {
"type": "array",
"items": { "$ref": "#/$defs/traceItem" }
},
"department_code": { "enum": ["FO", "FO+HSK", null] },
"rooming_ref": { "$ref": "#/$defs/nullableSourceRef" },
"linked_relationship_refs": { "$ref": "#/$defs/sourceRefs" },
"source_refs": { "$ref": "#/$defs/sourceRefs" }
},
"allOf": [
{
"if": {
"properties": {
"business_type": { "enum": ["NEW_BOOKING", "UPDATE_BOOKING"] }
},
"required": ["business_type"]
},
"then": {
"properties": {
"unit_ref": { "$ref": "#/$defs/sourceRef" },
"target_ref": { "type": "null" },
"trace_items": { "maxItems": 0 },
"department_code": { "type": "null" },
"rooming_ref": { "type": "null" }
}
}
},
{
"if": {
"properties": { "business_type": { "const": "CANCEL_BOOKING" } },
"required": ["business_type"]
},
"then": {
"properties": {
"unit_ref": { "$ref": "#/$defs/sourceRef" },
"target_ref": { "type": "null" },
"booking_type": { "type": "null" },
"trace_items": { "maxItems": 0 },
"department_code": { "type": "null" },
"rooming_ref": { "type": "null" }
}
}
},
{
"if": {
"properties": { "business_type": { "const": "TRACE_RESERVATION_NOTES" } },
"required": ["business_type"]
},
"then": {
"properties": {
"unit_ref": { "type": "null" },
"target_ref": { "$ref": "#/$defs/sourceRef" },
"booking_type": { "type": "null" },
"trace_items": { "minItems": 1 },
"rooming_ref": { "type": "null" }
}
}
},
{
"if": {
"properties": { "business_type": { "const": "ROOMING_LIST" } },
"required": ["business_type"]
},
"then": {
"properties": {
"unit_ref": { "type": "null" },
"target_ref": { "type": "null" },
"booking_type": { "type": "null" },
"trace_items": { "maxItems": 0 },
"department_code": { "type": "null" },
"rooming_ref": { "$ref": "#/$defs/sourceRef" },
"linked_relationship_refs": { "maxItems": 0 }
}
}
}
]
},
"derivedAction": {
"type": "object",
"additionalProperties": false,
"required": [
"derived_ref",
"derived_action_type",
"source_target_ref",
"actual_decision_ref",
"source_refs"
],
"properties": {
"derived_ref": { "$ref": "#/$defs/nonBlank" },
"derived_action_type": {
"enum": ["ALLOTMENT_SOURCE_DEDUCTION", "ALLOTMENT_SOURCE_WHOLE_CANCEL"]
},
"source_target_ref": { "$ref": "#/$defs/nonBlank" },
"actual_decision_ref": { "type": ["string", "null"], "minLength": 1 },
"source_refs": { "$ref": "#/$defs/sourceRefs" }
},
"allOf": [
{
"if": {
"properties": {
"derived_action_type": { "const": "ALLOTMENT_SOURCE_DEDUCTION" }
},
"required": ["derived_action_type"]
},
"then": {
"properties": { "actual_decision_ref": { "$ref": "#/$defs/nonBlank" } }
}
},
{
"if": {
"properties": {
"derived_action_type": { "const": "ALLOTMENT_SOURCE_WHOLE_CANCEL" }
},
"required": ["derived_action_type"]
},
"then": {
"properties": { "actual_decision_ref": { "type": "null" } }
}
}
]
},
"riskItem": {
"type": "object",
"additionalProperties": false,
"required": ["risk_ref", "risk_code", "target_ref", "source_text", "source_refs"],
"properties": {
"risk_ref": { "$ref": "#/$defs/nonBlank" },
"risk_code": { "$ref": "#/$defs/nonBlank" },
"target_ref": { "$ref": "#/$defs/nullableSourceRef" },
"source_text": { "type": ["string", "null"] },
"source_refs": { "$ref": "#/$defs/sourceRefs" }
}
},
"unclassifiedText": {
"type": "object",
"additionalProperties": false,
"required": ["text_ref", "original_text", "source_refs"],
"properties": {
"text_ref": { "$ref": "#/$defs/nonBlank" },
"original_text": { "$ref": "#/$defs/nonBlank" },
"source_refs": { "$ref": "#/$defs/sourceRefs" }
}
}
}
}