// 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"
)

// SourceZohoBiginDataCenter - The data center where the Bigin account's resources are hosted
type SourceZohoBiginDataCenter string

const (
	SourceZohoBiginDataCenterCom   SourceZohoBiginDataCenter = "com"
	SourceZohoBiginDataCenterComAu SourceZohoBiginDataCenter = "com.au"
	SourceZohoBiginDataCenterEu    SourceZohoBiginDataCenter = "eu"
	SourceZohoBiginDataCenterIn    SourceZohoBiginDataCenter = "in"
	SourceZohoBiginDataCenterComCn SourceZohoBiginDataCenter = "com.cn"
	SourceZohoBiginDataCenterJp    SourceZohoBiginDataCenter = "jp"
)

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

type ZohoBigin string

const (
	ZohoBiginZohoBigin ZohoBigin = "zoho-bigin"
)

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

type SourceZohoBigin struct {
	ClientID           string `json:"client_id"`
	ClientRefreshToken string `json:"client_refresh_token"`
	ClientSecret       string `json:"client_secret"`
	// The data center where the Bigin account's resources are hosted
	DataCenter *SourceZohoBiginDataCenter `default:"com" json:"data_center"`
	ModuleName string                     `json:"module_name"`
	sourceType ZohoBigin                  `const:"zoho-bigin" json:"sourceType"`
}

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

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

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

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

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

func (o *SourceZohoBigin) GetDataCenter() *SourceZohoBiginDataCenter {
	if o == nil {
		return nil
	}
	return o.DataCenter
}

func (o *SourceZohoBigin) GetModuleName() string {
	if o == nil {
		return ""
	}
	return o.ModuleName
}

func (o *SourceZohoBigin) GetSourceType() ZohoBigin {
	return ZohoBiginZohoBigin
}
