# SPDX-License-Identifier: MIT
# Synthetic educational HTTP simulator; not compatible with Airly APIs.
name: air_quality_station_demo_20261114
description: |
  Synthetic air-quality station for a simplified HTTP JSON demonstration.
  Inspired by the general idea of ambient air readings, but not compatible
  with Airly endpoints or response schemas.

meta_parameters:
  http_host:
    type: str
    default: 0.0.0.0
  http_port:
    type: int
    default: 8097

attributes:
  k__station_id:
    type: str
    default: SPX-DEMO-001
  k__timestamp:
    type: str
    default: '2026-11-14T12:00:00Z'
  k__pm2_5:
    type: float
    default: 12.4
    unit: ug/m3
  k__pm10:
    type: float
    default: 21.8
    unit: ug/m3

communication:
  - http_endpoint:
      host: "$param(http_host)"
      port: "$param(http_port)"
      endpoints:
        /v1/air-quality:
          method: GET
          response:
            demo_data: true
            station_id: "#attr(k__station_id)"
            timestamp: "#attr(k__timestamp)"
            units:
              pm2_5: ug/m3
              pm10: ug/m3
            readings:
              pm2_5: "#attr(k__pm2_5)"
              pm10: "#attr(k__pm10)"
        /simulator/readings:
          method: PATCH
          alias:
            - "#attr(k__timestamp) = #param(__body__.timestamp)"
            - "#attr(k__pm2_5) = #param(__body__.pm2_5)"
            - "#attr(k__pm10) = #param(__body__.pm10)"
          response:
            demo_data: true
            status: updated
            timestamp: "#attr(k__timestamp)"
            readings:
              pm2_5: "#attr(k__pm2_5)"
              pm10: "#attr(k__pm10)"
