extends Reference
class_name Constants

static func current_moment()->Moment:
	var out = Moment.new()
	var current = Time.get_time_dict_from_system()
	out.hour = current['hour']
	out.minute = current['minute']
	return out

enum WEATHER { # DO NOT CHANGE THE ORDER OF THIS!!! IT MATTERS IN SOME PLACES!!
	CLOUDY,
	FOGGY,
	PARTLYCLOUDY,
	RAINY,
	SNOWY,
	STORMY,
	SUNNY,
	UNKNOWN,
}

static func celsius_to_fahrenheit(celsius:float)->float:
	return (celsius * (9/5)) + 32

static func fahrenheit_to_celsius(fahrenheit:float)->float:
	return (fahrenheit - 32) * 5/9

static func code_to_weather(code)->int:
	return weather_codes.get(str(code), WEATHER.UNKNOWN)

const weather_color := {
	WEATHER.CLOUDY: Color('9fdbff'),
	WEATHER.FOGGY: Color('ff8fd5'),
	WEATHER.PARTLYCLOUDY: Color('52eba1'),
	WEATHER.RAINY: Color('ff9092'),
	WEATHER.SNOWY: Color('d58fff'),
	WEATHER.STORMY: Color('8e92ff'),
	WEATHER.SUNNY: Color('e9ea29'),
	WEATHER.UNKNOWN: Color('d0d0d0'),
}

static func weather_to_color(weather:int):
	var out:Color = weather_color.get(weather, WEATHER.UNKNOWN)
	return out

const weather_codes := {
	'1000': WEATHER.SUNNY,
	'1003': WEATHER.PARTLYCLOUDY,
	'1006': WEATHER.CLOUDY,
	'1009': WEATHER.RAINY,
	'1030': WEATHER.FOGGY,
	'1063': WEATHER.RAINY,
	'1066': WEATHER.SNOWY,
	'1069': WEATHER.SNOWY,
	'1072': WEATHER.RAINY,
	'1087': WEATHER.STORMY,
	'1114': WEATHER.SNOWY,
	'1117': WEATHER.SNOWY,
	'1135': WEATHER.FOGGY,
	'1147': WEATHER.FOGGY,
	'1150': WEATHER.RAINY,
	'1153': WEATHER.RAINY,
	'1168': WEATHER.RAINY,
	'1171': WEATHER.RAINY,
	'1180': WEATHER.RAINY,
	'1183': WEATHER.RAINY,
	'1189': WEATHER.RAINY,
	'1182': WEATHER.RAINY,
	'1192': WEATHER.RAINY,
	'1195': WEATHER.RAINY,
	'1198': WEATHER.RAINY,
	'1201': WEATHER.RAINY,
	'1204': WEATHER.SNOWY,
	'1207': WEATHER.SNOWY,
	'1210': WEATHER.SNOWY,
	'1213': WEATHER.SNOWY,
	'1216': WEATHER.SNOWY,
	'1222': WEATHER.SNOWY,
	'1225': WEATHER.SNOWY,
	'1237': WEATHER.SNOWY,
	'1240': WEATHER.RAINY,
	'1243': WEATHER.RAINY,
	'1246': WEATHER.STORMY,
	'1249': WEATHER.RAINY,
	'1252': WEATHER.RAINY,
	'1255': WEATHER.SNOWY,
	'1258': WEATHER.SNOWY,
	'1261': WEATHER.SNOWY,
	'1264': WEATHER.SNOWY,
	'1273': WEATHER.STORMY,
	'1276': WEATHER.STORMY,
	'1279': WEATHER.STORMY,
	'1282': WEATHER.STORMY,
}
