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

package shared

import (
	"encoding/json"
	"fmt"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/internal/utils"
)

type Goldcast string

const (
	GoldcastGoldcast Goldcast = "goldcast"
)

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

type SourceGoldcast struct {
	// Your API Access Key. See <a href="https://help.goldcast.io/hc/en-us/articles/22931655725723-How-To-Create-an-API-Token-in-Goldcast">here</a>. The key is case sensitive.
	AccessKey  string   `json:"access_key"`
	sourceType Goldcast `const:"goldcast" json:"sourceType"`
}

func (s SourceGoldcast) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceGoldcast) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil {
		return err
	}
	return nil
}

func (o *SourceGoldcast) GetAccessKey() string {
	if o == nil {
		return ""
	}
	return o.AccessKey
}

func (o *SourceGoldcast) GetSourceType() Goldcast {
	return GoldcastGoldcast
}
