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

const (
	LaunchdarklyLaunchdarkly Launchdarkly = "launchdarkly"
)

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

type SourceLaunchdarkly struct {
	// Your Access token. See <a href="https://apidocs.launchdarkly.com/#section/Overview/Authentication">here</a>.
	AccessToken string       `json:"access_token"`
	sourceType  Launchdarkly `const:"launchdarkly" json:"sourceType"`
}

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

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

func (o *SourceLaunchdarkly) GetAccessToken() string {
	if o == nil {
		return ""
	}
	return o.AccessToken
}

func (o *SourceLaunchdarkly) GetSourceType() Launchdarkly {
	return LaunchdarklyLaunchdarkly
}
