// 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 DestinationWeaviateSchemasEmbeddingEmbedding7Mode string

const (
	DestinationWeaviateSchemasEmbeddingEmbedding7ModeOpenaiCompatible DestinationWeaviateSchemasEmbeddingEmbedding7Mode = "openai_compatible"
)

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

// DestinationWeaviateOpenAICompatible - Use a service that's compatible with the OpenAI API to embed text.
type DestinationWeaviateOpenAICompatible 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       *DestinationWeaviateSchemasEmbeddingEmbedding7Mode `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 DestinationWeaviateOpenAICompatible) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

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

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

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

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

func (o *DestinationWeaviateOpenAICompatible) GetMode() *DestinationWeaviateSchemasEmbeddingEmbedding7Mode {
	return DestinationWeaviateSchemasEmbeddingEmbedding7ModeOpenaiCompatible.ToPointer()
}

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

type DestinationWeaviateSchemasEmbeddingEmbedding6Mode string

const (
	DestinationWeaviateSchemasEmbeddingEmbedding6ModeFake DestinationWeaviateSchemasEmbeddingEmbedding6Mode = "fake"
)

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

// DestinationWeaviateFake - 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 DestinationWeaviateFake struct {
	mode *DestinationWeaviateSchemasEmbeddingEmbedding6Mode `const:"fake" json:"mode"`
}

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

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

func (o *DestinationWeaviateFake) GetMode() *DestinationWeaviateSchemasEmbeddingEmbedding6Mode {
	return DestinationWeaviateSchemasEmbeddingEmbedding6ModeFake.ToPointer()
}

type DestinationWeaviateSchemasEmbeddingEmbedding5Mode string

const (
	DestinationWeaviateSchemasEmbeddingEmbedding5ModeFromField DestinationWeaviateSchemasEmbeddingEmbedding5Mode = "from_field"
)

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

// FromField - Use a field in the record as the embedding. This is useful if you already have an embedding for your data and want to store it in the vector store.
type FromField struct {
	// The number of dimensions the embedding model is generating
	Dimensions int64 `json:"dimensions"`
	// Name of the field in the record that contains the embedding
	FieldName string                                             `json:"field_name"`
	mode      *DestinationWeaviateSchemasEmbeddingEmbedding5Mode `const:"from_field" json:"mode"`
}

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

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

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

func (o *FromField) GetFieldName() string {
	if o == nil {
		return ""
	}
	return o.FieldName
}

func (o *FromField) GetMode() *DestinationWeaviateSchemasEmbeddingEmbedding5Mode {
	return DestinationWeaviateSchemasEmbeddingEmbedding5ModeFromField.ToPointer()
}

type DestinationWeaviateSchemasEmbeddingEmbeddingMode string

const (
	DestinationWeaviateSchemasEmbeddingEmbeddingModeCohere DestinationWeaviateSchemasEmbeddingEmbeddingMode = "cohere"
)

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

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

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

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

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

func (o *DestinationWeaviateCohere) GetMode() *DestinationWeaviateSchemasEmbeddingEmbeddingMode {
	return DestinationWeaviateSchemasEmbeddingEmbeddingModeCohere.ToPointer()
}

type DestinationWeaviateSchemasEmbeddingMode string

const (
	DestinationWeaviateSchemasEmbeddingModeOpenai DestinationWeaviateSchemasEmbeddingMode = "openai"
)

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

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

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

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

func (o *DestinationWeaviateOpenAI) GetMode() *DestinationWeaviateSchemasEmbeddingMode {
	return DestinationWeaviateSchemasEmbeddingModeOpenai.ToPointer()
}

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

type DestinationWeaviateSchemasMode string

const (
	DestinationWeaviateSchemasModeAzureOpenai DestinationWeaviateSchemasMode = "azure_openai"
)

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

// DestinationWeaviateAzureOpenAI - Use the Azure-hosted OpenAI API to embed text. This option is using the text-embedding-ada-002 model with 1536 embedding dimensions.
type DestinationWeaviateAzureOpenAI 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       *DestinationWeaviateSchemasMode `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 DestinationWeaviateAzureOpenAI) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

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

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

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

