version: "1.0"

service:
  name: municipal-transit-planner
  environment: production
  region: ca-central
  timezone: America/Toronto
  log_level: info

server:
  host: 0.0.0.0
  port: 8080
  request_timeout_seconds: 30
  graceful_shutdown_seconds: 20

planning:
  modes:
    - bus
    - streetcar
    - subway
    - light_rail
    - ferry
    - walking
    - cycling
  max_itineraries: 5
  max_transfers: 3
  max_walking_distance_meters: 1200
  wheelchair_accessible_by_default: false
  transfer_penalty_seconds: 300
  boarding_slack_seconds: 90
  realtime_updates: true

data_sources:
  gtfs_static:
    url: https://data.example.gov/transit/gtfs.zip
    refresh_schedule: "0 3 * * *"
    validation:
      reject_expired_feeds: true
      maximum_feed_age_hours: 48
  gtfs_realtime:
    trip_updates_url: https://api.example.gov/transit/gtfs-rt/trip-updates
    vehicle_positions_url: https://api.example.gov/transit/gtfs-rt/vehicle-positions
    service_alerts_url: https://api.example.gov/transit/gtfs-rt/alerts
    poll_interval_seconds: 20
  street_network:
    provider: openstreetmap
    extract_path: /var/lib/transit/maps/municipality.osm.pbf
    refresh_schedule: "0 2 * * 0"

database:
  driver: postgresql
  host: transit-db.internal
  port: 5432
  name: transit_planner
  username: transit_service
  password_env: TRANSIT_DATABASE_PASSWORD
  pool:
    minimum_connections: 5
    maximum_connections: 30
    idle_timeout_seconds: 300
  tls:
    enabled: true
    mode: verify-full
    ca_file: /etc/transit/certs/database-ca.pem

cache:
  provider: redis
  url_env: TRANSIT_REDIS_URL
  route_ttl_seconds: 60
  stop_departure_ttl_seconds: 15
  namespace: municipal-transit-planner

service_hours:
  weekday:
    start: "04:30"
    end: "02:30"
  saturday:
    start: "05:00"
    end: "02:30"
  sunday:
    start: "06:00"
    end: "01:30"

fares:
  currency: CAD
  adult:
    single_ride: 3.35
    transfer_window_minutes: 120
  senior:
    single_ride: 2.30
    minimum_age: 65
  youth:
    single_ride: 2.30
    maximum_age: 19
  children:
    single_ride: 0.00
    maximum_age: 12

accessibility:
  step_free_routing: supported
  include_elevator_outages: true
  minimum_transfer_time_seconds: 240
  avoid_stairs_when_requested: true
  announce_accessibility_warnings: true

alerts:
  enabled: true
  minimum_severity: warning
  notification_channels:
    - type: webhook
      url_env: OPERATIONS_WEBHOOK_URL
    - type: email
      recipients:
        - transit-operations@example.gov

observability:
  health_endpoint: /health
  readiness_endpoint: /ready
  metrics:
    enabled: true
    endpoint: /metrics
    format: prometheus
  tracing:
    enabled: true
    exporter: otlp
    endpoint_env: OTEL_EXPORTER_OTLP_ENDPOINT
    sample_rate: 0.1
  structured_logging: true

security:
  api_authentication:
    type: oauth2
    issuer_url: https://identity.example.gov
    audience: municipal-transit-planner
  rate_limits:
    anonymous_requests_per_minute: 60
    authenticated_requests_per_minute: 600
  allowed_origins:
    - https://transit.example.gov
    - https://operations.example.gov

retention:
  trip_queries_days: 30
  operational_metrics_days: 365
  anonymize_location_history: true

feature_flags:
  bike_share_connections: true
  demand_responsive_transit: false
  predictive_arrival_times: true
  fare_capping: false
  multilingual_service_alerts: true