// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package shared

import (
	"encoding/json"
	"fmt"
)

// SourceOpenweatherUpdateLang - You can use lang parameter to get the output in your language. The contents of the description field will be translated. See <a href="https://openweathermap.org/api/one-call-api#multi">here</a> for the list of supported languages.
type SourceOpenweatherUpdateLang string

const (
	SourceOpenweatherUpdateLangAf   SourceOpenweatherUpdateLang = "af"
	SourceOpenweatherUpdateLangAl   SourceOpenweatherUpdateLang = "al"
	SourceOpenweatherUpdateLangAr   SourceOpenweatherUpdateLang = "ar"
	SourceOpenweatherUpdateLangAz   SourceOpenweatherUpdateLang = "az"
	SourceOpenweatherUpdateLangBg   SourceOpenweatherUpdateLang = "bg"
	SourceOpenweatherUpdateLangCa   SourceOpenweatherUpdateLang = "ca"
	SourceOpenweatherUpdateLangCz   SourceOpenweatherUpdateLang = "cz"
	SourceOpenweatherUpdateLangDa   SourceOpenweatherUpdateLang = "da"
	SourceOpenweatherUpdateLangDe   SourceOpenweatherUpdateLang = "de"
	SourceOpenweatherUpdateLangEl   SourceOpenweatherUpdateLang = "el"
	SourceOpenweatherUpdateLangEn   SourceOpenweatherUpdateLang = "en"
	SourceOpenweatherUpdateLangEu   SourceOpenweatherUpdateLang = "eu"
	SourceOpenweatherUpdateLangFa   SourceOpenweatherUpdateLang = "fa"
	SourceOpenweatherUpdateLangFi   SourceOpenweatherUpdateLang = "fi"
	SourceOpenweatherUpdateLangFr   SourceOpenweatherUpdateLang = "fr"
	SourceOpenweatherUpdateLangGl   SourceOpenweatherUpdateLang = "gl"
	SourceOpenweatherUpdateLangHe   SourceOpenweatherUpdateLang = "he"
	SourceOpenweatherUpdateLangHi   SourceOpenweatherUpdateLang = "hi"
	SourceOpenweatherUpdateLangHr   SourceOpenweatherUpdateLang = "hr"
	SourceOpenweatherUpdateLangHu   SourceOpenweatherUpdateLang = "hu"
	SourceOpenweatherUpdateLangID   SourceOpenweatherUpdateLang = "id"
	SourceOpenweatherUpdateLangIt   SourceOpenweatherUpdateLang = "it"
	SourceOpenweatherUpdateLangJa   SourceOpenweatherUpdateLang = "ja"
	SourceOpenweatherUpdateLangKr   SourceOpenweatherUpdateLang = "kr"
	SourceOpenweatherUpdateLangLa   SourceOpenweatherUpdateLang = "la"
	SourceOpenweatherUpdateLangLt   SourceOpenweatherUpdateLang = "lt"
	SourceOpenweatherUpdateLangMk   SourceOpenweatherUpdateLang = "mk"
	SourceOpenweatherUpdateLangNo   SourceOpenweatherUpdateLang = "no"
	SourceOpenweatherUpdateLangNl   SourceOpenweatherUpdateLang = "nl"
	SourceOpenweatherUpdateLangPl   SourceOpenweatherUpdateLang = "pl"
	SourceOpenweatherUpdateLangPt   SourceOpenweatherUpdateLang = "pt"
	SourceOpenweatherUpdateLangPtBr SourceOpenweatherUpdateLang = "pt_br"
	SourceOpenweatherUpdateLangRo   SourceOpenweatherUpdateLang = "ro"
	SourceOpenweatherUpdateLangRu   SourceOpenweatherUpdateLang = "ru"
	SourceOpenweatherUpdateLangSv   SourceOpenweatherUpdateLang = "sv"
	SourceOpenweatherUpdateLangSe   SourceOpenweatherUpdateLang = "se"
	SourceOpenweatherUpdateLangSk   SourceOpenweatherUpdateLang = "sk"
	SourceOpenweatherUpdateLangSl   SourceOpenweatherUpdateLang = "sl"
	SourceOpenweatherUpdateLangSp   SourceOpenweatherUpdateLang = "sp"
	SourceOpenweatherUpdateLangEs   SourceOpenweatherUpdateLang = "es"
	SourceOpenweatherUpdateLangSr   SourceOpenweatherUpdateLang = "sr"
	SourceOpenweatherUpdateLangTh   SourceOpenweatherUpdateLang = "th"
	SourceOpenweatherUpdateLangTr   SourceOpenweatherUpdateLang = "tr"
	SourceOpenweatherUpdateLangUa   SourceOpenweatherUpdateLang = "ua"
	SourceOpenweatherUpdateLangUk   SourceOpenweatherUpdateLang = "uk"
	SourceOpenweatherUpdateLangVi   SourceOpenweatherUpdateLang = "vi"
	SourceOpenweatherUpdateLangZhCn SourceOpenweatherUpdateLang = "zh_cn"
	SourceOpenweatherUpdateLangZhTw SourceOpenweatherUpdateLang = "zh_tw"
	SourceOpenweatherUpdateLangZu   SourceOpenweatherUpdateLang = "zu"
)

