import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/aqi_gauge.dart';
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/aqi_humidity_and_temperature.dart';

class AirQualityEndSideGaugeAndInfo extends StatelessWidget {
  const AirQualityEndSideGaugeAndInfo({
    super.key,
    required this.temperature,
    required this.humidity,
    required this.aqiLevel,
  });

  final int temperature;
  final int humidity;
  final String aqiLevel;

  @override
  Widget build(BuildContext context) {
    return Expanded(
      flex: 2,
      child: Row(
        children: [
          Expanded(
            flex: 2,
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [Expanded(child: AqiGauge(aqi: aqi))],
            ),
          ),
          const Spacer(),
          Expanded(
            child: Padding(
              padding: const EdgeInsetsDirectional.only(end: 20),
              child: AqiHumidityAndTemperature(
                temperature: temperature,
                humidity: humidity,
              ),
            ),
          ),
        ],
      ),
    );
  }

  double get aqi => switch (aqiLevel) {
        'level_1' => 25.0,
        'level_2' => 75.0,
        'level_3' => 125.0,
        _ => 0.0,
      };
}