func (o *DestinationWeaviateAzureOpenAI) GetMode() *DestinationWeaviateSchemasMode {
	return DestinationWeaviateSchemasModeAzureOpenai.ToPointer()
}

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

type DestinationWeaviateMode string

const (
	DestinationWeaviateModeNoEmbedding DestinationWeaviateMode = "no_embedding"
)

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

// NoExternalEmbedding - Do not calculate and pass embeddings to Weaviate. Suitable for clusters with configured vectorizers to calculate embeddings within Weaviate or for classes that should only support regular text search.
type NoExternalEmbedding struct {
	mode *DestinationWeaviateMode `const:"no_embedding" json:"mode"`
}

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

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

func (o *NoExternalEmbedding) GetMode() *DestinationWeaviateMode {
	return DestinationWeaviateModeNoEmbedding.ToPointer()
}

type DestinationWeaviateEmbeddingType string

const (
	DestinationWeaviateEmbeddingTypeNoExternalEmbedding                 DestinationWeaviateEmbeddingType = "No external embedding"
	DestinationWeaviateEmbeddingTypeDestinationWeaviateAzureOpenAI      DestinationWeaviateEmbeddingType = "destination-weaviate_Azure OpenAI"
	DestinationWeaviateEmbeddingTypeDestinationWeaviateOpenAI           DestinationWeaviateEmbeddingType = "destination-weaviate_OpenAI"
	DestinationWeaviateEmbeddingTypeDestinationWeaviateCohere           DestinationWeaviateEmbeddingType = "destination-weaviate_Cohere"
	DestinationWeaviateEmbeddingTypeFromField                           DestinationWeaviateEmbeddingType = "From Field"
	DestinationWeaviateEmbeddingTypeDestinationWeaviateFake             DestinationWeaviateEmbeddingType = "destination-weaviate_Fake"
	DestinationWeaviateEmbeddingTypeDestinationWeaviateOpenAICompatible DestinationWeaviateEmbeddingType = "destination-weaviate_OpenAI-compatible"
)

// DestinationWeaviateEmbedding - Embedding configuration
type DestinationWeaviateEmbedding struct {
	NoExternalEmbedding                 *NoExternalEmbedding                 `queryParam:"inline"`
	DestinationWeaviateAzureOpenAI      *DestinationWeaviateAzureOpenAI      `queryParam:"inline"`
	DestinationWeaviateOpenAI           *DestinationWeaviateOpenAI           `queryParam:"inline"`
	DestinationWeaviateCohere           *DestinationWeaviateCohere           `queryParam:"inline"`
	FromField                           *FromField                           `queryParam:"inline"`
	DestinationWeaviateFake             *DestinationWeaviateFake             `queryParam:"inline"`
	DestinationWeaviateOpenAICompatible *DestinationWeaviateOpenAICompatible `queryParam:"inline"`

	Type DestinationWeaviateEmbeddingType
}

func CreateDestinationWeaviateEmbeddingNoExternalEmbedding(noExternalEmbedding NoExternalEmbedding) DestinationWeaviateEmbedding {
	typ := DestinationWeaviateEmbeddingTypeNoExternalEmbedding

	return DestinationWeaviateEmbedding{
		NoExternalEmbedding: &noExternalEmbedding,
		Type:                typ,
	}
}

func CreateDestinationWeaviateEmbeddingDestinationWeaviateAzureOpenAI(destinationWeaviateAzureOpenAI DestinationWeaviateAzureOpenAI) DestinationWeaviateEmbedding {
	typ := DestinationWeaviateEmbeddingTypeDestinationWeaviateAzureOpenAI

	return DestinationWeaviateEmbedding{
		DestinationWeaviateAzureOpenAI: &destinationWeaviateAzureOpenAI,
		Type:                           typ,
	}
}

