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

package shared

import (
	"encoding/json"
	"fmt"
)

type SourceTremendousUpdateEnvironment string

const (
	SourceTremendousUpdateEnvironmentAPI        SourceTremendousUpdateEnvironment = "api"
	SourceTremendousUpdateEnvironmentTestflight SourceTremendousUpdateEnvironment = "testflight"
)

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

type SourceTremendousUpdate struct {
	// API key to use. You can generate an API key through the Tremendous dashboard under Team Settings > Developers. Save the key once you’ve generated it.
	APIKey      string                            `json:"api_key"`
	Environment SourceTremendousUpdateEnvironment `json:"environment"`
}

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

func (o *SourceTremendousUpdate) GetEnvironment() SourceTremendousUpdateEnvironment {
	if o == nil {
		return SourceTremendousUpdateEnvironment("")
	}
	return o.Environment
}
