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

package shared

import (
	"encoding/json"
	"errors"
	"fmt"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/internal/utils"
)

type DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbedding5Mode string

const (
	DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbedding5ModeOpenaiCompatible DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbedding5Mode = "openai_compatible"
)

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

// DestinationSnowflakeCortexUpdateOpenAICompatible - Use a service that's compatible with the OpenAI API to embed text.
type DestinationSnowflakeCortexUpdateOpenAICompatible struct {
	APIKey *string `default:"" json:"api_key"`
	// The base URL for your OpenAI-compatible service
	BaseURL string `json:"base_url"`
	// The number of dimensions the embedding model is generating
	Dimensions int64                                                           `json:"dimensions"`
	mode       *DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbedding5Mode `const:"openai_compatible" json:"mode"`
	// The name of the model to use for embedding
	ModelName *string `default:"text-embedding-ada-002" json:"model_name"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateOpenAICompatible) GetAPIKey() *string {
	if o == nil {
		return nil
	}
	return o.APIKey
}

func (o *DestinationSnowflakeCortexUpdateOpenAICompatible) GetBaseURL() string {
	if o == nil {
		return ""
	}
	return o.BaseURL
}

func (o *DestinationSnowflakeCortexUpdateOpenAICompatible) GetDimensions() int64 {
	if o == nil {
		return 0
	}
	return o.Dimensions
}

func (o *DestinationSnowflakeCortexUpdateOpenAICompatible) GetMode() *DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbedding5Mode {
	return DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbedding5ModeOpenaiCompatible.ToPointer()
}

func (o *DestinationSnowflakeCortexUpdateOpenAICompatible) GetModelName() *string {
	if o == nil {
		return nil
	}
	return o.ModelName
}

type DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbeddingMode string

const (
	DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbeddingModeAzureOpenai DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbeddingMode = "azure_openai"
)

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

// DestinationSnowflakeCortexUpdateAzureOpenAI - Use the Azure-hosted OpenAI API to embed text. This option is using the text-embedding-ada-002 model with 1536 embedding dimensions.
type DestinationSnowflakeCortexUpdateAzureOpenAI struct {
	// The base URL for your Azure OpenAI resource.  You can find this in the Azure portal under your Azure OpenAI resource
	APIBase string `json:"api_base"`
	// The deployment for your Azure OpenAI resource.  You can find this in the Azure portal under your Azure OpenAI resource
	Deployment string                                                         `json:"deployment"`
	mode       *DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbeddingMode `const:"azure_openai" json:"mode"`
	// The API key for your Azure OpenAI resource.  You can find this in the Azure portal under your Azure OpenAI resource
	OpenaiKey string `json:"openai_key"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateAzureOpenAI) GetAPIBase() string {
	if o == nil {
		return ""
	}
	return o.APIBase
}

func (o *DestinationSnowflakeCortexUpdateAzureOpenAI) GetDeployment() string {
	if o == nil {
		return ""
	}
	return o.Deployment
}

func (o *DestinationSnowflakeCortexUpdateAzureOpenAI) GetMode() *DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbeddingMode {
	return DestinationSnowflakeCortexUpdateSchemasEmbeddingEmbeddingModeAzureOpenai.ToPointer()
}

func (o *DestinationSnowflakeCortexUpdateAzureOpenAI) GetOpenaiKey() string {
	if o == nil {
		return ""
	}
	return o.OpenaiKey
}

type DestinationSnowflakeCortexUpdateSchemasEmbeddingMode string

const (
	DestinationSnowflakeCortexUpdateSchemasEmbeddingModeFake DestinationSnowflakeCortexUpdateSchemasEmbeddingMode = "fake"
)

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

// DestinationSnowflakeCortexUpdateFake - Use a fake embedding made out of random vectors with 1536 embedding dimensions. This is useful for testing the data pipeline without incurring any costs.
type DestinationSnowflakeCortexUpdateFake struct {
	mode *DestinationSnowflakeCortexUpdateSchemasEmbeddingMode `const:"fake" json:"mode"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateFake) GetMode() *DestinationSnowflakeCortexUpdateSchemasEmbeddingMode {
	return DestinationSnowflakeCortexUpdateSchemasEmbeddingModeFake.ToPointer()
}

type DestinationSnowflakeCortexUpdateSchemasMode string

const (
	DestinationSnowflakeCortexUpdateSchemasModeCohere DestinationSnowflakeCortexUpdateSchemasMode = "cohere"
)

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

// DestinationSnowflakeCortexUpdateCohere - Use the Cohere API to embed text.
type DestinationSnowflakeCortexUpdateCohere struct {
	CohereKey string                                       `json:"cohere_key"`
	mode      *DestinationSnowflakeCortexUpdateSchemasMode `const:"cohere" json:"mode"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateCohere) GetCohereKey() string {
	if o == nil {
		return ""
	}
	return o.CohereKey
}

