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

package shared

import (
	"encoding/json"
	"fmt"
)

type SourceNewsdataUpdateCategory string

const (
	SourceNewsdataUpdateCategoryBusiness      SourceNewsdataUpdateCategory = "business"
	SourceNewsdataUpdateCategoryEntertainment SourceNewsdataUpdateCategory = "entertainment"
	SourceNewsdataUpdateCategoryEnvironment   SourceNewsdataUpdateCategory = "environment"
	SourceNewsdataUpdateCategoryFood          SourceNewsdataUpdateCategory = "food"
	SourceNewsdataUpdateCategoryHealth        SourceNewsdataUpdateCategory = "health"
	SourceNewsdataUpdateCategoryPolitics      SourceNewsdataUpdateCategory = "politics"
	SourceNewsdataUpdateCategoryScience       SourceNewsdataUpdateCategory = "science"
	SourceNewsdataUpdateCategorySports        SourceNewsdataUpdateCategory = "sports"
	SourceNewsdataUpdateCategoryTechnology    SourceNewsdataUpdateCategory = "technology"
	SourceNewsdataUpdateCategoryTop           SourceNewsdataUpdateCategory = "top"
	SourceNewsdataUpdateCategoryWorld         SourceNewsdataUpdateCategory = "world"
)

func (e SourceNewsdataUpdateCategory) ToPointer() *SourceNewsdataUpdateCategory {
	return &e
}
func (e *SourceNewsdataUpdateCategory) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "business":
		fallthrough
	case "entertainment":
		fallthrough
	case "environment":
		fallthrough
	case "food":
		fallthrough
	case "health":
		fallthrough
	case "politics":
		fallthrough
	case "science":
		fallthrough
	case "sports":
		fallthrough
	case "technology":
		fallthrough
	case "top":
		fallthrough
	case "world":
		*e = SourceNewsdataUpdateCategory(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceNewsdataUpdateCategory: %v", v)
	}
}

type SourceNewsdataUpdateCountry string