func (e SourceOpenweatherUpdateLang) ToPointer() *SourceOpenweatherUpdateLang {
	return &e
}
func (e *SourceOpenweatherUpdateLang) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "af":
		fallthrough
	case "al":
		fallthrough
	case "ar":
		fallthrough
	case "az":
		fallthrough
	case "bg":
		fallthrough
	case "ca":
		fallthrough
	case "cz":
		fallthrough
	case "da":
		fallthrough
	case "de":
		fallthrough
	case "el":
		fallthrough
	case "en":
		fallthrough
	case "eu":
		fallthrough
	case "fa":
		fallthrough
	case "fi":
		fallthrough
	case "fr":
		fallthrough
	case "gl":
		fallthrough
	case "he":
		fallthrough
	case "hi":
		fallthrough
	case "hr":
		fallthrough
	case "hu":
		fallthrough
	case "id":
		fallthrough
	case "it":
		fallthrough
	case "ja":
		fallthrough
	case "kr":
		fallthrough
	case "la":
		fallthrough
	case "lt":
		fallthrough
	case "mk":
		fallthrough
	case "no":
		fallthrough
	case "nl":
		fallthrough
	case "pl":
		fallthrough
	case "pt":
		fallthrough
	case "pt_br":
		fallthrough
	case "ro":
		fallthrough
	case "ru":
		fallthrough
	case "sv":
		fallthrough
	case "se":
		fallthrough
	case "sk":
		fallthrough
	case "sl":
		fallthrough
	case "sp":
		fallthrough
	case "es":
		fallthrough
	case "sr":
		fallthrough
	case "th":
		fallthrough
	case "tr":
		fallthrough
	case "ua":
		fallthrough
	case "uk":
		fallthrough
	case "vi":
		fallthrough
	case "zh_cn":
		fallthrough
	case "zh_tw":
		fallthrough
	case "zu":
		*e = SourceOpenweatherUpdateLang(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceOpenweatherUpdateLang: %v", v)
	}
}

// SourceOpenweatherUpdateUnits - Units of measurement. standard, metric and imperial units are available. If you do not use the units parameter, standard units will be applied by default.
type SourceOpenweatherUpdateUnits string

const (
	SourceOpenweatherUpdateUnitsStandard SourceOpenweatherUpdateUnits = "standard"
	SourceOpenweatherUpdateUnitsMetric   SourceOpenweatherUpdateUnits = "metric"
	SourceOpenweatherUpdateUnitsImperial SourceOpenweatherUpdateUnits = "imperial"
)

func (e SourceOpenweatherUpdateUnits) ToPointer() *SourceOpenweatherUpdateUnits {
	return &e
}
func (e *SourceOpenweatherUpdateUnits) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "standard":
		fallthrough
	case "metric":
		fallthrough
	case "imperial":
		*e = SourceOpenweatherUpdateUnits(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceOpenweatherUpdateUnits: %v", v)
	}
}

type SourceOpenweatherUpdate struct {
	// API KEY
	Appid string `json:"appid"`
	// You can use lang parameter to get the output in your language. The contents of the description field will be translated. See <a href="https://openweathermap.org/api/one-call-api#multi">here</a> for the list of supported languages.
	Lang *SourceOpenweatherUpdateLang `json:"lang,omitempty"`
	// Latitude, decimal (-90; 90). If you need the geocoder to automatic convert city names and zip-codes to geo coordinates and the other way around, please use the OpenWeather Geocoding API
	Lat string `json:"lat"`
	// Longitude, decimal (-180; 180). If you need the geocoder to automatic convert city names and zip-codes to geo coordinates and the other way around, please use the OpenWeather Geocoding API
	Lon string `json:"lon"`
	// True for particular day
	OnlyCurrent *bool `json:"only_current,omitempty"`
	// Units of measurement. standard, metric and imperial units are available. If you do not use the units parameter, standard units will be applied by default.
	Units *SourceOpenweatherUpdateUnits `json:"units,omitempty"`
}

func (o *SourceOpenweatherUpdate) GetAppid() string {
	if o == nil {
		return ""
	}
	return o.Appid
}

func (o *SourceOpenweatherUpdate) GetLang() *SourceOpenweatherUpdateLang {
	if o == nil {
		return nil
	}
	return o.Lang
}

func (o *SourceOpenweatherUpdate) GetLat() string {
	if o == nil {
		return ""
	}
	return o.Lat
}

func (o *SourceOpenweatherUpdate) GetLon() string {
	if o == nil {
		return ""
	}
	return o.Lon
}

func (o *SourceOpenweatherUpdate) GetOnlyCurrent() *bool {
	if o == nil {
		return nil
	}
	return o.OnlyCurrent
}

func (o *SourceOpenweatherUpdate) GetUnits() *SourceOpenweatherUpdateUnits {
	if o == nil {
		return nil
	}
	return o.Units
}
