// Path: core/src/main/java/cat/ppicas/cleanarch/model/DailyForecast.java
// public class DailyForecast {
// 
//     private String mCityId;
//     private Date mDate;
//     private String mDescription;
//     private double mDayTemp;
//     private double mMinTemp;
//     private double mMaxTemp;
//     private double mHumidity;
//     private double mWindSpeed;
// 
//     public DailyForecast(String cityId, Date date, String description, double dayTemp,
//             double minTemp, double maxTemp, double humidity, double windSpeed) {
//         mCityId = cityId;
//         mDate = date;
//         mDescription = description;
//         mDayTemp = dayTemp;
//         mMinTemp = minTemp;
//         mMaxTemp = maxTemp;
//         mHumidity = humidity;
//         mWindSpeed = windSpeed;
//     }
// 
//     public String getCityId() {
//         return mCityId;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public String getDescription() {
//         return mDescription;
//     }
// 
//     public double getDayTemp() {
//         return mDayTemp;
//     }
// 
//     public double getMinTemp() {
//         return mMinTemp;
//     }
// 
//     public double getMaxTemp() {
//         return mMaxTemp;
//     }
// 
//     public double getHumidity() {
//         return mHumidity;
//     }
// 
//     public double getWindSpeed() {
//         return mWindSpeed;
//     }
// }
// 
// Path: core/src/main/java/cat/ppicas/cleanarch/owm/model/OWMDailyForecast.java
// @SuppressWarnings("UnusedDeclaration")
// public class OWMDailyForecast {
// 
//     @SerializedName("dt")
//     private int mTimestamp;
//     @SerializedName("temp")
//     private Temp mTemp;
//     @SerializedName("humidity")
//     private int mHumidity;
//     @SerializedName("speed")
//     private double mWindSpeed;
//     @SerializedName("weather")
//     private Weather[] mWeatherList;
// 
//     public int getTimestamp() {
//         return mTimestamp;
//     }
// 
//     public Temp getTemp() {
//         return mTemp;
//     }
// 
//     public int getHumidity() {
//         return mHumidity;
//     }
// 
//     public double getWindSpeed() {
//         return mWindSpeed;
//     }
// 
//     public Weather[] getWeatherList() {
//         return mWeatherList;
//     }
// 
//     public class Temp {
//         @SerializedName("day")
//         private double mDay;
//         @SerializedName("min")
//         private double mMin;
//         @SerializedName("max")
//         private double mMax;
// 
//         public double getDay() {
//             return mDay;
//         }
// 
//         public double getMin() {
//             return mMin;
//         }
// 
//         public double getMax() {
//             return mMax;
//         }
//     }
// 
//     public class Weather {
//         @SerializedName("description")
//         private String mDescription;
// 
//         public String getDescription() {
//             return mDescription;
//         }
//     }
// }
// 
// Path: core/src/main/java/cat/ppicas/cleanarch/owm/model/OWMDailyForecastList.java
// @SuppressWarnings("UnusedDeclaration")
// public class OWMDailyForecastList {
// 
//     @SerializedName("cnt")
//     private int mCount;
//     @SerializedName("city")
//     private City mCity;
//     @SerializedName("list")
//     private List<OWMDailyForecast> mDailyForecasts;
// 
//     public int getCount() {
//         return mCount;
//     }
// 
//     public City getCity() {
//         return mCity;
//     }
// 
//     public List<OWMDailyForecast> getList() {
//         return mDailyForecasts;
//     }
// 
//     public class City {
//         @SerializedName("id")
//         private String mId;
// 
//         public String getId() {
//             return mId;
//         }
//     }
// }
// 
// Path: core/src/main/java/cat/ppicas/cleanarch/repository/DailyForecastRepository.java
// public interface DailyForecastRepository {
// 
//     List<DailyForecast> getDailyForecasts(String cityId);
// 
// }


