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

const (
	ThinkificThinkific Thinkific = "thinkific"
)

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

type SourceThinkific struct {
	// Your Thinkific API key for authentication.
	APIKey string `json:"api_key"`
	// The subdomain of your Thinkific URL (e.g., if your URL is example.thinkific.com, your subdomain is "example".
	Subdomain  string    `json:"subdomain"`
	sourceType Thinkific `const:"thinkific" json:"sourceType"`
}

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

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

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

func (o *SourceThinkific) GetSubdomain() string {
	if o == nil {
		return ""
	}
	return o.Subdomain
}

func (o *SourceThinkific) GetSourceType() Thinkific {
	return ThinkificThinkific
}
