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

const (
	SpotlercrmSpotlercrm Spotlercrm = "spotlercrm"
)

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

type SourceSpotlercrm struct {
	// Access Token to authenticate API requests. Generate it by logging into your CRM system, navigating to Settings / Integrations / API V4, and clicking 'generate new key'.
	AccessToken string     `json:"access_token"`
	sourceType  Spotlercrm `const:"spotlercrm" json:"sourceType"`
}

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

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

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

func (o *SourceSpotlercrm) GetSourceType() Spotlercrm {
	return SpotlercrmSpotlercrm
}