func (o *DestinationSnowflakeCortexUpdateCohere) GetMode() *DestinationSnowflakeCortexUpdateSchemasMode {
	return DestinationSnowflakeCortexUpdateSchemasModeCohere.ToPointer()
}

type DestinationSnowflakeCortexUpdateMode string

const (
	DestinationSnowflakeCortexUpdateModeOpenai DestinationSnowflakeCortexUpdateMode = "openai"
)

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

// DestinationSnowflakeCortexUpdateOpenAI - Use the OpenAI API to embed text. This option is using the text-embedding-ada-002 model with 1536 embedding dimensions.
type DestinationSnowflakeCortexUpdateOpenAI struct {
	mode      *DestinationSnowflakeCortexUpdateMode `const:"openai" json:"mode"`
	OpenaiKey string                                `json:"openai_key"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateOpenAI) GetMode() *DestinationSnowflakeCortexUpdateMode {
	return DestinationSnowflakeCortexUpdateModeOpenai.ToPointer()
}

func (o *DestinationSnowflakeCortexUpdateOpenAI) GetOpenaiKey() string {
	if o == nil {
		return ""
	}
	return o.OpenaiKey
}

type DestinationSnowflakeCortexUpdateEmbeddingType string

const (
	DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateOpenAI           DestinationSnowflakeCortexUpdateEmbeddingType = "destination-snowflake-cortex-update_OpenAI"
	DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateCohere           DestinationSnowflakeCortexUpdateEmbeddingType = "destination-snowflake-cortex-update_Cohere"
	DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateFake             DestinationSnowflakeCortexUpdateEmbeddingType = "destination-snowflake-cortex-update_Fake"
	DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateAzureOpenAI      DestinationSnowflakeCortexUpdateEmbeddingType = "destination-snowflake-cortex-update_Azure OpenAI"
	DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateOpenAICompatible DestinationSnowflakeCortexUpdateEmbeddingType = "destination-snowflake-cortex-update_OpenAI-compatible"
)

// DestinationSnowflakeCortexUpdateEmbedding - Embedding configuration
type DestinationSnowflakeCortexUpdateEmbedding struct {
	DestinationSnowflakeCortexUpdateOpenAI           *DestinationSnowflakeCortexUpdateOpenAI           `queryParam:"inline"`
	DestinationSnowflakeCortexUpdateCohere           *DestinationSnowflakeCortexUpdateCohere           `queryParam:"inline"`
	DestinationSnowflakeCortexUpdateFake             *DestinationSnowflakeCortexUpdateFake             `queryParam:"inline"`
	DestinationSnowflakeCortexUpdateAzureOpenAI      *DestinationSnowflakeCortexUpdateAzureOpenAI      `queryParam:"inline"`
	DestinationSnowflakeCortexUpdateOpenAICompatible *DestinationSnowflakeCortexUpdateOpenAICompatible `queryParam:"inline"`

	Type DestinationSnowflakeCortexUpdateEmbeddingType
}

func CreateDestinationSnowflakeCortexUpdateEmbeddingDestinationSnowflakeCortexUpdateOpenAI(destinationSnowflakeCortexUpdateOpenAI DestinationSnowflakeCortexUpdateOpenAI) DestinationSnowflakeCortexUpdateEmbedding {
	typ := DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateOpenAI

	return DestinationSnowflakeCortexUpdateEmbedding{
		DestinationSnowflakeCortexUpdateOpenAI: &destinationSnowflakeCortexUpdateOpenAI,
		Type:                                   typ,
	}
}

func CreateDestinationSnowflakeCortexUpdateEmbeddingDestinationSnowflakeCortexUpdateCohere(destinationSnowflakeCortexUpdateCohere DestinationSnowflakeCortexUpdateCohere) DestinationSnowflakeCortexUpdateEmbedding {
	typ := DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateCohere

	return DestinationSnowflakeCortexUpdateEmbedding{
		DestinationSnowflakeCortexUpdateCohere: &destinationSnowflakeCortexUpdateCohere,
		Type:                                   typ,
	}
}

func CreateDestinationSnowflakeCortexUpdateEmbeddingDestinationSnowflakeCortexUpdateFake(destinationSnowflakeCortexUpdateFake DestinationSnowflakeCortexUpdateFake) DestinationSnowflakeCortexUpdateEmbedding {
	typ := DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateFake

	return DestinationSnowflakeCortexUpdateEmbedding{
		DestinationSnowflakeCortexUpdateFake: &destinationSnowflakeCortexUpdateFake,
		Type:                                 typ,
	}
}

func CreateDestinationSnowflakeCortexUpdateEmbeddingDestinationSnowflakeCortexUpdateAzureOpenAI(destinationSnowflakeCortexUpdateAzureOpenAI DestinationSnowflakeCortexUpdateAzureOpenAI) DestinationSnowflakeCortexUpdateEmbedding {
	typ := DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateAzureOpenAI

	return DestinationSnowflakeCortexUpdateEmbedding{
		DestinationSnowflakeCortexUpdateAzureOpenAI: &destinationSnowflakeCortexUpdateAzureOpenAI,
		Type: typ,
	}
}

func CreateDestinationSnowflakeCortexUpdateEmbeddingDestinationSnowflakeCortexUpdateOpenAICompatible(destinationSnowflakeCortexUpdateOpenAICompatible DestinationSnowflakeCortexUpdateOpenAICompatible) DestinationSnowflakeCortexUpdateEmbedding {
	typ := DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateOpenAICompatible

	return DestinationSnowflakeCortexUpdateEmbedding{
		DestinationSnowflakeCortexUpdateOpenAICompatible: &destinationSnowflakeCortexUpdateOpenAICompatible,
		Type: typ,
	}
}

func (u *DestinationSnowflakeCortexUpdateEmbedding) UnmarshalJSON(data []byte) error {

	var destinationSnowflakeCortexUpdateFake DestinationSnowflakeCortexUpdateFake = DestinationSnowflakeCortexUpdateFake{}
	if err := utils.UnmarshalJSON(data, &destinationSnowflakeCortexUpdateFake, "", true, true); err == nil {
		u.DestinationSnowflakeCortexUpdateFake = &destinationSnowflakeCortexUpdateFake
		u.Type = DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateFake
		return nil
	}

	var destinationSnowflakeCortexUpdateOpenAI DestinationSnowflakeCortexUpdateOpenAI = DestinationSnowflakeCortexUpdateOpenAI{}
	if err := utils.UnmarshalJSON(data, &destinationSnowflakeCortexUpdateOpenAI, "", true, true); err == nil {
		u.DestinationSnowflakeCortexUpdateOpenAI = &destinationSnowflakeCortexUpdateOpenAI
		u.Type = DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateOpenAI
		return nil
	}

	var destinationSnowflakeCortexUpdateCohere DestinationSnowflakeCortexUpdateCohere = DestinationSnowflakeCortexUpdateCohere{}
	if err := utils.UnmarshalJSON(data, &destinationSnowflakeCortexUpdateCohere, "", true, true); err == nil {
		u.DestinationSnowflakeCortexUpdateCohere = &destinationSnowflakeCortexUpdateCohere
		u.Type = DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateCohere
		return nil
	}

	var destinationSnowflakeCortexUpdateAzureOpenAI DestinationSnowflakeCortexUpdateAzureOpenAI = DestinationSnowflakeCortexUpdateAzureOpenAI{}
	if err := utils.UnmarshalJSON(data, &destinationSnowflakeCortexUpdateAzureOpenAI, "", true, true); err == nil {
		u.DestinationSnowflakeCortexUpdateAzureOpenAI = &destinationSnowflakeCortexUpdateAzureOpenAI
		u.Type = DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateAzureOpenAI
		return nil
	}

	var destinationSnowflakeCortexUpdateOpenAICompatible DestinationSnowflakeCortexUpdateOpenAICompatible = DestinationSnowflakeCortexUpdateOpenAICompatible{}
	if err := utils.UnmarshalJSON(data, &destinationSnowflakeCortexUpdateOpenAICompatible, "", true, true); err == nil {
		u.DestinationSnowflakeCortexUpdateOpenAICompatible = &destinationSnowflakeCortexUpdateOpenAICompatible
		u.Type = DestinationSnowflakeCortexUpdateEmbeddingTypeDestinationSnowflakeCortexUpdateOpenAICompatible
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for DestinationSnowflakeCortexUpdateEmbedding", string(data))
}

func (u DestinationSnowflakeCortexUpdateEmbedding) MarshalJSON() ([]byte, error) {
	if u.DestinationSnowflakeCortexUpdateOpenAI != nil {
		return utils.MarshalJSON(u.DestinationSnowflakeCortexUpdateOpenAI, "", true)
	}

	if u.DestinationSnowflakeCortexUpdateCohere != nil {
		return utils.MarshalJSON(u.DestinationSnowflakeCortexUpdateCohere, "", true)
	}

	if u.DestinationSnowflakeCortexUpdateFake != nil {
		return utils.MarshalJSON(u.DestinationSnowflakeCortexUpdateFake, "", true)
	}

	if u.DestinationSnowflakeCortexUpdateAzureOpenAI != nil {
		return utils.MarshalJSON(u.DestinationSnowflakeCortexUpdateAzureOpenAI, "", true)
	}

	if u.DestinationSnowflakeCortexUpdateOpenAICompatible != nil {
		return utils.MarshalJSON(u.DestinationSnowflakeCortexUpdateOpenAICompatible, "", true)
	}

	return nil, errors.New("could not marshal union type DestinationSnowflakeCortexUpdateEmbedding: all fields are null")
}

type DestinationSnowflakeCortexUpdateCredentials struct {
	// Enter the password you want to use to access the database
	Password string `json:"password"`
}

func (o *DestinationSnowflakeCortexUpdateCredentials) GetPassword() string {
	if o == nil {
		return ""
	}
	return o.Password
}

// DestinationSnowflakeCortexUpdateSnowflakeConnection - Snowflake can be used to store vector data and retrieve embeddings.
type DestinationSnowflakeCortexUpdateSnowflakeConnection struct {
	Credentials DestinationSnowflakeCortexUpdateCredentials `json:"credentials"`
	// Enter the name of the database that you want to sync data into
	Database string `json:"database"`
	// Enter the name of the default schema
	DefaultSchema string `json:"default_schema"`
	// Enter the account name you want to use to access the database. This is usually the identifier before .snowflakecomputing.com
	Host string `json:"host"`
	// Enter the role that you want to use to access Snowflake
	Role string `json:"role"`
	// Enter the name of the user you want to use to access the database
	Username string `json:"username"`
	// Enter the name of the warehouse that you want to use as a compute cluster
	Warehouse string `json:"warehouse"`
}

func (o *DestinationSnowflakeCortexUpdateSnowflakeConnection) GetCredentials() DestinationSnowflakeCortexUpdateCredentials {
	if o == nil {
		return DestinationSnowflakeCortexUpdateCredentials{}
	}
	return o.Credentials
}

func (o *DestinationSnowflakeCortexUpdateSnowflakeConnection) GetDatabase() string {
	if o == nil {
		return ""
	}
	return o.Database
}

func (o *DestinationSnowflakeCortexUpdateSnowflakeConnection) GetDefaultSchema() string {
	if o == nil {
		return ""
	}
	return o.DefaultSchema
}

func (o *DestinationSnowflakeCortexUpdateSnowflakeConnection) GetHost() string {
	if o == nil {
		return ""
	}
	return o.Host
}

func (o *DestinationSnowflakeCortexUpdateSnowflakeConnection) GetRole() string {
	if o == nil {
		return ""
	}
	return o.Role
}

func (o *DestinationSnowflakeCortexUpdateSnowflakeConnection) GetUsername() string {
	if o == nil {
		return ""
	}
	return o.Username
}

func (o *DestinationSnowflakeCortexUpdateSnowflakeConnection) GetWarehouse() string {
	if o == nil {
		return ""
	}
	return o.Warehouse
}

type DestinationSnowflakeCortexUpdateFieldNameMappingConfigModel struct {
	// The field name in the source
	FromField string `json:"from_field"`
	// The field name to use in the destination
	ToField string `json:"to_field"`
}

func (o *DestinationSnowflakeCortexUpdateFieldNameMappingConfigModel) GetFromField() string {
	if o == nil {
		return ""
	}
	return o.FromField
}

func (o *DestinationSnowflakeCortexUpdateFieldNameMappingConfigModel) GetToField() string {
	if o == nil {
		return ""
	}
	return o.ToField
}

// DestinationSnowflakeCortexUpdateLanguage - Split code in suitable places based on the programming language
type DestinationSnowflakeCortexUpdateLanguage string

const (
	DestinationSnowflakeCortexUpdateLanguageCpp      DestinationSnowflakeCortexUpdateLanguage = "cpp"
	DestinationSnowflakeCortexUpdateLanguageGo       DestinationSnowflakeCortexUpdateLanguage = "go"
	DestinationSnowflakeCortexUpdateLanguageJava     DestinationSnowflakeCortexUpdateLanguage = "java"
	DestinationSnowflakeCortexUpdateLanguageJs       DestinationSnowflakeCortexUpdateLanguage = "js"
	DestinationSnowflakeCortexUpdateLanguagePhp      DestinationSnowflakeCortexUpdateLanguage = "php"
	DestinationSnowflakeCortexUpdateLanguageProto    DestinationSnowflakeCortexUpdateLanguage = "proto"
	DestinationSnowflakeCortexUpdateLanguagePython   DestinationSnowflakeCortexUpdateLanguage = "python"
	DestinationSnowflakeCortexUpdateLanguageRst      DestinationSnowflakeCortexUpdateLanguage = "rst"
	DestinationSnowflakeCortexUpdateLanguageRuby     DestinationSnowflakeCortexUpdateLanguage = "ruby"
	DestinationSnowflakeCortexUpdateLanguageRust     DestinationSnowflakeCortexUpdateLanguage = "rust"
	DestinationSnowflakeCortexUpdateLanguageScala    DestinationSnowflakeCortexUpdateLanguage = "scala"
	DestinationSnowflakeCortexUpdateLanguageSwift    DestinationSnowflakeCortexUpdateLanguage = "swift"
	DestinationSnowflakeCortexUpdateLanguageMarkdown DestinationSnowflakeCortexUpdateLanguage = "markdown"
	DestinationSnowflakeCortexUpdateLanguageLatex    DestinationSnowflakeCortexUpdateLanguage = "latex"
	DestinationSnowflakeCortexUpdateLanguageHTML     DestinationSnowflakeCortexUpdateLanguage = "html"
	DestinationSnowflakeCortexUpdateLanguageSol      DestinationSnowflakeCortexUpdateLanguage = "sol"
)

func (e DestinationSnowflakeCortexUpdateLanguage) ToPointer() *DestinationSnowflakeCortexUpdateLanguage {
	return &e
}
func (e *DestinationSnowflakeCortexUpdateLanguage) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "cpp":
		fallthrough
	case "go":
		fallthrough
	case "java":
		fallthrough
	case "js":
		fallthrough
	case "php":
		fallthrough
	case "proto":
		fallthrough
	case "python":
		fallthrough
	case "rst":
		fallthrough
	case "ruby":
		fallthrough
	case "rust":
		fallthrough
	case "scala":
		fallthrough
	case "swift":
		fallthrough
	case "markdown":
		fallthrough
	case "latex":
		fallthrough
	case "html":
		fallthrough
	case "sol":
		*e = DestinationSnowflakeCortexUpdateLanguage(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationSnowflakeCortexUpdateLanguage: %v", v)
	}
}

type DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterTextSplitterMode string

const (
	DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterTextSplitterModeCode DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterTextSplitterMode = "code"
)

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

// DestinationSnowflakeCortexUpdateByProgrammingLanguage - Split the text by suitable delimiters based on the programming language. This is useful for splitting code into chunks.
type DestinationSnowflakeCortexUpdateByProgrammingLanguage struct {
	// Split code in suitable places based on the programming language
	Language DestinationSnowflakeCortexUpdateLanguage                                       `json:"language"`
	mode     *DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterTextSplitterMode `const:"code" json:"mode"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateByProgrammingLanguage) GetLanguage() DestinationSnowflakeCortexUpdateLanguage {
	if o == nil {
		return DestinationSnowflakeCortexUpdateLanguage("")
	}
	return o.Language
}

