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

const (
	SourceZohoAnalyticsMetadataAPIUpdateDataCenterCom   SourceZohoAnalyticsMetadataAPIUpdateDataCenter = "com"
	SourceZohoAnalyticsMetadataAPIUpdateDataCenterEu    SourceZohoAnalyticsMetadataAPIUpdateDataCenter = "eu"
	SourceZohoAnalyticsMetadataAPIUpdateDataCenterIn    SourceZohoAnalyticsMetadataAPIUpdateDataCenter = "in"
	SourceZohoAnalyticsMetadataAPIUpdateDataCenterComAu SourceZohoAnalyticsMetadataAPIUpdateDataCenter = "com.au"
	SourceZohoAnalyticsMetadataAPIUpdateDataCenterComCn SourceZohoAnalyticsMetadataAPIUpdateDataCenter = "com.cn"
	SourceZohoAnalyticsMetadataAPIUpdateDataCenterJp    SourceZohoAnalyticsMetadataAPIUpdateDataCenter = "jp"
)

func (e SourceZohoAnalyticsMetadataAPIUpdateDataCenter) ToPointer() *SourceZohoAnalyticsMetadataAPIUpdateDataCenter {
	return &e
}
func (e *SourceZohoAnalyticsMetadataAPIUpdateDataCenter) 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 "com.cn":
		fallthrough
	case "jp":
		*e = SourceZohoAnalyticsMetadataAPIUpdateDataCenter(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceZohoAnalyticsMetadataAPIUpdateDataCenter: %v", v)
	}
}

type SourceZohoAnalyticsMetadataAPIUpdate struct {
	ClientID     string                                          `json:"client_id"`
	ClientSecret string                                          `json:"client_secret"`
	DataCenter   *SourceZohoAnalyticsMetadataAPIUpdateDataCenter `default:"com" json:"data_center"`
	OrgID        float64                                         `json:"org_id"`
	RefreshToken string                                          `json:"refresh_token"`
}

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

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

func (o *SourceZohoAnalyticsMetadataAPIUpdate) GetClientID() string {
	if o == nil {
		return ""
	}
	return o.ClientID
}

func (o *SourceZohoAnalyticsMetadataAPIUpdate) GetClientSecret() string {
	if o == nil {
		return ""
	}
	return o.ClientSecret
}

func (o *SourceZohoAnalyticsMetadataAPIUpdate) GetDataCenter() *SourceZohoAnalyticsMetadataAPIUpdateDataCenter {
	if o == nil {
		return nil
	}
	return o.DataCenter
}

func (o *SourceZohoAnalyticsMetadataAPIUpdate) GetOrgID() float64 {
	if o == nil {
		return 0.0
	}
	return o.OrgID
}

func (o *SourceZohoAnalyticsMetadataAPIUpdate) GetRefreshToken() string {
	if o == nil {
		return ""
	}
	return o.RefreshToken
}
