version: "1.0"

service:
  name: regional-bike-share-api
  environment: production
  region: northeast
  owner: mobility-platform
  timezone: America/New_York

server:
  host: 0.0.0.0
  port: 8080
  request_timeout_ms: 12000
  graceful_shutdown_seconds: 30

database:
  primary:
    engine: postgres
    host: bikes-prod-db.internal
    port: 5432
    name: bike_share
    ssl_mode: require
    pool:
      min_connections: 8
      max_connections: 40
  replicas:
    - host: bikes-prod-db-ro-1.internal
      port: 5432
    - host: bikes-prod-db-ro-2.internal
      port: 5432

redis:
  host: bikes-prod-cache.internal
  port: 6379
  tls: true
  database: 0
  key_prefix: bikeshare:prod

regions:
  - code: BOS
    name: Greater Boston
    default_currency: USD
    service_area_km2: 415
  - code: PVD
    name: Providence Metro
    default_currency: USD
    service_area_km2: 92
  - code: MHT
    name: Manchester
    default_currency: USD
    service_area_km2: 58

stations:
  sync_interval_seconds: 30
  stale_station_threshold_seconds: 180
  low_bike_threshold: 4
  low_dock_threshold: 3
  rebalance:
    enabled: true
    planning_interval_minutes: 15
    truck_capacity_bikes: 28

bikes:
  unlock_timeout_seconds: 20
  idle_reservation_minutes: 10
  maintenance:
    mileage_interval_km: 350
    battery_low_percent: 18
    auto_disable_on_fault: true

pricing:
  currency: USD
  plans:
    casual:
      unlock_fee: 1.00
      per_minute: 0.18
    member:
      monthly_fee: 14.99
      unlock_fee: 0.00
      included_minutes_per_ride: 45
      overage_per_minute: 0.12

payments:
  provider: stripe
  capture_strategy: delayed
  preauthorization_amount: 25.00
  webhook_path: /webhooks/payments
  retry:
    max_attempts: 5
    backoff_seconds: 30

integrations:
  gbfs:
    enabled: true
    public_base_url: https://gbfs.ne-bikeshare.example.com
    refresh_seconds: 15
  maps:
    provider: mapbox
    geocoding_cache_ttl_hours: 24
  notifications:
    email_from: support@ne-bikeshare.example.com
    sms_enabled: true
    push_enabled: true

observability:
  metrics:
    enabled: true
    endpoint: /metrics
  tracing:
    enabled: true
    sampler_ratio: 0.15
  logging:
    level: info
    format: json
    redact_fields:
      - payment_method
      - phone_number
      - access_token

alerts:
  - name: station_inventory_stale
    severity: warning
    threshold_seconds: 300
    notify:
      - operations-oncall
  - name: unlock_failure_rate
    severity: critical
    threshold_percent: 5
    window_minutes: 10
    notify:
      - platform-oncall
      - field-dispatch
  - name: payment_webhook_lag
    severity: warning
    threshold_seconds: 120
    notify:
      - billing-oncall

feature_flags:
  ebike_reservations: true
  guest_checkout: true
  weather_based_rebalancing: false
  late_night_station_locking: true

security:
  cors_allowed_origins:
    - https://app.ne-bikeshare.example.com
    - https://admin.ne-bikeshare.example.com
  rate_limits:
    anonymous_per_minute: 60
    authenticated_per_minute: 300
  jwt:
    issuer: https://auth.ne-bikeshare.example.com
    audience: bike-share-api
    token_ttl_minutes: 60