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

const (
	CampaynCampayn Campayn = "campayn"
)

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

type SourceCampayn struct {
	// API key to use. Find it in your Campayn account settings. Keep it secure as it grants access to your Campayn data.
	APIKey     string  `json:"api_key"`
	SubDomain  string  `json:"sub_domain"`
	sourceType Campayn `const:"campayn" json:"sourceType"`
}

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

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

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

func (o *SourceCampayn) GetSubDomain() string {
	if o == nil {
		return ""
	}
	return o.SubDomain
}

func (o *SourceCampayn) GetSourceType() Campayn {
	return CampaynCampayn
}