func CreateDestinationWeaviateEmbeddingDestinationWeaviateOpenAI(destinationWeaviateOpenAI DestinationWeaviateOpenAI) DestinationWeaviateEmbedding {
	typ := DestinationWeaviateEmbeddingTypeDestinationWeaviateOpenAI

	return DestinationWeaviateEmbedding{
		DestinationWeaviateOpenAI: &destinationWeaviateOpenAI,
		Type:                      typ,
	}
}

func CreateDestinationWeaviateEmbeddingDestinationWeaviateCohere(destinationWeaviateCohere DestinationWeaviateCohere) DestinationWeaviateEmbedding {
	typ := DestinationWeaviateEmbeddingTypeDestinationWeaviateCohere

	return DestinationWeaviateEmbedding{
		DestinationWeaviateCohere: &destinationWeaviateCohere,
		Type:                      typ,
	}
}

func CreateDestinationWeaviateEmbeddingFromField(fromField FromField) DestinationWeaviateEmbedding {
	typ := DestinationWeaviateEmbeddingTypeFromField

	return DestinationWeaviateEmbedding{
		FromField: &fromField,
		Type:      typ,
	}
}

func CreateDestinationWeaviateEmbeddingDestinationWeaviateFake(destinationWeaviateFake DestinationWeaviateFake) DestinationWeaviateEmbedding {
	typ := DestinationWeaviateEmbeddingTypeDestinationWeaviateFake

	return DestinationWeaviateEmbedding{
		DestinationWeaviateFake: &destinationWeaviateFake,
		Type:                    typ,
	}
}

func CreateDestinationWeaviateEmbeddingDestinationWeaviateOpenAICompatible(destinationWeaviateOpenAICompatible DestinationWeaviateOpenAICompatible) DestinationWeaviateEmbedding {
	typ := DestinationWeaviateEmbeddingTypeDestinationWeaviateOpenAICompatible

	return DestinationWeaviateEmbedding{
		DestinationWeaviateOpenAICompatible: &destinationWeaviateOpenAICompatible,
		Type:                                typ,
	}
}

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

	var noExternalEmbedding NoExternalEmbedding = NoExternalEmbedding{}
	if err := utils.UnmarshalJSON(data, &noExternalEmbedding, "", true, true); err == nil {
		u.NoExternalEmbedding = &noExternalEmbedding
		u.Type = DestinationWeaviateEmbeddingTypeNoExternalEmbedding
		return nil
	}

	var destinationWeaviateFake DestinationWeaviateFake = DestinationWeaviateFake{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateFake, "", true, true); err == nil {
		u.DestinationWeaviateFake = &destinationWeaviateFake
		u.Type = DestinationWeaviateEmbeddingTypeDestinationWeaviateFake
		return nil
	}

	var destinationWeaviateOpenAI DestinationWeaviateOpenAI = DestinationWeaviateOpenAI{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateOpenAI, "", true, true); err == nil {
		u.DestinationWeaviateOpenAI = &destinationWeaviateOpenAI
		u.Type = DestinationWeaviateEmbeddingTypeDestinationWeaviateOpenAI
		return nil
	}

	var destinationWeaviateCohere DestinationWeaviateCohere = DestinationWeaviateCohere{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateCohere, "", true, true); err == nil {
		u.DestinationWeaviateCohere = &destinationWeaviateCohere
		u.Type = DestinationWeaviateEmbeddingTypeDestinationWeaviateCohere
		return nil
	}

	var fromField FromField = FromField{}
	if err := utils.UnmarshalJSON(data, &fromField, "", true, true); err == nil {
		u.FromField = &fromField
		u.Type = DestinationWeaviateEmbeddingTypeFromField
		return nil
	}

	var destinationWeaviateAzureOpenAI DestinationWeaviateAzureOpenAI = DestinationWeaviateAzureOpenAI{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateAzureOpenAI, "", true, true); err == nil {
		u.DestinationWeaviateAzureOpenAI = &destinationWeaviateAzureOpenAI
		u.Type = DestinationWeaviateEmbeddingTypeDestinationWeaviateAzureOpenAI
		return nil
	}

	var destinationWeaviateOpenAICompatible DestinationWeaviateOpenAICompatible = DestinationWeaviateOpenAICompatible{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateOpenAICompatible, "", true, true); err == nil {
		u.DestinationWeaviateOpenAICompatible = &destinationWeaviateOpenAICompatible
		u.Type = DestinationWeaviateEmbeddingTypeDestinationWeaviateOpenAICompatible
		return nil
	}

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

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

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

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

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

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

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

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

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

