version: "1.0"

service:
  name: municipal-transit-planner
  environment: production
  region: ca-central
  timezone: America/Toronto
  public_url: https://tripplanner.city.example.ca
  bind_address: 0.0.0.0
  port: 8080
  graceful_shutdown_seconds: 30

routing:
  modes:
    - walk
    - bus
    - streetcar
    - subway
    - ferry
  max_itineraries: 5
  max_trip_duration_minutes: 180
  max_walk_distance_meters: 1600
  wheelchair_accessible_default: false
  transfer_penalty_seconds: 300
  minimum_transfer_time_seconds: 120
  walking_speed_meters_per_second: 1.33
  cycling_speed_meters_per_second: 4.2
  arrive_by_enabled: true
  realtime_enabled: true

data_sources:
  gtfs_static:
    url: https://opendata.city.example.ca/transit/gtfs.zip
    refresh_schedule: "0 3 * * *"
    validation:
      reject_expired_feed: true
      maximum_feed_age_hours: 48
  gtfs_realtime:
    trip_updates_url: https://api.city.example.ca/gtfs-rt/trip-updates
    vehicle_positions_url: https://api.city.example.ca/gtfs-rt/vehicle-positions
    service_alerts_url: https://api.city.example.ca/gtfs-rt/service-alerts
    poll_interval_seconds: 30
    timeout_seconds: 10
  street_network:
    source: openstreetmap
    extract_url: https://download.geofabrik.de/north-america/canada/ontario-latest.osm.pbf
    refresh_schedule: "0 2 * * 0"

service_area:
  name: Example City
  country: CA
  boundary_file: /etc/transit-planner/service-area.geojson
  default_location:
    latitude: 43.6532
    longitude: -79.3832
  supported_locales:
    - en-CA
    - fr-CA
  default_locale: en-CA

accessibility:
  include_step_free_routes: true
  include_elevator_status: true
  maximum_slope_percent: 8
  avoid_stairs_when_wheelchair_accessible: true
  accessibility_alert_priority: high

api:
  cors:
    allowed_origins:
      - https://www.city.example.ca
      - https://tripplanner.city.example.ca
    allowed_methods:
      - GET
      - POST
      - OPTIONS
  rate_limits:
    anonymous_requests_per_minute: 120
    authenticated_requests_per_minute: 600
  request_timeout_seconds: 20
  maximum_page_size: 100

cache:
  provider: redis
  url: redis://transit-planner-redis:6379/0
  route_ttl_seconds: 120
  stop_ttl_seconds: 3600
  realtime_ttl_seconds: 45

database:
  driver: postgresql
  host: transit-planner-db
  port: 5432
  name: transit_planner
  username: transit_planner
  password_env: TRANSIT_PLANNER_DB_PASSWORD
  ssl_mode: require
  pool:
    minimum_connections: 5
    maximum_connections: 30
    connection_timeout_seconds: 10

notifications:
  disruption_banner_enabled: true
  severe_alert_channels:
    - web
    - sms
    - email
  contact_email: transit-operations@city.example.ca

observability:
  log_level: info
  log_format: json
  metrics:
    enabled: true
    path: /metrics
  health_checks:
    liveness_path: /health/live
    readiness_path: /health/ready
  tracing:
    enabled: true
    exporter: otlp
    endpoint: http://otel-collector:4317
    sample_rate: 0.1

privacy:
  retain_search_history: false
  anonymize_ip_addresses: true
  analytics_retention_days: 30
  redact_query_parameters:
    - origin
    - destination
    - api_key

maintenance:
  graph_rebuild_schedule: "30 3 * * *"
  retain_graph_versions: 3
  failover_to_previous_graph: true
  planned_outage_message: "Trip planning is temporarily unavailable during scheduled maintenance."