// 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"
	"time"
)

type ThriveLearning string

const (
	ThriveLearningThriveLearning ThriveLearning = "thrive-learning"
)

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

type SourceThriveLearning struct {
	Password  *string   `json:"password,omitempty"`
	StartDate time.Time `json:"start_date"`
	// Your website Tenant ID (eu-west-000000 please contact support for your tenant)
	Username   string         `json:"username"`
	sourceType ThriveLearning `const:"thrive-learning" json:"sourceType"`
}

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

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

func (o *SourceThriveLearning) GetPassword() *string {
	if o == nil {
		return nil
	}
	return o.Password
}

func (o *SourceThriveLearning) GetStartDate() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartDate
}

func (o *SourceThriveLearning) GetUsername() string {
	if o == nil {
		return ""
	}
	return o.Username
}

func (o *SourceThriveLearning) GetSourceType() ThriveLearning {
	return ThriveLearningThriveLearning
}
