graph TD
A[DataCollectorAgent Start] --> B[Load Configuration]
B --> C[Load Campaign Settings]
B --> D[Load API Credentials]
C --> E[Initialize Data Collection]
D --> E
E --> F[Data Retrieval Silo]
F --> G[Connect to Ad Platform API]
G --> H[Fetch Daily Metrics]
H --> I[Store Raw Data]
I --> J[JSON Creation Silo]
J --> K[Format Raw Data]
K --> L[Calculate Conversion Rates]
L --> M[Structure JSON Output]
M --> N[Generate daily_metrics.json]
N --> O[Validate JSON Structure]
O --> P{Valid JSON?}
P -->|Yes| Q[Save Final Output]
P -->|No| K
Q --> R[Update Campaign Metrics]
R --> S{Campaign Complete?}
S -->|No| T[Wait for Next Day]
T --> E
S -->|Yes| U[DataCollectorAgent End]