type Header struct {
	HeaderKey string `json:"header_key"`
	Value     string `json:"value"`
}

func (o *Header) GetHeaderKey() string {
	if o == nil {
		return ""
	}
	return o.HeaderKey
}

func (o *Header) GetValue() string {
	if o == nil {
		return ""
	}
	return o.Value
}

type DestinationWeaviateSchemasIndexingAuthAuthenticationMode string

const (
	DestinationWeaviateSchemasIndexingAuthAuthenticationModeNoAuth DestinationWeaviateSchemasIndexingAuthAuthenticationMode = "no_auth"
)

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

// NoAuthentication - Do not authenticate (suitable for locally running test clusters, do not use for clusters with public IP addresses)
type NoAuthentication struct {
	mode *DestinationWeaviateSchemasIndexingAuthAuthenticationMode `const:"no_auth" json:"mode"`
}

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

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

func (o *NoAuthentication) GetMode() *DestinationWeaviateSchemasIndexingAuthAuthenticationMode {
	return DestinationWeaviateSchemasIndexingAuthAuthenticationModeNoAuth.ToPointer()
}

type DestinationWeaviateSchemasIndexingAuthMode string

const (
	DestinationWeaviateSchemasIndexingAuthModeUsernamePassword DestinationWeaviateSchemasIndexingAuthMode = "username_password"
)

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

// DestinationWeaviateUsernamePassword - Authenticate using username and password (suitable for self-managed Weaviate clusters)
type DestinationWeaviateUsernamePassword struct {
	mode *DestinationWeaviateSchemasIndexingAuthMode `const:"username_password" json:"mode"`
	// Password for the Weaviate cluster
	Password string `json:"password"`
	// Username for the Weaviate cluster
	Username string `json:"username"`
}

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

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

func (o *DestinationWeaviateUsernamePassword) GetMode() *DestinationWeaviateSchemasIndexingAuthMode {
	return DestinationWeaviateSchemasIndexingAuthModeUsernamePassword.ToPointer()
}

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

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

type DestinationWeaviateSchemasIndexingMode string

const (
	DestinationWeaviateSchemasIndexingModeToken DestinationWeaviateSchemasIndexingMode = "token"
)

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

// DestinationWeaviateAPIToken - Authenticate using an API token (suitable for Weaviate Cloud)
type DestinationWeaviateAPIToken struct {
	mode *DestinationWeaviateSchemasIndexingMode `const:"token" json:"mode"`
	// API Token for the Weaviate instance
	Token string `json:"token"`
}

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

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

func (o *DestinationWeaviateAPIToken) GetMode() *DestinationWeaviateSchemasIndexingMode {
	return DestinationWeaviateSchemasIndexingModeToken.ToPointer()
}

func (o *DestinationWeaviateAPIToken) GetToken() string {
	if o == nil {
		return ""
	}
	return o.Token
}

type DestinationWeaviateAuthenticationType string

const (
	DestinationWeaviateAuthenticationTypeDestinationWeaviateAPIToken         DestinationWeaviateAuthenticationType = "destination-weaviate_API Token"
	DestinationWeaviateAuthenticationTypeDestinationWeaviateUsernamePassword DestinationWeaviateAuthenticationType = "destination-weaviate_Username/Password"
	DestinationWeaviateAuthenticationTypeNoAuthentication                    DestinationWeaviateAuthenticationType = "No Authentication"
)

