ProofedMesh/schemas/sink/db/expense/v1.2.0.json

101 lines
4.9 KiB
JSON
Raw Permalink Normal View History

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://basicstack.de/schemas/sink/db/expense/v1.2.0.json",
"title": "Sink Payload: sink:expense-db-app, action expense.post v1.2.0",
"description": "Additive gegenüber v1.1.0: items[] können PER_DIEM_* Typen tragen, items[] können receipt_content_hash + receipt_attestation_ref + computed_from mitführen. allocations[]-Vertrag unverändert (absolut, Summenerhalt pro Item).",
"type": "object",
"additionalProperties": false,
"required": ["schema", "workflow_id", "approval_id", "decision_id", "verification_ref", "canonical_payload_hash", "expense"],
"properties": {
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["name", "version"],
"properties": {
"name": { "const": "sink.db.expense" },
"version": { "const": "1.2.0" }
}
},
"workflow_id": { "type": "string", "pattern": "^WF-[0-9]{4}-[0-9]{4,}$" },
"approval_id": { "type": "string", "pattern": "^APR-[0-9]{4}-[0-9]{4,}$" },
"decision_id": { "type": "string", "pattern": "^DEC-[0-9]{4}-[0-9]{4,}$" },
"verification_ref": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"canonical_payload_hash": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"expense": {
"type": "object",
"additionalProperties": false,
"required": ["employee_id", "currency", "total_amount", "trip", "items"],
"properties": {
"employee_id": { "type": "string", "pattern": "^EMP-[0-9]+$" },
"currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
"total_amount": { "type": "string", "pattern": "^-?[0-9]+\\.[0-9]{2}$" },
"trip": {
"type": "object",
"additionalProperties": false,
"required": ["start_date", "end_date", "destination"],
"properties": {
"start_date": { "type": "string", "format": "date" },
"end_date": { "type": "string", "format": "date" },
"destination": { "type": "string", "maxLength": 200 },
"purpose": { "type": "string", "maxLength": 500 }
}
},
"items": {
"type": "array",
"minItems": 1,
"maxItems": 200,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["type", "amount", "incurred_on", "allocations"],
"properties": {
"type": {
"type": "string",
"enum": [
"HOTEL", "MEALS", "TRANSPORT_FLIGHT", "TRANSPORT_RAIL", "TRANSPORT_CAR",
"PARKING", "COMMUNICATION", "CONFERENCE_FEE", "OTHER",
"PER_DIEM_FULL", "PER_DIEM_PARTIAL", "PER_DIEM_ARRIVAL", "PER_DIEM_DEPARTURE"
]
},
"amount": { "type": "string", "pattern": "^-?[0-9]+\\.[0-9]{2}$" },
"incurred_on": { "type": "string", "format": "date" },
"description": { "type": "string", "maxLength": 500 },
"receipt_ref": { "type": "string", "pattern": "^pii://[A-Za-z0-9/._-]+$" },
"receipt_content_hash": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"receipt_attestation_ref":{ "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"computed_from": {
"type": "object",
"additionalProperties": false,
"required": ["transform_attestation_ref"],
"properties": {
"transform_attestation_ref": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"rate_query_attestation_ref": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"rate_id": { "type": "string", "pattern": "^PDR-[0-9]+$" }
}
},
"allocations": {
"type": "array",
"minItems": 1,
"maxItems": 50,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["project_code", "cost_center", "gl_account", "amount", "source_attestation_ref"],
"properties": {
"project_code": { "type": "string", "pattern": "^P-[0-9]+$" },
"cost_center": { "type": "string", "pattern": "^CC-[0-9]+$" },
"gl_account": { "type": "string", "pattern": "^[0-9]{4,6}$" },
"amount": { "type": "string", "pattern": "^-?[0-9]+\\.[0-9]{2}$" },
"percentage": { "type": "string", "pattern": "^(100\\.00|[0-9]{1,2}\\.[0-9]{2})$" },
"source_attestation_ref": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
}
}
}
}
}
}
}
}
}
}