import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import cat.ppicas.cleanarch.model.DailyForecast;
import cat.ppicas.cleanarch.owm.model.OWMDailyForecast;
import cat.ppicas.cleanarch.owm.model.OWMDailyForecastList;
import cat.ppicas.cleanarch.repository.DailyForecastRepository;
/*
 * Copyright (C) 2015 Pau Picas Sans <pau.picas@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package cat.ppicas.cleanarch.owm;



public class OWMDailyForecastRepository implements DailyForecastRepository {

    private static final int FORECAST_DAYS = 3;

    private OWMService mService;

    public OWMDailyForecastRepository(OWMService service) {
        mService = service;
    }

    @Override
    public List<DailyForecast> getDailyForecasts(String cityId) {
        List<DailyForecast> list = new ArrayList<DailyForecast>();
        OWMDailyForecastList owmDFList = mService.getDailyForecastByCityId(cityId, FORECAST_DAYS);
// Path: core/src/main/java/cat/ppicas/cleanarch/model/DailyForecast.java
// public class DailyForecast {
// 
//     private String mCityId;
//     private Date mDate;
//     private String mDescription;
//     private double mDayTemp;
//     private double mMinTemp;
//     private double mMaxTemp;
//     private double mHumidity;
//     private double mWindSpeed;
// 
//     public DailyForecast(String cityId, Date date, String description, double dayTemp,
//             double minTemp, double maxTemp, double humidity, double windSpeed) {
//         mCityId = cityId;
//         mDate = date;
//         mDescription = description;
//         mDayTemp = dayTemp;
//         mMinTemp = minTemp;
//         mMaxTemp = maxTemp;
//         mHumidity = humidity;
//         mWindSpeed = windSpeed;
//     }
// 
//     public String getCityId() {
//         return mCityId;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public String getDescription() {
//         return mDescription;
//     }
// 
//     public double getDayTemp() {
//         return mDayTemp;
//     }
// 
//     public double getMinTemp() {
//         return mMinTemp;
//     }
// 
//     public double getMaxTemp() {
//         return mMaxTemp;
//     }
// 
//     public double getHumidity() {
//         return mHumidity;
//     }
// 
//     public double getWindSpeed() {
//         return mWindSpeed;
//     }
// }
// 
// Path: core/src/main/java/cat/ppicas/cleanarch/owm/model/OWMDailyForecast.java
// @SuppressWarnings("UnusedDeclaration")
// public class OWMDailyForecast {
// 
//     @SerializedName("dt")
//     private int mTimestamp;
//     @SerializedName("temp")
//     private Temp mTemp;
//     @SerializedName("humidity")
//     private int mHumidity;
//     @SerializedName("speed")
//     private double mWindSpeed;
//     @SerializedName("weather")
//     private Weather[] mWeatherList;
// 
//     public int getTimestamp() {
//         return mTimestamp;
//     }
// 
//     public Temp getTemp() {
//         return mTemp;
//     }
// 
//     public int getHumidity() {
//         return mHumidity;
//     }
// 
//     public double getWindSpeed() {
//         return mWindSpeed;
//     }
// 
//     public Weather[] getWeatherList() {
//         return mWeatherList;
//     }
// 
//     public class Temp {
//         @SerializedName("day")
//         private double mDay;
//         @SerializedName("min")
//         private double mMin;
//         @SerializedName("max")
//         private double mMax;
// 
//         public double getDay() {
//             return mDay;
//         }
// 
//         public double getMin() {
//             return mMin;
//         }
// 
//         public double getMax() {
//             return mMax;
//         }
//     }
// 
//     public class Weather {
//         @SerializedName("description")
//         private String mDescription;
// 
//         public String getDescription() {
//             return mDescription;
//         }
//     }
// }
// 
// Path: core/src/main/java/cat/ppicas/cleanarch/owm/model/OWMDailyForecastList.java
// @SuppressWarnings("UnusedDeclaration")
// public class OWMDailyForecastList {
// 
//     @SerializedName("cnt")
//     private int mCount;
//     @SerializedName("city")
//     private City mCity;
//     @SerializedName("list")
//     private List<OWMDailyForecast> mDailyForecasts;
// 
//     public int getCount() {
//         return mCount;
//     }
// 
//     public City getCity() {
//         return mCity;
//     }
// 
//     public List<OWMDailyForecast> getList() {
//         return mDailyForecasts;
//     }
// 
//     public class City {
//         @SerializedName("id")
//         private String mId;
// 
//         public String getId() {
//             return mId;
//         }
//     }
// }
// 
// Path: core/src/main/java/cat/ppicas/cleanarch/repository/DailyForecastRepository.java
// public interface DailyForecastRepository {
// 
//     List<DailyForecast> getDailyForecasts(String cityId);
// 
// }


// Path: core/src/main/java/cat/ppicas/cleanarch/owm/OWMDailyForecastRepository.java
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import cat.ppicas.cleanarch.model.DailyForecast;
import cat.ppicas.cleanarch.owm.model.OWMDailyForecast;
import cat.ppicas.cleanarch.owm.model.OWMDailyForecastList;
import cat.ppicas.cleanarch.repository.DailyForecastRepository;

/*
 * Copyright (C) 2015 Pau Picas Sans <pau.picas@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package cat.ppicas.cleanarch.owm;



public class OWMDailyForecastRepository implements DailyForecastRepository {

    private static final int FORECAST_DAYS = 3;

    private OWMService mService;

    public OWMDailyForecastRepository(OWMService service) {
        mService = service;
    }

    @Override
    public List<DailyForecast> getDailyForecasts(String cityId) {
        List<DailyForecast> list = new ArrayList<DailyForecast>();
        OWMDailyForecastList owmDFList = mService.getDailyForecastByCityId(cityId, FORECAST_DAYS);
        for (OWMDailyForecast owmDF : owmDFList.getList()) {