using System;
using System.Collections.Generic;
using System.Text;

namespace solarApp.Model
{
    class weather_model
    {
        #region 氣象觀測
        public class FieldsItem
        {
            public string Id { get; set; }
            public string Type { get; set; }
        }

        public class Result
        {
            public string Resource_id { get; set; }
            public List<FieldsItem> Fields { get; set; }
        }

        public class Time
        {
            public string ObsTime { get; set; }
        }

        public class WeatherElementItem
        {
            public string ElementName { get; set; }
            public string ElementValue { get; set; }
            public List<TimeItem> Time { get; set; }
        }
        public class Parameter//氣象預報(opendata取資料)
        {
            public string ParameterName { get; set; }
            public string ParameterValue { get; set; }
            public string ParameterUnit { get; set; }
        }

        public class TimeItem//氣象預報(opendata取資料)
        {
            public string StartTime { get; set; }
            public string EndTime { get; set; }
            public Parameter Parameter { get; set; }
        }

        public class ParameterItem
        {
            public string ParameterName { get; set; }
            public string ParameterValue { get; set; }
        }

        public class LocationItem
        {
            public string Lat { get; set; }
            public string Lon { get; set; }
            public string LocationName { get; set; }
            public string StationId { get; set; }
            public Time Time { get; set; }
            public List<WeatherElementItem> WeatherElement { get; set; }
            public List<ParameterItem> Parameter { get; set; }
        }

        public class Records
        {
            public string DatasetDescription { get; set; }
            public List<LocationItem> Location { get; set; }
        }

        public class Root2 //氣象觀測(主要)(opendata取資料)
        {
            public string Success { get; set; }
            public Result Result { get; set; }
            public Records Records { get; set; }
        }
        #endregion

        public class WeatherObservation //氣象觀測(資料庫)
        {
            public int PowerStationId { get; set; }
            private string obsTime;
            public string ObsTime { get { return Convert.ToDateTime(obsTime).ToString("yyyy-MM-dd HH:mm:ss"); } set { obsTime = value; } }
            public double Temp { get; set; }
        }

        public class WeatherForecast //氣象預報(資料庫) 
        {
            public string LocationName { get; set; }
            public string Wx { get; set; }
            public string WxValue { get; set; }
            public string PoP { get; set; }
            private string startTime;
            public string StartTime { get { return Convert.ToDateTime(startTime).ToString("yyyy-MM-dd HH:mm:ss"); } set { startTime = value; } }
            private string endTime;
            public string EndTime { get { return Convert.ToDateTime(endTime).ToString("yyyy-MM-dd HH:mm:ss"); } set { endTime = value; } }
        }
         

        public class NowWeather
        {
            public string WeatherKey { get; set; } //現在天氣
            public string PoP { get; set; } //降雨機率
        }
    }
}
