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

const (
	ZenefitsZenefits Zenefits = "zenefits"
)

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

type SourceZenefits struct {
	// Use Sync with Zenefits button on the link given on the readme file, and get the token to access the api
	Token      string   `json:"token"`
	sourceType Zenefits `const:"zenefits" json:"sourceType"`
}

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

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

func (o *SourceZenefits) GetToken() string {
	if o == nil {
		return ""
	}
	return o.Token
}

func (o *SourceZenefits) GetSourceType() Zenefits {
	return ZenefitsZenefits
}
