// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package shared

import (
	"encoding/json"
	"fmt"
)

type SourceZohoInvoiceUpdateRegion string

const (
	SourceZohoInvoiceUpdateRegionCom   SourceZohoInvoiceUpdateRegion = "com"
	SourceZohoInvoiceUpdateRegionEu    SourceZohoInvoiceUpdateRegion = "eu"
	SourceZohoInvoiceUpdateRegionIn    SourceZohoInvoiceUpdateRegion = "in"
	SourceZohoInvoiceUpdateRegionComCn SourceZohoInvoiceUpdateRegion = "com.cn"
	SourceZohoInvoiceUpdateRegionComAu SourceZohoInvoiceUpdateRegion = "com.au"
	SourceZohoInvoiceUpdateRegionJp    SourceZohoInvoiceUpdateRegion = "jp"
	SourceZohoInvoiceUpdateRegionSa    SourceZohoInvoiceUpdateRegion = "sa"
	SourceZohoInvoiceUpdateRegionCa    SourceZohoInvoiceUpdateRegion = "ca"
)

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

type SourceZohoInvoiceUpdate struct {
	ClientID           string `json:"client_id"`
	ClientRefreshToken string `json:"client_refresh_token"`
	ClientSecret       string `json:"client_secret"`
	// To be provided if a user belongs to multiple organizations
	OrganizationID *string                       `json:"organization_id,omitempty"`
	Region         SourceZohoInvoiceUpdateRegion `json:"region"`
}

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

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

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

func (o *SourceZohoInvoiceUpdate) GetOrganizationID() *string {
	if o == nil {
		return nil
	}
	return o.OrganizationID
}

func (o *SourceZohoInvoiceUpdate) GetRegion() SourceZohoInvoiceUpdateRegion {
	if o == nil {
		return SourceZohoInvoiceUpdateRegion("")
	}
	return o.Region
}
