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

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

const (
	DomainCom   Domain = "com"
	DomainIn    Domain = "in"
	DomainJp    Domain = "jp"
	DomainEu    Domain = "eu"
	DomainComAu Domain = "com.au"
	DomainCa    Domain = "ca"
	DomainComCn Domain = "com.cn"
	DomainSa    Domain = "sa"
)

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

type ZohoInventory string

const (
	ZohoInventoryZohoInventory ZohoInventory = "zoho-inventory"
)

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

type SourceZohoInventory struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	// The domain suffix for the Zoho Inventory API based on your data center location (e.g., 'com', 'eu', 'in', etc.)
	Domain       *Domain       `default:"com" json:"domain"`
	RefreshToken string        `json:"refresh_token"`
	StartDate    time.Time     `json:"start_date"`
	sourceType   ZohoInventory `const:"zoho-inventory" json:"sourceType"`
}

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

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

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

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

func (o *SourceZohoInventory) GetDomain() *Domain {
	if o == nil {
		return nil
	}
	return o.Domain
}

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

func (o *SourceZohoInventory) GetStartDate() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartDate
}

func (o *SourceZohoInventory) GetSourceType() ZohoInventory {
	return ZohoInventoryZohoInventory
}
