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

const (
	SourceZohoCampaignDataCenterCom      SourceZohoCampaignDataCenter = "com"
	SourceZohoCampaignDataCenterEu       SourceZohoCampaignDataCenter = "eu"
	SourceZohoCampaignDataCenterIn       SourceZohoCampaignDataCenter = "in"
	SourceZohoCampaignDataCenterComAu    SourceZohoCampaignDataCenter = "com.au"
	SourceZohoCampaignDataCenterDotJp    SourceZohoCampaignDataCenter = ".jp"
	SourceZohoCampaignDataCenterDotComCn SourceZohoCampaignDataCenter = ".com.cn"
)

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

type ZohoCampaign string

const (
	ZohoCampaignZohoCampaign ZohoCampaign = "zoho-campaign"
)

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

type SourceZohoCampaign struct {
	ClientID2          string                       `json:"client_id_2"`
	ClientRefreshToken string                       `json:"client_refresh_token"`
	ClientSecret2      string                       `json:"client_secret_2"`
	DataCenter         SourceZohoCampaignDataCenter `json:"data_center"`
	sourceType         ZohoCampaign                 `const:"zoho-campaign" json:"sourceType"`
}

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

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

func (o *SourceZohoCampaign) GetClientID2() string {
	if o == nil {
		return ""
	}
	return o.ClientID2
}

func (o *SourceZohoCampaign) GetClientRefreshToken() string {
	if o == nil {
		return ""
	}
	return o.ClientRefreshToken
}

func (o *SourceZohoCampaign) GetClientSecret2() string {
	if o == nil {
		return ""
	}
	return o.ClientSecret2
}

func (o *SourceZohoCampaign) GetDataCenter() SourceZohoCampaignDataCenter {
	if o == nil {
		return SourceZohoCampaignDataCenter("")
	}
	return o.DataCenter
}

func (o *SourceZohoCampaign) GetSourceType() ZohoCampaign {
	return ZohoCampaignZohoCampaign
}