const (
	SourceNewsdataUpdateCountryAr SourceNewsdataUpdateCountry = "ar"
	SourceNewsdataUpdateCountryAu SourceNewsdataUpdateCountry = "au"
	SourceNewsdataUpdateCountryAt SourceNewsdataUpdateCountry = "at"
	SourceNewsdataUpdateCountryBd SourceNewsdataUpdateCountry = "bd"
	SourceNewsdataUpdateCountryBy SourceNewsdataUpdateCountry = "by"
	SourceNewsdataUpdateCountryBe SourceNewsdataUpdateCountry = "be"
	SourceNewsdataUpdateCountryBr SourceNewsdataUpdateCountry = "br"
	SourceNewsdataUpdateCountryBg SourceNewsdataUpdateCountry = "bg"
	SourceNewsdataUpdateCountryCa SourceNewsdataUpdateCountry = "ca"
	SourceNewsdataUpdateCountryCl SourceNewsdataUpdateCountry = "cl"
	SourceNewsdataUpdateCountryCn SourceNewsdataUpdateCountry = "cn"
	SourceNewsdataUpdateCountryCo SourceNewsdataUpdateCountry = "co"
	SourceNewsdataUpdateCountryCr SourceNewsdataUpdateCountry = "cr"
	SourceNewsdataUpdateCountryCu SourceNewsdataUpdateCountry = "cu"
	SourceNewsdataUpdateCountryCz SourceNewsdataUpdateCountry = "cz"
	SourceNewsdataUpdateCountryDk SourceNewsdataUpdateCountry = "dk"
	SourceNewsdataUpdateCountryDo SourceNewsdataUpdateCountry = "do"
	SourceNewsdataUpdateCountryEc SourceNewsdataUpdateCountry = "ec"
	SourceNewsdataUpdateCountryEg SourceNewsdataUpdateCountry = "eg"
	SourceNewsdataUpdateCountryEe SourceNewsdataUpdateCountry = "ee"
	SourceNewsdataUpdateCountryEt SourceNewsdataUpdateCountry = "et"
	SourceNewsdataUpdateCountryFi SourceNewsdataUpdateCountry = "fi"
	SourceNewsdataUpdateCountryFr SourceNewsdataUpdateCountry = "fr"
	SourceNewsdataUpdateCountryDe SourceNewsdataUpdateCountry = "de"
	SourceNewsdataUpdateCountryGr SourceNewsdataUpdateCountry = "gr"
	SourceNewsdataUpdateCountryHk SourceNewsdataUpdateCountry = "hk"
	SourceNewsdataUpdateCountryHu SourceNewsdataUpdateCountry = "hu"
	SourceNewsdataUpdateCountryIn SourceNewsdataUpdateCountry = "in"
	SourceNewsdataUpdateCountryID SourceNewsdataUpdateCountry = "id"
	SourceNewsdataUpdateCountryIq SourceNewsdataUpdateCountry = "iq"
	SourceNewsdataUpdateCountryIe SourceNewsdataUpdateCountry = "ie"
	SourceNewsdataUpdateCountryIl SourceNewsdataUpdateCountry = "il"
	SourceNewsdataUpdateCountryIt SourceNewsdataUpdateCountry = "it"
	SourceNewsdataUpdateCountryJp SourceNewsdataUpdateCountry = "jp"
	SourceNewsdataUpdateCountryKz SourceNewsdataUpdateCountry = "kz"
	SourceNewsdataUpdateCountryKw SourceNewsdataUpdateCountry = "kw"
	SourceNewsdataUpdateCountryLv SourceNewsdataUpdateCountry = "lv"
	SourceNewsdataUpdateCountryLb SourceNewsdataUpdateCountry = "lb"
	SourceNewsdataUpdateCountryLt SourceNewsdataUpdateCountry = "lt"
	SourceNewsdataUpdateCountryMy SourceNewsdataUpdateCountry = "my"
	SourceNewsdataUpdateCountryMx SourceNewsdataUpdateCountry = "mx"
	SourceNewsdataUpdateCountryMa SourceNewsdataUpdateCountry = "ma"
	SourceNewsdataUpdateCountryMm SourceNewsdataUpdateCountry = "mm"
	SourceNewsdataUpdateCountryNl SourceNewsdataUpdateCountry = "nl"
	SourceNewsdataUpdateCountryNz SourceNewsdataUpdateCountry = "nz"
	SourceNewsdataUpdateCountryNg SourceNewsdataUpdateCountry = "ng"
	SourceNewsdataUpdateCountryKp SourceNewsdataUpdateCountry = "kp"
	SourceNewsdataUpdateCountryNo SourceNewsdataUpdateCountry = "no"
	SourceNewsdataUpdateCountryPk SourceNewsdataUpdateCountry = "pk"
	SourceNewsdataUpdateCountryPe SourceNewsdataUpdateCountry = "pe"
	SourceNewsdataUpdateCountryPh SourceNewsdataUpdateCountry = "ph"
	SourceNewsdataUpdateCountryPl SourceNewsdataUpdateCountry = "pl"
	SourceNewsdataUpdateCountryPt SourceNewsdataUpdateCountry = "pt"
	SourceNewsdataUpdateCountryPr SourceNewsdataUpdateCountry = "pr"
	SourceNewsdataUpdateCountryRo SourceNewsdataUpdateCountry = "ro"
	SourceNewsdataUpdateCountryRu SourceNewsdataUpdateCountry = "ru"
	SourceNewsdataUpdateCountrySa SourceNewsdataUpdateCountry = "sa"
	SourceNewsdataUpdateCountryRs SourceNewsdataUpdateCountry = "rs"
	SourceNewsdataUpdateCountrySg SourceNewsdataUpdateCountry = "sg"
	SourceNewsdataUpdateCountrySk SourceNewsdataUpdateCountry = "sk"
	SourceNewsdataUpdateCountrySi SourceNewsdataUpdateCountry = "si"
	SourceNewsdataUpdateCountryZa SourceNewsdataUpdateCountry = "za"
	SourceNewsdataUpdateCountryKr SourceNewsdataUpdateCountry = "kr"
	SourceNewsdataUpdateCountryEs SourceNewsdataUpdateCountry = "es"
	SourceNewsdataUpdateCountrySe SourceNewsdataUpdateCountry = "se"
	SourceNewsdataUpdateCountryCh SourceNewsdataUpdateCountry = "ch"
	SourceNewsdataUpdateCountryTw SourceNewsdataUpdateCountry = "tw"
	SourceNewsdataUpdateCountryTz SourceNewsdataUpdateCountry = "tz"
	SourceNewsdataUpdateCountryTh SourceNewsdataUpdateCountry = "th"
	SourceNewsdataUpdateCountryTr SourceNewsdataUpdateCountry = "tr"
	SourceNewsdataUpdateCountryUa SourceNewsdataUpdateCountry = "ua"
	SourceNewsdataUpdateCountryAe SourceNewsdataUpdateCountry = "ae"
	SourceNewsdataUpdateCountryGb SourceNewsdataUpdateCountry = "gb"
	SourceNewsdataUpdateCountryUs SourceNewsdataUpdateCountry = "us"
	SourceNewsdataUpdateCountryVe SourceNewsdataUpdateCountry = "ve"
	SourceNewsdataUpdateCountryVi SourceNewsdataUpdateCountry = "vi"
)

