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

const (
	OmnisendOmnisend Omnisend = "omnisend"
)

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

type SourceOmnisend struct {
	// API Key
	APIKey     string   `json:"api_key"`
	sourceType Omnisend `const:"omnisend" json:"sourceType"`
}

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

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

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

func (o *SourceOmnisend) GetSourceType() Omnisend {
	return OmnisendOmnisend
}
