#ifndef OLEDScreen_h
#define OLEDScreen_h
#include <Wire.h>
#include <ACROBOTIC_SSD1306.h>
#include "WeatherForecastSample.cpp"

class OLEDScreen
{
public:
	static void init() {
    Wire.begin();
    oled.init();
    oled.setFont(font8x8);  
    clear();
  };
  
	static void printForecast(WeatherForecastSample data)
	{
  	clear();
    oled.setHorizontalMode(); 
    
    oled.setTextXY(0,1);
    oled.putString("METEO 3 GIORNI");
    oled.setTextXY(1,2);
    oled.putString("MILANO");
    
    String dtTxt = data.dtTxt;
    String temp = String(data.temp - 273.15) + " C";
    String description = data.description;
    
    oled.setTextXY(3,-4);
    oled.putString(dtTxt);
    oled.setTextXY(5, 5);
    oled.putString(temp);
    oled.setTextXY(7, 1);
    oled.putString(description);
	}
  static void clear() {
    for (int y = 0; y < 8; y++) {  
      for (int x = 0; x < 30; x++) {   
        oled.setTextXY(y, x);
        oled.putChar(' ');
      }
    }
  }

private:
  static String padRight(String x) {
    while (x.length() < 20) {
      x = x + " ";
    }
    return x;
  }
};

#endif
