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

// SourceZohoExpenseDataCenter - The domain suffix for the Zoho Expense API based on your data center location (e.g., 'com', 'eu', 'in', etc.)
type SourceZohoExpenseDataCenter string

const (
	SourceZohoExpenseDataCenterCom   SourceZohoExpenseDataCenter = "com"
	SourceZohoExpenseDataCenterIn    SourceZohoExpenseDataCenter = "in"
	SourceZohoExpenseDataCenterJp    SourceZohoExpenseDataCenter = "jp"
	SourceZohoExpenseDataCenterCa    SourceZohoExpenseDataCenter = "ca"
	SourceZohoExpenseDataCenterComCn SourceZohoExpenseDataCenter = "com.cn"
	SourceZohoExpenseDataCenterSa    SourceZohoExpenseDataCenter = "sa"
	SourceZohoExpenseDataCenterComAu SourceZohoExpenseDataCenter = "com.au"
	SourceZohoExpenseDataCenterEu    SourceZohoExpenseDataCenter = "eu"
)

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

type ZohoExpense string

const (
	ZohoExpenseZohoExpense ZohoExpense = "zoho-expense"
)

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

type SourceZohoExpense struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	// The domain suffix for the Zoho Expense API based on your data center location (e.g., 'com', 'eu', 'in', etc.)
	DataCenter   *SourceZohoExpenseDataCenter `default:"com" json:"data_center"`
	RefreshToken string                       `json:"refresh_token"`
	sourceType   ZohoExpense                  `const:"zoho-expense" json:"sourceType"`
}

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

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

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

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

func (o *SourceZohoExpense) GetDataCenter() *SourceZohoExpenseDataCenter {
	if o == nil {
		return nil
	}
	return o.DataCenter
}

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

func (o *SourceZohoExpense) GetSourceType() ZohoExpense {
	return ZohoExpenseZohoExpense
}
