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

const (
	DataCenterEuCentral   DataCenter = "eu-central"
	DataCenterUsEast      DataCenter = "us-east"
	DataCenterCaCentral   DataCenter = "ca-central"
	DataCenterApSoutheast DataCenter = "ap-southeast"
)

func (e DataCenter) ToPointer() *DataCenter {
	return &e
}
func (e *DataCenter) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "eu-central":
		fallthrough
	case "us-east":
		fallthrough
	case "ca-central":
		fallthrough
	case "ap-southeast":
		*e = DataCenter(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DataCenter: %v", v)
	}
}

type Pipeliner string

const (
	PipelinerPipeliner Pipeliner = "pipeliner"
)

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

type SourcePipeliner struct {
	Password   *string    `json:"password,omitempty"`
	Service    DataCenter `json:"service"`
	Spaceid    string     `json:"spaceid"`
	Username   string     `json:"username"`
	sourceType Pipeliner  `const:"pipeliner" json:"sourceType"`
}

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

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

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

func (o *SourcePipeliner) GetService() DataCenter {
	if o == nil {
		return DataCenter("")
	}
	return o.Service
}

func (o *SourcePipeliner) GetSpaceid() string {
	if o == nil {
		return ""
	}
	return o.Spaceid
}

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

func (o *SourcePipeliner) GetSourceType() Pipeliner {
	return PipelinerPipeliner
}