// DestinationWeaviateAuthentication - Authentication method
type DestinationWeaviateAuthentication struct {
	DestinationWeaviateAPIToken         *DestinationWeaviateAPIToken         `queryParam:"inline"`
	DestinationWeaviateUsernamePassword *DestinationWeaviateUsernamePassword `queryParam:"inline"`
	NoAuthentication                    *NoAuthentication                    `queryParam:"inline"`

	Type DestinationWeaviateAuthenticationType
}

func CreateDestinationWeaviateAuthenticationDestinationWeaviateAPIToken(destinationWeaviateAPIToken DestinationWeaviateAPIToken) DestinationWeaviateAuthentication {
	typ := DestinationWeaviateAuthenticationTypeDestinationWeaviateAPIToken

	return DestinationWeaviateAuthentication{
		DestinationWeaviateAPIToken: &destinationWeaviateAPIToken,
		Type:                        typ,
	}
}

func CreateDestinationWeaviateAuthenticationDestinationWeaviateUsernamePassword(destinationWeaviateUsernamePassword DestinationWeaviateUsernamePassword) DestinationWeaviateAuthentication {
	typ := DestinationWeaviateAuthenticationTypeDestinationWeaviateUsernamePassword

	return DestinationWeaviateAuthentication{
		DestinationWeaviateUsernamePassword: &destinationWeaviateUsernamePassword,
		Type:                                typ,
	}
}

func CreateDestinationWeaviateAuthenticationNoAuthentication(noAuthentication NoAuthentication) DestinationWeaviateAuthentication {
	typ := DestinationWeaviateAuthenticationTypeNoAuthentication

	return DestinationWeaviateAuthentication{
		NoAuthentication: &noAuthentication,
		Type:             typ,
	}
}

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

	var noAuthentication NoAuthentication = NoAuthentication{}
	if err := utils.UnmarshalJSON(data, &noAuthentication, "", true, true); err == nil {
		u.NoAuthentication = &noAuthentication
		u.Type = DestinationWeaviateAuthenticationTypeNoAuthentication
		return nil
	}

	var destinationWeaviateAPIToken DestinationWeaviateAPIToken = DestinationWeaviateAPIToken{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateAPIToken, "", true, true); err == nil {
		u.DestinationWeaviateAPIToken = &destinationWeaviateAPIToken
		u.Type = DestinationWeaviateAuthenticationTypeDestinationWeaviateAPIToken
		return nil
	}

	var destinationWeaviateUsernamePassword DestinationWeaviateUsernamePassword = DestinationWeaviateUsernamePassword{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateUsernamePassword, "", true, true); err == nil {
		u.DestinationWeaviateUsernamePassword = &destinationWeaviateUsernamePassword
		u.Type = DestinationWeaviateAuthenticationTypeDestinationWeaviateUsernamePassword
		return nil
	}

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

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

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

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

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

// DefaultVectorizer - The vectorizer to use if new classes need to be created
type DefaultVectorizer string

const (
	DefaultVectorizerNone                  DefaultVectorizer = "none"
	DefaultVectorizerText2vecCohere        DefaultVectorizer = "text2vec-cohere"
	DefaultVectorizerText2vecHuggingface   DefaultVectorizer = "text2vec-huggingface"
	DefaultVectorizerText2vecOpenai        DefaultVectorizer = "text2vec-openai"
	DefaultVectorizerText2vecPalm          DefaultVectorizer = "text2vec-palm"
	DefaultVectorizerText2vecContextionary DefaultVectorizer = "text2vec-contextionary"
	DefaultVectorizerText2vecTransformers  DefaultVectorizer = "text2vec-transformers"
	DefaultVectorizerText2vecGpt4all       DefaultVectorizer = "text2vec-gpt4all"
)

func (e DefaultVectorizer) ToPointer() *DefaultVectorizer {
	return &e
}
func (e *DefaultVectorizer) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "none":
		fallthrough
	case "text2vec-cohere":
		fallthrough
	case "text2vec-huggingface":
		fallthrough
	case "text2vec-openai":
		fallthrough
	case "text2vec-palm":
		fallthrough
	case "text2vec-contextionary":
		fallthrough
	case "text2vec-transformers":
		fallthrough
	case "text2vec-gpt4all":
		*e = DefaultVectorizer(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DefaultVectorizer: %v", v)
	}
}

