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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
//! Builder module for programmatic OpenSCENARIO construction
//!
//! This module provides a comprehensive, type-safe API for building OpenSCENARIO documents
//! programmatically. The builder system uses compile-time state validation to ensure
//! scenarios are constructed correctly and completely.
//!
//! # Key Features
//!
//! - **Type-safe construction** - Invalid operations are caught at compile time
//! - **Fluent API** - Chainable methods for readable code
//! - **Comprehensive coverage** - All OpenSCENARIO elements supported
//! - **Validation** - Built-in validation during construction
//! - **Templates** - Pre-built patterns for common scenarios
//!
//! # Quick Start
//!
//! ```rust
//! use openscenario_rs::builder::ScenarioBuilder;
//! use openscenario_rs::types::enums::ParameterType;
//!
//! // Build a complete scenario
//! let scenario = ScenarioBuilder::new()
//! .with_header("Highway Merge Test", "Test Engineer")
//! .add_parameter("initial_speed", ParameterType::Double, "25.0")
//! .with_entities()
//! .add_vehicle("ego_vehicle", |v| v.car())
//! .add_vehicle("target_vehicle", |v| v.truck())
//! .with_storyboard(|storyboard| {
//! storyboard
//! })
//! .build()
//! .unwrap();
//! ```
//!
//! # Builder Categories
//!
//! ## Core Builders
//!
//! - [`ScenarioBuilder`] - Main entry point for scenario construction
//! - [`VehicleBuilder`] - Vehicle entity creation and configuration
//! - [`StoryboardBuilder`] - Storyboard structure and flow control
//!
//! ## Action Builders
//!
//! - [`SpeedActionBuilder`] - Vehicle speed control actions
//! - [`TeleportActionBuilder`] - Entity positioning actions
//! - [`LaneChangeActionBuilder`] - Lane change maneuvers
//! - [`EnvironmentActionBuilder`] - Environment and weather control
//!
//! ## Condition Builders
//!
//! - [`TriggerBuilder`] - Event triggering logic
//! - [`SpeedConditionBuilder`] - Speed-based triggers
//! - [`TimeConditionBuilder`] - Time-based triggers
//! - [`RelativeDistanceConditionBuilder`] - Distance-based triggers
//!
//! ## Utility Builders
//!
//! - [`CatalogLocationsBuilder`] - Catalog reference management
//! - [`ParameterDeclarationsBuilder`] - Parameter definition
//! - [`InitActionBuilder`] - Initial entity setup
//!
//! # Advanced Usage
//!
//! ## Parameterized Scenarios
//!
//! ```rust
//! use openscenario_rs::builder::ScenarioBuilder;
//! use openscenario_rs::types::enums::ParameterType;
//!
//! let scenario = ScenarioBuilder::new()
//! .with_header("Parameterized Test", "Engineer")
//! .add_parameter("target_speed", ParameterType::Double, "30.0")
//! .add_parameter("following_distance", ParameterType::Double, "50.0")
//! .with_entities()
//! .add_vehicle("ego", |v| v.car())
//! .with_storyboard(|storyboard| {
//! storyboard
//! })
//! .build()
//! .unwrap();
//! ```
//!
//! ## Template-Based Construction
//!
//! ```rust
//! use openscenario_rs::builder::templates::{BasicScenarioTemplate, ScenarioTemplate};
//!
//! // Use predefined templates for common patterns
//! let template_builder = BasicScenarioTemplate::create();
//! let scenario = template_builder
//! .with_storyboard(|storyboard| {
//! // Configure storyboard with your scenario logic
//! storyboard
//! })
//! .build()
//! .unwrap();
//! ```
//!
//! ## Detached Builders
//!
//! For complex scenarios, you can use detached builders:
//!
//! ```rust
//! use openscenario_rs::builder::{DetachedVehicleBuilder, DetachedManeuverBuilder};
//! use openscenario_rs::ScenarioBuilder;
//!
//! // Build components separately
//! let ego_vehicle = DetachedVehicleBuilder::new("ego")
//! .car()
//! .build();
//!
//! let speed_maneuver = DetachedManeuverBuilder::new("speed_up", "ego")
//! .build();
//!
//! // Combine into scenario using closure-based builders
//! let scenario = ScenarioBuilder::new()
//! .with_header("Complex Test", "Engineer")
//! .with_entities()
//! .add_vehicle("ego", |v| v.car())
//! .with_storyboard(|storyboard| {
//! storyboard
//! })
//! .build()
//! .unwrap();
//! ```
//!
//! # Validation and Error Handling
//!
//! ```rust
//! use openscenario_rs::builder::{ScenarioBuilder, BuilderError};
//!
//! match ScenarioBuilder::new()
//! .with_header("Test", "Engineer")
//! .with_entities()
//! .add_vehicle("ego", |v| v.car())
//! .with_storyboard(|storyboard| {
//! storyboard
//! })
//! .build()
//! {
//! Ok(scenario) => {
//! println!("Scenario built successfully!");
//! // Use scenario...
//! }
//! Err(BuilderError::MissingField { field, .. }) => {
//! eprintln!("Missing required field: {}", field);
//! }
//! Err(e) => {
//! eprintln!("Builder error: {}", e);
//! }
//! }
//! ```
//!
//! # Performance Tips
//!
//! - Use detached builders for reusable components
//! - Build templates once and reuse for similar scenarios
//! - Use parameter references instead of literal values for flexibility
//! - Validate during construction rather than after building
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ScenarioBuilder;
pub use ;
pub use ;
pub use ;