// 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 Simplecast string

const (
	SimplecastSimplecast Simplecast = "simplecast"
)

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

type SourceSimplecast struct {
	// API token to use. Find it at your Private Apps page on the Simplecast dashboard.
	APIToken   string     `json:"api_token"`
	sourceType Simplecast `const:"simplecast" json:"sourceType"`
}

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

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

func (o *SourceSimplecast) GetAPIToken() string {
	if o == nil {
		return ""
	}
	return o.APIToken
}

func (o *SourceSimplecast) GetSourceType() Simplecast {
	return SimplecastSimplecast
}