// DestinationWeaviateIndexing - Indexing configuration
type DestinationWeaviateIndexing struct {
	// Additional HTTP headers to send with every request.
	AdditionalHeaders []Header `json:"additional_headers,omitempty"`
	// Authentication method
	Auth DestinationWeaviateAuthentication `json:"auth"`
	// The number of records to send to Weaviate in each batch
	BatchSize *int64 `default:"128" json:"batch_size"`
	// The vectorizer to use if new classes need to be created
	DefaultVectorizer *DefaultVectorizer `default:"none" json:"default_vectorizer"`
	// The public endpoint of the Weaviate cluster.
	Host string `json:"host"`
	// The tenant ID to use for multi tenancy
	TenantID *string `default:"" json:"tenant_id"`
	// The field in the object that contains the embedded text
	TextField *string `default:"text" json:"text_field"`
}

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

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

func (o *DestinationWeaviateIndexing) GetAdditionalHeaders() []Header {
	if o == nil {
		return nil
	}
	return o.AdditionalHeaders
}

func (o *DestinationWeaviateIndexing) GetAuth() DestinationWeaviateAuthentication {
	if o == nil {
		return DestinationWeaviateAuthentication{}
	}
	return o.Auth
}

func (o *DestinationWeaviateIndexing) GetBatchSize() *int64 {
	if o == nil {
		return nil
	}
	return o.BatchSize
}

func (o *DestinationWeaviateIndexing) GetDefaultVectorizer() *DefaultVectorizer {
	if o == nil {
		return nil
	}
	return o.DefaultVectorizer
}

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

func (o *DestinationWeaviateIndexing) GetTenantID() *string {
	if o == nil {
		return nil
	}
	return o.TenantID
}

func (o *DestinationWeaviateIndexing) GetTextField() *string {
	if o == nil {
		return nil
	}
	return o.TextField
}

type DestinationWeaviateFieldNameMappingConfigModel 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 *DestinationWeaviateFieldNameMappingConfigModel) GetFromField() string {
	if o == nil {
		return ""
	}
	return o.FromField
}

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

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

const (
	DestinationWeaviateLanguageCpp      DestinationWeaviateLanguage = "cpp"
	DestinationWeaviateLanguageGo       DestinationWeaviateLanguage = "go"
	DestinationWeaviateLanguageJava     DestinationWeaviateLanguage = "java"
	DestinationWeaviateLanguageJs       DestinationWeaviateLanguage = "js"
	DestinationWeaviateLanguagePhp      DestinationWeaviateLanguage = "php"
	DestinationWeaviateLanguageProto    DestinationWeaviateLanguage = "proto"
	DestinationWeaviateLanguagePython   DestinationWeaviateLanguage = "python"
	DestinationWeaviateLanguageRst      DestinationWeaviateLanguage = "rst"
	DestinationWeaviateLanguageRuby     DestinationWeaviateLanguage = "ruby"
	DestinationWeaviateLanguageRust     DestinationWeaviateLanguage = "rust"
	DestinationWeaviateLanguageScala    DestinationWeaviateLanguage = "scala"
	DestinationWeaviateLanguageSwift    DestinationWeaviateLanguage = "swift"
	DestinationWeaviateLanguageMarkdown DestinationWeaviateLanguage = "markdown"
	DestinationWeaviateLanguageLatex    DestinationWeaviateLanguage = "latex"
	DestinationWeaviateLanguageHTML     DestinationWeaviateLanguage = "html"
	DestinationWeaviateLanguageSol      DestinationWeaviateLanguage = "sol"
)

func (e DestinationWeaviateLanguage) ToPointer() *DestinationWeaviateLanguage {
	return &e
}
func (e *DestinationWeaviateLanguage) 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 = DestinationWeaviateLanguage(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationWeaviateLanguage: %v", v)
	}
}