func (o *DestinationSnowflakeCortexUpdateByProgrammingLanguage) GetMode() *DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterTextSplitterMode {
	return DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterTextSplitterModeCode.ToPointer()
}

type DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterMode string

const (
	DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterModeMarkdown DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterMode = "markdown"
)

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

// DestinationSnowflakeCortexUpdateByMarkdownHeader - Split the text by Markdown headers down to the specified header level. If the chunk size fits multiple sections, they will be combined into a single chunk.
type DestinationSnowflakeCortexUpdateByMarkdownHeader struct {
	mode *DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterMode `const:"markdown" json:"mode"`
	// Level of markdown headers to split text fields by. Headings down to the specified level will be used as split points
	SplitLevel *int64 `default:"1" json:"split_level"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateByMarkdownHeader) GetMode() *DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterMode {
	return DestinationSnowflakeCortexUpdateSchemasProcessingTextSplitterModeMarkdown.ToPointer()
}

func (o *DestinationSnowflakeCortexUpdateByMarkdownHeader) GetSplitLevel() *int64 {
	if o == nil {
		return nil
	}
	return o.SplitLevel
}

type DestinationSnowflakeCortexUpdateSchemasProcessingMode string

const (
	DestinationSnowflakeCortexUpdateSchemasProcessingModeSeparator DestinationSnowflakeCortexUpdateSchemasProcessingMode = "separator"
)

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

// DestinationSnowflakeCortexUpdateBySeparator - Split the text by the list of separators until the chunk size is reached, using the earlier mentioned separators where possible. This is useful for splitting text fields by paragraphs, sentences, words, etc.
type DestinationSnowflakeCortexUpdateBySeparator struct {
	// Whether to keep the separator in the resulting chunks
	KeepSeparator *bool                                                  `default:"false" json:"keep_separator"`
	mode          *DestinationSnowflakeCortexUpdateSchemasProcessingMode `const:"separator" json:"mode"`
	// List of separator strings to split text fields by. The separator itself needs to be wrapped in double quotes, e.g. to split by the dot character, use ".". To split by a newline, use "\n".
	Separators []string `json:"separators,omitempty"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateBySeparator) GetKeepSeparator() *bool {
	if o == nil {
		return nil
	}
	return o.KeepSeparator
}

