using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeatherClient.Models;

namespace WeatherClient.Services
{
    internal static class WeatherServer
    {
        public static async Task<WeatherData> GetWeather(string postalCode)
        {
            int totalWeatherTypes = Enum.GetNames<WeatherType>().Length;

            await Task.Delay(TimeSpan.FromSeconds(2));

            WeatherData data = new WeatherData()
            {
                Temperature = Random.Shared.Next(-10, 40),
                Condition = (WeatherType)Random.Shared.Next(0, totalWeatherTypes),
                Humidity = Random.Shared.Next(0, 101),
                Precipitation = Random.Shared.Next(0, 101),
                Wind = Random.Shared.Next(0, 30)
            };

            return data;
        }
    }
}