type DestinationWeaviateSchemasProcessingTextSplitterTextSplitterMode string

const (
	DestinationWeaviateSchemasProcessingTextSplitterTextSplitterModeCode DestinationWeaviateSchemasProcessingTextSplitterTextSplitterMode = "code"
)

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

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

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

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

func (o *DestinationWeaviateByProgrammingLanguage) GetLanguage() DestinationWeaviateLanguage {
	if o == nil {
		return DestinationWeaviateLanguage("")
	}
	return o.Language
}

func (o *DestinationWeaviateByProgrammingLanguage) GetMode() *DestinationWeaviateSchemasProcessingTextSplitterTextSplitterMode {
	return DestinationWeaviateSchemasProcessingTextSplitterTextSplitterModeCode.ToPointer()
}

type DestinationWeaviateSchemasProcessingTextSplitterMode string

const (
	DestinationWeaviateSchemasProcessingTextSplitterModeMarkdown DestinationWeaviateSchemasProcessingTextSplitterMode = "markdown"
)

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

// DestinationWeaviateByMarkdownHeader - 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 DestinationWeaviateByMarkdownHeader struct {
	mode *DestinationWeaviateSchemasProcessingTextSplitterMode `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 DestinationWeaviateByMarkdownHeader) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

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

func (o *DestinationWeaviateByMarkdownHeader) GetMode() *DestinationWeaviateSchemasProcessingTextSplitterMode {
	return DestinationWeaviateSchemasProcessingTextSplitterModeMarkdown.ToPointer()
}

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

type DestinationWeaviateSchemasProcessingMode string

const (
	DestinationWeaviateSchemasProcessingModeSeparator DestinationWeaviateSchemasProcessingMode = "separator"
)

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

// DestinationWeaviateBySeparator - 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 DestinationWeaviateBySeparator struct {
	// Whether to keep the separator in the resulting chunks
	KeepSeparator *bool                                     `default:"false" json:"keep_separator"`
	mode          *DestinationWeaviateSchemasProcessingMode `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 DestinationWeaviateBySeparator) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

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

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

func (o *DestinationWeaviateBySeparator) GetMode() *DestinationWeaviateSchemasProcessingMode {
	return DestinationWeaviateSchemasProcessingModeSeparator.ToPointer()
}

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

type DestinationWeaviateTextSplitterType string

const (
	DestinationWeaviateTextSplitterTypeDestinationWeaviateBySeparator           DestinationWeaviateTextSplitterType = "destination-weaviate_By Separator"
	DestinationWeaviateTextSplitterTypeDestinationWeaviateByMarkdownHeader      DestinationWeaviateTextSplitterType = "destination-weaviate_By Markdown header"
	DestinationWeaviateTextSplitterTypeDestinationWeaviateByProgrammingLanguage DestinationWeaviateTextSplitterType = "destination-weaviate_By Programming Language"
)

// DestinationWeaviateTextSplitter - Split text fields into chunks based on the specified method.
type DestinationWeaviateTextSplitter struct {
	DestinationWeaviateBySeparator           *DestinationWeaviateBySeparator           `queryParam:"inline"`
	DestinationWeaviateByMarkdownHeader      *DestinationWeaviateByMarkdownHeader      `queryParam:"inline"`
	DestinationWeaviateByProgrammingLanguage *DestinationWeaviateByProgrammingLanguage `queryParam:"inline"`

	Type DestinationWeaviateTextSplitterType
}

func CreateDestinationWeaviateTextSplitterDestinationWeaviateBySeparator(destinationWeaviateBySeparator DestinationWeaviateBySeparator) DestinationWeaviateTextSplitter {
	typ := DestinationWeaviateTextSplitterTypeDestinationWeaviateBySeparator

	return DestinationWeaviateTextSplitter{
		DestinationWeaviateBySeparator: &destinationWeaviateBySeparator,
		Type:                           typ,
	}
}