func (e SourceNewsdataUpdateCountry) ToPointer() *SourceNewsdataUpdateCountry {
	return &e
}
func (e *SourceNewsdataUpdateCountry) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "ar":
		fallthrough
	case "au":
		fallthrough
	case "at":
		fallthrough
	case "bd":
		fallthrough
	case "by":
		fallthrough
	case "be":
		fallthrough
	case "br":
		fallthrough
	case "bg":
		fallthrough
	case "ca":
		fallthrough
	case "cl":
		fallthrough
	case "cn":
		fallthrough
	case "co":
		fallthrough
	case "cr":
		fallthrough
	case "cu":
		fallthrough
	case "cz":
		fallthrough
	case "dk":
		fallthrough
	case "do":
		fallthrough
	case "ec":
		fallthrough
	case "eg":
		fallthrough
	case "ee":
		fallthrough
	case "et":
		fallthrough
	case "fi":
		fallthrough
	case "fr":
		fallthrough
	case "de":
		fallthrough
	case "gr":
		fallthrough
	case "hk":
		fallthrough
	case "hu":
		fallthrough
	case "in":
		fallthrough
	case "id":
		fallthrough
	case "iq":
		fallthrough
	case "ie":
		fallthrough
	case "il":
		fallthrough
	case "it":
		fallthrough
	case "jp":
		fallthrough
	case "kz":
		fallthrough
	case "kw":
		fallthrough
	case "lv":
		fallthrough
	case "lb":
		fallthrough
	case "lt":
		fallthrough
	case "my":
		fallthrough
	case "mx":
		fallthrough
	case "ma":
		fallthrough
	case "mm":
		fallthrough
	case "nl":
		fallthrough
	case "nz":
		fallthrough
	case "ng":
		fallthrough
	case "kp":
		fallthrough
	case "no":
		fallthrough
	case "pk":
		fallthrough
	case "pe":
		fallthrough
	case "ph":
		fallthrough
	case "pl":
		fallthrough
	case "pt":
		fallthrough
	case "pr":
		fallthrough
	case "ro":
		fallthrough
	case "ru":
		fallthrough
	case "sa":
		fallthrough
	case "rs":
		fallthrough
	case "sg":
		fallthrough
	case "sk":
		fallthrough
	case "si":
		fallthrough
	case "za":
		fallthrough
	case "kr":
		fallthrough
	case "es":
		fallthrough
	case "se":
		fallthrough
	case "ch":
		fallthrough
	case "tw":
		fallthrough
	case "tz":
		fallthrough
	case "th":
		fallthrough
	case "tr":
		fallthrough
	case "ua":
		fallthrough
	case "ae":
		fallthrough
	case "gb":
		fallthrough
	case "us":
		fallthrough
	case "ve":
		fallthrough
	case "vi":
		*e = SourceNewsdataUpdateCountry(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceNewsdataUpdateCountry: %v", v)
	}
}

type SourceNewsdataUpdateLanguage string

