1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! Core types for the persistence layer.
//!
//! This module provides the fundamental types used throughout the persistence layer:
//!
//! - [`StoredResource`] - A FHIR resource with persistence metadata
//! - [`SearchParameter`], [`SearchQuery`] - Search parameter types
//! - [`Pagination`], [`PageCursor`] - Pagination types
//! - [`SearchBundle`] - FHIR Bundle for search results
//!
//! # Examples
//!
//! ## Creating a Stored Resource
//!
//! ```
//! use helios_persistence::types::StoredResource;
//! use helios_persistence::tenant::TenantId;
//! use helios_fhir::FhirVersion;
//! use serde_json::json;
//!
//! let resource = StoredResource::new(
//! "Patient",
//! "patient-123",
//! TenantId::new("acme"),
//! json!({
//! "resourceType": "Patient",
//! "id": "patient-123",
//! "name": [{"family": "Smith", "given": ["John"]}]
//! }),
//! FhirVersion::default(),
//! );
//!
//! assert_eq!(resource.url(), "Patient/patient-123");
//! assert_eq!(resource.version_id(), "1");
//! ```
//!
//! ## Building a Search Query
//!
//! ```
//! use helios_persistence::types::{
//! SearchQuery, SearchParameter, SearchParamType, SearchValue, SortDirective
//! };
//!
//! let query = SearchQuery::new("Patient")
//! .with_parameter(SearchParameter {
//! name: "name".to_string(),
//! param_type: SearchParamType::String,
//! modifier: None,
//! values: vec![SearchValue::eq("Smith")],
//! chain: vec![],
//! components: vec![],
//! })
//! .with_sort(SortDirective::parse("-_lastUpdated"))
//! .with_count(20);
//! ```
//!
//! ## Pagination
//!
//! ```
//! use helios_persistence::types::{Pagination, PageCursor, CursorValue};
//!
//! // Cursor-based pagination (recommended)
//! let pagination = Pagination::cursor().with_count(50);
//!
//! // Create a cursor for the next page
//! let cursor = PageCursor::new(
//! vec![CursorValue::from("2024-01-15T10:30:00Z")],
//! "resource-id",
//! );
//! let encoded = cursor.encode();
//!
//! // Parse cursor from request
//! let decoded = PageCursor::decode(&encoded).unwrap();
//! ```
pub use ;
pub use ;
pub use ;
pub use ;