#ifndef SENSOR_H
#define SENSOR_H

#include <Wire.h>

#include "environment.h"
#include "dev/bme280.h"
#include "dev/ltr390.h"
#include "dev/icm20948.h"
#include "dev/sgp40.h"
#include "dev/tsl25911.h"

#include "dev/pmsa003.h"


class Sensor
{
  // user-accessible "public" interface
  public:
    Sensor(TwoWire* i2c);

    float temp = 0;
    float pres = 0;
    float hum = 0;
    float heatidx = 0;
    
    float light = 0;
    uint32_t uv = 0;
    uint32_t uvi = 0;

    uint16_t light_full = 0;
    uint16_t light_vis = 0;
    uint16_t light_ir = 0;
    float light_lux = 0;

    int32_t voci = 0;
    PM25_AQI_Data pmd = {0};

    void TSL_init(void); //Light Sensor
    void BME_init(void); //Temp, Hum, Presssure
    void ICM_init(void); //motion,accel, gyro, magnet
    void LTR_init(void); //UV, AL
    void SGP_init(void); //VOC
    void PMS_init(void); //PM2.5 - PM10

    void TSL_measure(void);
    void BME_measure(void);
    void ICM_measure(void);
    void LTR_measure(void);
    void SGP_measure(void);
    void PMS_measure(void);

    void measure(){
        TSL_measure();
        BME_measure();
        ICM_measure();
        LTR_measure();
        SGP_measure();
        PMS_measure();
    }

  private:
    BME280* bme = NULL;
    LTR390* ltr = NULL;
    TSL25911* tsl = NULL;
    SGP40* sgp = NULL;
    PMSA003* pms = NULL;

};

#endif