func (o *DestinationSnowflakeCortexUpdateBySeparator) GetMode() *DestinationSnowflakeCortexUpdateSchemasProcessingMode {
	return DestinationSnowflakeCortexUpdateSchemasProcessingModeSeparator.ToPointer()
}

func (o *DestinationSnowflakeCortexUpdateBySeparator) GetSeparators() []string {
	if o == nil {
		return nil
	}
	return o.Separators
}

type DestinationSnowflakeCortexUpdateTextSplitterType string

const (
	DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateBySeparator           DestinationSnowflakeCortexUpdateTextSplitterType = "destination-snowflake-cortex-update_By Separator"
	DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateByMarkdownHeader      DestinationSnowflakeCortexUpdateTextSplitterType = "destination-snowflake-cortex-update_By Markdown header"
	DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateByProgrammingLanguage DestinationSnowflakeCortexUpdateTextSplitterType = "destination-snowflake-cortex-update_By Programming Language"
)

// DestinationSnowflakeCortexUpdateTextSplitter - Split text fields into chunks based on the specified method.
type DestinationSnowflakeCortexUpdateTextSplitter struct {
	DestinationSnowflakeCortexUpdateBySeparator           *DestinationSnowflakeCortexUpdateBySeparator           `queryParam:"inline"`
	DestinationSnowflakeCortexUpdateByMarkdownHeader      *DestinationSnowflakeCortexUpdateByMarkdownHeader      `queryParam:"inline"`
	DestinationSnowflakeCortexUpdateByProgrammingLanguage *DestinationSnowflakeCortexUpdateByProgrammingLanguage `queryParam:"inline"`

	Type DestinationSnowflakeCortexUpdateTextSplitterType
}