func CreateDestinationWeaviateTextSplitterDestinationWeaviateByMarkdownHeader(destinationWeaviateByMarkdownHeader DestinationWeaviateByMarkdownHeader) DestinationWeaviateTextSplitter {
	typ := DestinationWeaviateTextSplitterTypeDestinationWeaviateByMarkdownHeader

	return DestinationWeaviateTextSplitter{
		DestinationWeaviateByMarkdownHeader: &destinationWeaviateByMarkdownHeader,
		Type:                                typ,
	}
}

func CreateDestinationWeaviateTextSplitterDestinationWeaviateByProgrammingLanguage(destinationWeaviateByProgrammingLanguage DestinationWeaviateByProgrammingLanguage) DestinationWeaviateTextSplitter {
	typ := DestinationWeaviateTextSplitterTypeDestinationWeaviateByProgrammingLanguage

	return DestinationWeaviateTextSplitter{
		DestinationWeaviateByProgrammingLanguage: &destinationWeaviateByProgrammingLanguage,
		Type:                                     typ,
	}
}

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

	var destinationWeaviateByMarkdownHeader DestinationWeaviateByMarkdownHeader = DestinationWeaviateByMarkdownHeader{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateByMarkdownHeader, "", true, true); err == nil {
		u.DestinationWeaviateByMarkdownHeader = &destinationWeaviateByMarkdownHeader
		u.Type = DestinationWeaviateTextSplitterTypeDestinationWeaviateByMarkdownHeader
		return nil
	}

	var destinationWeaviateByProgrammingLanguage DestinationWeaviateByProgrammingLanguage = DestinationWeaviateByProgrammingLanguage{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateByProgrammingLanguage, "", true, true); err == nil {
		u.DestinationWeaviateByProgrammingLanguage = &destinationWeaviateByProgrammingLanguage
		u.Type = DestinationWeaviateTextSplitterTypeDestinationWeaviateByProgrammingLanguage
		return nil
	}

	var destinationWeaviateBySeparator DestinationWeaviateBySeparator = DestinationWeaviateBySeparator{}
	if err := utils.UnmarshalJSON(data, &destinationWeaviateBySeparator, "", true, true); err == nil {
		u.DestinationWeaviateBySeparator = &destinationWeaviateBySeparator
		u.Type = DestinationWeaviateTextSplitterTypeDestinationWeaviateBySeparator
		return nil
	}

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

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

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

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

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

type DestinationWeaviateProcessingConfigModel 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 []DestinationWeaviateFieldNameMappingConfigModel `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 *DestinationWeaviateTextSplitter `json:"text_splitter,omitempty"`
}

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

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

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

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

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

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

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

func (o *DestinationWeaviateProcessingConfigModel) GetTextSplitter() *DestinationWeaviateTextSplitter {
	if o == nil {
		return nil
	}
	return o.TextSplitter
}

type Weaviate string

const (
	WeaviateWeaviate Weaviate = "weaviate"
)

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

// DestinationWeaviate - 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 DestinationWeaviate struct {
	// Embedding configuration
	Embedding DestinationWeaviateEmbedding `json:"embedding"`
	// Indexing configuration
	Indexing DestinationWeaviateIndexing `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      DestinationWeaviateProcessingConfigModel `json:"processing"`
	destinationType Weaviate                                 `const:"weaviate" json:"destinationType"`
}

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

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

func (o *DestinationWeaviate) GetEmbedding() DestinationWeaviateEmbedding {
	if o == nil {
		return DestinationWeaviateEmbedding{}
	}
	return o.Embedding
}

func (o *DestinationWeaviate) GetIndexing() DestinationWeaviateIndexing {
	if o == nil {
		return DestinationWeaviateIndexing{}
	}
	return o.Indexing
}

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

func (o *DestinationWeaviate) GetProcessing() DestinationWeaviateProcessingConfigModel {
	if o == nil {
		return DestinationWeaviateProcessingConfigModel{}
	}
	return o.Processing
}

func (o *DestinationWeaviate) GetDestinationType() Weaviate {
	return WeaviateWeaviate
}
