# Architecture Validation Rules
# These constraints are checked by the validator agent against recommendations

[scale_requirements]
min_concurrent_users = 5000
max_concurrent_users = 100000
min_daily_active_users = 50000
max_daily_active_users = 1000000
min_data_volume_gb = 100
max_data_volume_gb = 1000000

[performance_requirements]
target_api_latency_ms = 200
acceptable_p99_latency_ms = 500
acceptable_p95_latency_ms = 400
minimum_availability_percentage = 99.9
acceptable_downtime_minutes_per_year = 43

[team_constraints]
team_size = 15
min_kubernetes_expertise = "familiar"
min_database_expertise = "intermediate"
available_on_call_engineers = 3

[budget_constraints]
min_annual_budget_usd = 100000
max_annual_budget_usd = 1000000
max_monthly_infrastructure_usd = 83333

[compliance_requirements]
required_certifications = ["GDPR", "SOC 2"]
data_residency = "US or EU"
encryption_required = true
audit_logging_required = true
backup_retention_days = 90

[database_constraints]
must_support_acid_transactions = true
must_support_multi_tenancy = true
must_support_full_text_search = true
must_support_real_time_queries = true
maximum_replication_lag_seconds = 5

[api_constraints]
must_support_real_time_subscriptions = true
must_support_multi_tenancy = true
self_documenting = true
caching_strategy_required = true

[deployment_constraints]
must_use_aws = true
must_support_auto_scaling = true
must_support_multi_availability_zone = true
disaster_recovery_rto_hours = 1
disaster_recovery_rpo_minutes = 30

[operational_constraints]
maximum_services_per_engineer = 5
required_deployment_frequency = "daily"
required_rollback_capability = true
maximum_mean_time_to_recovery_minutes = 15

[validation_rules]
# Database validation
database_can_handle_max_users = true
database_latency_acceptable = true
database_replication_lag_acceptable = true
database_backup_strategy_defined = true

# API validation
api_achieves_target_latency = true
api_provides_developer_experience = true
api_caching_strategy_viable = true
api_real_time_capability_present = true

# Deployment validation
deployment_team_can_operate = true
deployment_cost_within_budget = true
deployment_disaster_recovery_viable = true
deployment_compliance_possible = true

# Integration validation
components_work_together = true
no_major_architectural_conflicts = true
operational_tools_available = true
team_training_feasible = true

[risk_thresholds]
high_risk_if_operational_overhead_score = 8
medium_risk_if_cost_exceeds_monthly_usd = 20000
high_risk_if_team_expertise_gap = 3
medium_risk_if_technical_debt_accumulation_possible = true

[recommended_mitigations]
postgres_replica_lag = "Implement read-through cache (Redis) with TTL-based invalidation"
graphql_complexity = "Implement query depth limiting and complexity analysis"
kubernetes_operations = "Hire DevOps engineer or use managed control plane add-ons"
multi_tenancy_isolation = "Implement connection pooling per tenant with row-level security"
real_time_at_scale = "Use event streaming (Kafka) with WebSocket connection pooling"
