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

const (
	LemlistLemlist Lemlist = "lemlist"
)

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

type SourceLemlist struct {
	// Lemlist API key,
	APIKey     string  `json:"api_key"`
	sourceType Lemlist `const:"lemlist" json:"sourceType"`
}

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

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

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

func (o *SourceLemlist) GetSourceType() Lemlist {
	return LemlistLemlist
}