const (
	SourceNewsdataUpdateLanguageBe  SourceNewsdataUpdateLanguage = "be"
	SourceNewsdataUpdateLanguageAm  SourceNewsdataUpdateLanguage = "am"
	SourceNewsdataUpdateLanguageAr  SourceNewsdataUpdateLanguage = "ar"
	SourceNewsdataUpdateLanguageBn  SourceNewsdataUpdateLanguage = "bn"
	SourceNewsdataUpdateLanguageBs  SourceNewsdataUpdateLanguage = "bs"
	SourceNewsdataUpdateLanguageBg  SourceNewsdataUpdateLanguage = "bg"
	SourceNewsdataUpdateLanguageMy  SourceNewsdataUpdateLanguage = "my"
	SourceNewsdataUpdateLanguageCkb SourceNewsdataUpdateLanguage = "ckb"
	SourceNewsdataUpdateLanguageZh  SourceNewsdataUpdateLanguage = "zh"
	SourceNewsdataUpdateLanguageHr  SourceNewsdataUpdateLanguage = "hr"
	SourceNewsdataUpdateLanguageCs  SourceNewsdataUpdateLanguage = "cs"
	SourceNewsdataUpdateLanguageDa  SourceNewsdataUpdateLanguage = "da"
	SourceNewsdataUpdateLanguageNl  SourceNewsdataUpdateLanguage = "nl"
	SourceNewsdataUpdateLanguageEn  SourceNewsdataUpdateLanguage = "en"
	SourceNewsdataUpdateLanguageEt  SourceNewsdataUpdateLanguage = "et"
	SourceNewsdataUpdateLanguageFi  SourceNewsdataUpdateLanguage = "fi"
	SourceNewsdataUpdateLanguageFr  SourceNewsdataUpdateLanguage = "fr"
	SourceNewsdataUpdateLanguageDe  SourceNewsdataUpdateLanguage = "de"
	SourceNewsdataUpdateLanguageEl  SourceNewsdataUpdateLanguage = "el"
	SourceNewsdataUpdateLanguageHe  SourceNewsdataUpdateLanguage = "he"
	SourceNewsdataUpdateLanguageHi  SourceNewsdataUpdateLanguage = "hi"
	SourceNewsdataUpdateLanguageHu  SourceNewsdataUpdateLanguage = "hu"
	SourceNewsdataUpdateLanguageIn  SourceNewsdataUpdateLanguage = "in"
	SourceNewsdataUpdateLanguageIt  SourceNewsdataUpdateLanguage = "it"
	SourceNewsdataUpdateLanguageJp  SourceNewsdataUpdateLanguage = "jp"
	SourceNewsdataUpdateLanguageKo  SourceNewsdataUpdateLanguage = "ko"
	SourceNewsdataUpdateLanguageLv  SourceNewsdataUpdateLanguage = "lv"
	SourceNewsdataUpdateLanguageLt  SourceNewsdataUpdateLanguage = "lt"
	SourceNewsdataUpdateLanguageMs  SourceNewsdataUpdateLanguage = "ms"
	SourceNewsdataUpdateLanguageNo  SourceNewsdataUpdateLanguage = "no"
	SourceNewsdataUpdateLanguagePl  SourceNewsdataUpdateLanguage = "pl"
	SourceNewsdataUpdateLanguagePt  SourceNewsdataUpdateLanguage = "pt"
	SourceNewsdataUpdateLanguageRo  SourceNewsdataUpdateLanguage = "ro"
	SourceNewsdataUpdateLanguageRu  SourceNewsdataUpdateLanguage = "ru"
	SourceNewsdataUpdateLanguageSr  SourceNewsdataUpdateLanguage = "sr"
	SourceNewsdataUpdateLanguageSk  SourceNewsdataUpdateLanguage = "sk"
	SourceNewsdataUpdateLanguageSl  SourceNewsdataUpdateLanguage = "sl"
	SourceNewsdataUpdateLanguageEs  SourceNewsdataUpdateLanguage = "es"
	SourceNewsdataUpdateLanguageSw  SourceNewsdataUpdateLanguage = "sw"
	SourceNewsdataUpdateLanguageSv  SourceNewsdataUpdateLanguage = "sv"
	SourceNewsdataUpdateLanguageTh  SourceNewsdataUpdateLanguage = "th"
	SourceNewsdataUpdateLanguageTr  SourceNewsdataUpdateLanguage = "tr"
	SourceNewsdataUpdateLanguageUk  SourceNewsdataUpdateLanguage = "uk"
	SourceNewsdataUpdateLanguageUr  SourceNewsdataUpdateLanguage = "ur"
	SourceNewsdataUpdateLanguageVi  SourceNewsdataUpdateLanguage = "vi"
)

