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

package shared

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

type Couchbase string

const (
	CouchbaseCouchbase Couchbase = "couchbase"
)

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

type SourceCouchbase struct {
	// The name of the bucket to sync data from
	Bucket string `json:"bucket"`
	// The connection string for the Couchbase server (e.g., couchbase://localhost or couchbases://example.com)
	ConnectionString string `json:"connection_string"`
	// The password to use for authentication
	Password string `json:"password"`
	// The date from which you'd like to replicate data for incremental streams, in the format YYYY-MM-DDT00:00:00Z. All data generated after this date will be replicated. If not set, all data will be replicated.
	StartDate *time.Time `json:"start_date,omitempty"`
	// The username to use for authentication
	Username   string    `json:"username"`
	sourceType Couchbase `const:"couchbase" json:"sourceType"`
}

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

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

func (o *SourceCouchbase) GetBucket() string {
	if o == nil {
		return ""
	}
	return o.Bucket
}

func (o *SourceCouchbase) GetConnectionString() string {
	if o == nil {
		return ""
	}
	return o.ConnectionString
}

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

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

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

func (o *SourceCouchbase) GetSourceType() Couchbase {
	return CouchbaseCouchbase
}
