/**
 * i-net software provides programming examples for illustration only, without warranty
 * either expressed or implied, including, but not limited to, the implied warranties
 * of merchantability and/or fitness for a particular purpose. This programming example
 * assumes that you are familiar with the programming language being demonstrated and
 * the tools used to create and debug procedures. i-net software support professionals
 * can help explain the functionality of a particular procedure, but they will not modify
 * these examples to provide added functionality or construct procedures to meet your
 * specific needs.
 *
 * Copyright © 1999-2026 i-net software GmbH, Berlin, Germany.
**/
package com.inet.dashboard.openweathermap;

import java.util.List;

import com.inet.annotations.JsonData;

/**
 * The weather data response from openweathermap.org<br>
 * This data is not complete and can be extended to provide the complete response data.
 */
@JsonData
public class ForecastData {

    private List<Forecast> list;
    private int            cod;

    /**
     * Returns the response code. Should be 200 for a valid response.
     * @return the response code
     */
    public int getCod() {
        return cod;
    }

    /**
     * Returns the list of forecasts
     * @return the list of forecasts
     */
    public List<Forecast> getForecasts() {
        return list;
    }

    /**
     * The forecast information for one day
     */
    @JsonData
    public static class Forecast {
        private long          dt;
        private Temp          temp;
        private List<Weather> weather;

        /**
         * Returns the timestamp of the forecast day
         * @return the timestamp of the forecast day
         */
        public long getDt() {
            return dt;
        }

        /**
         * Returns the temperature forecast
         * @return the temperature forecast
         */
        public Temp getTemp() {
            return temp;
        }

        /**
         * Returns the weather description
         * @return the weather description
         */
        public Weather getWeather() {
            return weather == null || weather.isEmpty() ? null : weather.get( 0 );
        }

    }

    /**
     * The temperature information
     */
    @JsonData
    public static class Temp {
        private double min;
        private double max;

        /**
         * Returns the maximum temperature of the day
         * @return the maximum temperature of the day
         */
        public double getMax() {
            return max;
        }

        /**
         * Returns the minimum temperature of the day
         * @return the minimum temperature of the day
         */
        public double getMin() {
            return min;
        }
    }

}