func CreateDestinationSnowflakeCortexUpdateTextSplitterDestinationSnowflakeCortexUpdateBySeparator(destinationSnowflakeCortexUpdateBySeparator DestinationSnowflakeCortexUpdateBySeparator) DestinationSnowflakeCortexUpdateTextSplitter {
	typ := DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateBySeparator

	return DestinationSnowflakeCortexUpdateTextSplitter{
		DestinationSnowflakeCortexUpdateBySeparator: &destinationSnowflakeCortexUpdateBySeparator,
		Type: typ,
	}
}

func CreateDestinationSnowflakeCortexUpdateTextSplitterDestinationSnowflakeCortexUpdateByMarkdownHeader(destinationSnowflakeCortexUpdateByMarkdownHeader DestinationSnowflakeCortexUpdateByMarkdownHeader) DestinationSnowflakeCortexUpdateTextSplitter {
	typ := DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateByMarkdownHeader

	return DestinationSnowflakeCortexUpdateTextSplitter{
		DestinationSnowflakeCortexUpdateByMarkdownHeader: &destinationSnowflakeCortexUpdateByMarkdownHeader,
		Type: typ,
	}
}

func CreateDestinationSnowflakeCortexUpdateTextSplitterDestinationSnowflakeCortexUpdateByProgrammingLanguage(destinationSnowflakeCortexUpdateByProgrammingLanguage DestinationSnowflakeCortexUpdateByProgrammingLanguage) DestinationSnowflakeCortexUpdateTextSplitter {
	typ := DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateByProgrammingLanguage

	return DestinationSnowflakeCortexUpdateTextSplitter{
		DestinationSnowflakeCortexUpdateByProgrammingLanguage: &destinationSnowflakeCortexUpdateByProgrammingLanguage,
		Type: typ,
	}
}

