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

package shared

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

type Duckdb string

const (
	DuckdbDuckdb Duckdb = "duckdb"
)

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

type DestinationDuckdb struct {
	// Path to the .duckdb file, or the text 'md:' to connect to MotherDuck. The file will be placed inside that local mount. For more information check out our <a href="https://docs.airbyte.io/integrations/destinations/duckdb">docs</a>
	DestinationPath string `json:"destination_path"`
	// API key to use for authentication to a MotherDuck database.
	MotherduckAPIKey *string `json:"motherduck_api_key,omitempty"`
	// Database schema name, default for duckdb is 'main'.
	Schema          *string `json:"schema,omitempty"`
	destinationType Duckdb  `const:"duckdb" json:"destinationType"`
}

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

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

func (o *DestinationDuckdb) GetDestinationPath() string {
	if o == nil {
		return ""
	}
	return o.DestinationPath
}

func (o *DestinationDuckdb) GetMotherduckAPIKey() *string {
	if o == nil {
		return nil
	}
	return o.MotherduckAPIKey
}

func (o *DestinationDuckdb) GetSchema() *string {
	if o == nil {
		return nil
	}
	return o.Schema
}

func (o *DestinationDuckdb) GetDestinationType() Duckdb {
	return DuckdbDuckdb
}