func (e SourceNewsdataUpdateLanguage) ToPointer() *SourceNewsdataUpdateLanguage {
	return &e
}
func (e *SourceNewsdataUpdateLanguage) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "be":
		fallthrough
	case "am":
		fallthrough
	case "ar":
		fallthrough
	case "bn":
		fallthrough
	case "bs":
		fallthrough
	case "bg":
		fallthrough
	case "my":
		fallthrough
	case "ckb":
		fallthrough
	case "zh":
		fallthrough
	case "hr":
		fallthrough
	case "cs":
		fallthrough
	case "da":
		fallthrough
	case "nl":
		fallthrough
	case "en":
		fallthrough
	case "et":
		fallthrough
	case "fi":
		fallthrough
	case "fr":
		fallthrough
	case "de":
		fallthrough
	case "el":
		fallthrough
	case "he":
		fallthrough
	case "hi":
		fallthrough
	case "hu":
		fallthrough
	case "in":
		fallthrough
	case "it":
		fallthrough
	case "jp":
		fallthrough
	case "ko":
		fallthrough
	case "lv":
		fallthrough
	case "lt":
		fallthrough
	case "ms":
		fallthrough
	case "no":
		fallthrough
	case "pl":
		fallthrough
	case "pt":
		fallthrough
	case "ro":
		fallthrough
	case "ru":
		fallthrough
	case "sr":
		fallthrough
	case "sk":
		fallthrough
	case "sl":
		fallthrough
	case "es":
		fallthrough
	case "sw":
		fallthrough
	case "sv":
		fallthrough
	case "th":
		fallthrough
	case "tr":
		fallthrough
	case "uk":
		fallthrough
	case "ur":
		fallthrough
	case "vi":
		*e = SourceNewsdataUpdateLanguage(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceNewsdataUpdateLanguage: %v", v)
	}
}

type SourceNewsdataUpdate struct {
	OneOf any `json:"OneOf,omitempty"`
	// API Key
	APIKey string `json:"api_key"`
	// Categories (maximum 5) to restrict the search to.
	Category []SourceNewsdataUpdateCategory `json:"category,omitempty"`
	// 2-letter ISO 3166-1 countries (maximum 5) to restrict the search to.
	Country []SourceNewsdataUpdateCountry `json:"country,omitempty"`
	// Domains (maximum 5) to restrict the search to. Use the sources stream to find top sources id.
	Domain []string `json:"domain,omitempty"`
	// Languages (maximum 5) to restrict the search to.
	Language []SourceNewsdataUpdateLanguage `json:"language,omitempty"`
}

func (o *SourceNewsdataUpdate) GetOneOf() any {
	if o == nil {
		return nil
	}
	return o.OneOf
}

func (o *SourceNewsdataUpdate) GetAPIKey() string {
	if o == nil {
		return ""
	}
	return o.APIKey
}

func (o *SourceNewsdataUpdate) GetCategory() []SourceNewsdataUpdateCategory {
	if o == nil {
		return nil
	}
	return o.Category
}

func (o *SourceNewsdataUpdate) GetCountry() []SourceNewsdataUpdateCountry {
	if o == nil {
		return nil
	}
	return o.Country
}

func (o *SourceNewsdataUpdate) GetDomain() []string {
	if o == nil {
		return nil
	}
	return o.Domain
}

func (o *SourceNewsdataUpdate) GetLanguage() []SourceNewsdataUpdateLanguage {
	if o == nil {
		return nil
	}
	return o.Language
}