func (u *DestinationSnowflakeCortexUpdateTextSplitter) UnmarshalJSON(data []byte) error {

	var destinationSnowflakeCortexUpdateByMarkdownHeader DestinationSnowflakeCortexUpdateByMarkdownHeader = DestinationSnowflakeCortexUpdateByMarkdownHeader{}
	if err := utils.UnmarshalJSON(data, &destinationSnowflakeCortexUpdateByMarkdownHeader, "", true, true); err == nil {
		u.DestinationSnowflakeCortexUpdateByMarkdownHeader = &destinationSnowflakeCortexUpdateByMarkdownHeader
		u.Type = DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateByMarkdownHeader
		return nil
	}

	var destinationSnowflakeCortexUpdateByProgrammingLanguage DestinationSnowflakeCortexUpdateByProgrammingLanguage = DestinationSnowflakeCortexUpdateByProgrammingLanguage{}
	if err := utils.UnmarshalJSON(data, &destinationSnowflakeCortexUpdateByProgrammingLanguage, "", true, true); err == nil {
		u.DestinationSnowflakeCortexUpdateByProgrammingLanguage = &destinationSnowflakeCortexUpdateByProgrammingLanguage
		u.Type = DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateByProgrammingLanguage
		return nil
	}

	var destinationSnowflakeCortexUpdateBySeparator DestinationSnowflakeCortexUpdateBySeparator = DestinationSnowflakeCortexUpdateBySeparator{}
	if err := utils.UnmarshalJSON(data, &destinationSnowflakeCortexUpdateBySeparator, "", true, true); err == nil {
		u.DestinationSnowflakeCortexUpdateBySeparator = &destinationSnowflakeCortexUpdateBySeparator
		u.Type = DestinationSnowflakeCortexUpdateTextSplitterTypeDestinationSnowflakeCortexUpdateBySeparator
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for DestinationSnowflakeCortexUpdateTextSplitter", string(data))
}

func (u DestinationSnowflakeCortexUpdateTextSplitter) MarshalJSON() ([]byte, error) {
	if u.DestinationSnowflakeCortexUpdateBySeparator != nil {
		return utils.MarshalJSON(u.DestinationSnowflakeCortexUpdateBySeparator, "", true)
	}

	if u.DestinationSnowflakeCortexUpdateByMarkdownHeader != nil {
		return utils.MarshalJSON(u.DestinationSnowflakeCortexUpdateByMarkdownHeader, "", true)
	}

	if u.DestinationSnowflakeCortexUpdateByProgrammingLanguage != nil {
		return utils.MarshalJSON(u.DestinationSnowflakeCortexUpdateByProgrammingLanguage, "", true)
	}

	return nil, errors.New("could not marshal union type DestinationSnowflakeCortexUpdateTextSplitter: all fields are null")
}

type DestinationSnowflakeCortexUpdateProcessingConfigModel struct {
	// Size of overlap between chunks in tokens to store in vector store to better capture relevant context
	ChunkOverlap *int64 `default:"0" json:"chunk_overlap"`
	// Size of chunks in tokens to store in vector store (make sure it is not too big for the context if your LLM)
	ChunkSize int64 `json:"chunk_size"`
	// List of fields to rename. Not applicable for nested fields, but can be used to rename fields already flattened via dot notation.
	FieldNameMappings []DestinationSnowflakeCortexUpdateFieldNameMappingConfigModel `json:"field_name_mappings,omitempty"`
	// List of fields in the record that should be stored as metadata. The field list is applied to all streams in the same way and non-existing fields are ignored. If none are defined, all fields are considered metadata fields. When specifying text fields, you can access nested fields in the record by using dot notation, e.g. `user.name` will access the `name` field in the `user` object. It's also possible to use wildcards to access all fields in an object, e.g. `users.*.name` will access all `names` fields in all entries of the `users` array. When specifying nested paths, all matching values are flattened into an array set to a field named by the path.
	MetadataFields []string `json:"metadata_fields,omitempty"`
	// List of fields in the record that should be used to calculate the embedding. The field list is applied to all streams in the same way and non-existing fields are ignored. If none are defined, all fields are considered text fields. When specifying text fields, you can access nested fields in the record by using dot notation, e.g. `user.name` will access the `name` field in the `user` object. It's also possible to use wildcards to access all fields in an object, e.g. `users.*.name` will access all `names` fields in all entries of the `users` array.
	TextFields []string `json:"text_fields,omitempty"`
	// Split text fields into chunks based on the specified method.
	TextSplitter *DestinationSnowflakeCortexUpdateTextSplitter `json:"text_splitter,omitempty"`
}

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

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

func (o *DestinationSnowflakeCortexUpdateProcessingConfigModel) GetChunkOverlap() *int64 {
	if o == nil {
		return nil
	}
	return o.ChunkOverlap
}

func (o *DestinationSnowflakeCortexUpdateProcessingConfigModel) GetChunkSize() int64 {
	if o == nil {
		return 0
	}
	return o.ChunkSize
}

func (o *DestinationSnowflakeCortexUpdateProcessingConfigModel) GetFieldNameMappings() []DestinationSnowflakeCortexUpdateFieldNameMappingConfigModel {
	if o == nil {
		return nil
	}
	return o.FieldNameMappings
}

func (o *DestinationSnowflakeCortexUpdateProcessingConfigModel) GetMetadataFields() []string {
	if o == nil {
		return nil
	}
	return o.MetadataFields
}

func (o *DestinationSnowflakeCortexUpdateProcessingConfigModel) GetTextFields() []string {
	if o == nil {
		return nil
	}
	return o.TextFields
}

func (o *DestinationSnowflakeCortexUpdateProcessingConfigModel) GetTextSplitter() *DestinationSnowflakeCortexUpdateTextSplitter {
	if o == nil {
		return nil
	}
	return o.TextSplitter
}

// DestinationSnowflakeCortexUpdate - The configuration model for the Vector DB based destinations. This model is used to generate the UI for the destination configuration,
// as well as to provide type safety for the configuration passed to the destination.
//
// The configuration model is composed of four parts:
// * Processing configuration
// * Embedding configuration
// * Indexing configuration
// * Advanced configuration
//
// Processing, embedding and advanced configuration are provided by this base class, while the indexing configuration is provided by the destination connector in the sub class.
type DestinationSnowflakeCortexUpdate struct {
	// Embedding configuration
	Embedding DestinationSnowflakeCortexUpdateEmbedding `json:"embedding"`
	// Snowflake can be used to store vector data and retrieve embeddings.
	Indexing DestinationSnowflakeCortexUpdateSnowflakeConnection `json:"indexing"`
	// Do not store the text that gets embedded along with the vector and the metadata in the destination. If set to true, only the vector and the metadata will be stored - in this case raw text for LLM use cases needs to be retrieved from another source.
	OmitRawText *bool                                                 `default:"false" json:"omit_raw_text"`
	Processing  DestinationSnowflakeCortexUpdateProcessingConfigModel `json:"processing"`
}

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

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

func (o *DestinationSnowflakeCortexUpdate) GetEmbedding() DestinationSnowflakeCortexUpdateEmbedding {
	if o == nil {
		return DestinationSnowflakeCortexUpdateEmbedding{}
	}
	return o.Embedding
}

func (o *DestinationSnowflakeCortexUpdate) GetIndexing() DestinationSnowflakeCortexUpdateSnowflakeConnection {
	if o == nil {
		return DestinationSnowflakeCortexUpdateSnowflakeConnection{}
	}
	return o.Indexing
}

func (o *DestinationSnowflakeCortexUpdate) GetOmitRawText() *bool {
	if o == nil {
		return nil
	}
	return o.OmitRawText
}

func (o *DestinationSnowflakeCortexUpdate) GetProcessing() DestinationSnowflakeCortexUpdateProcessingConfigModel {
	if o == nil {
		return DestinationSnowflakeCortexUpdateProcessingConfigModel{}
	}
	return o.Processing
}
