// 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"
)

// DataCenterID - The identifier for the data center, such as 'us1' or 'e' for EU.
type DataCenterID string

const (
	DataCenterIDUs1 DataCenterID = "us1"
	DataCenterIDE   DataCenterID = "e"
)

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

type ZonkaFeedback string

const (
	ZonkaFeedbackZonkaFeedback ZonkaFeedback = "zonka-feedback"
)

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

type SourceZonkaFeedback struct {
	// Auth token to use. Generate it by navigating to Company Settings > Developers > API in your Zonka Feedback account.
	AuthToken string `json:"auth_token"`
	// The identifier for the data center, such as 'us1' or 'e' for EU.
	Datacenter DataCenterID  `json:"datacenter"`
	sourceType ZonkaFeedback `const:"zonka-feedback" json:"sourceType"`
}

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

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

func (o *SourceZonkaFeedback) GetAuthToken() string {
	if o == nil {
		return ""
	}
	return o.AuthToken
}

func (o *SourceZonkaFeedback) GetDatacenter() DataCenterID {
	if o == nil {
		return DataCenterID("")
	}
	return o.Datacenter
}

func (o *SourceZonkaFeedback) GetSourceType() ZonkaFeedback {
	return ZonkaFeedbackZonkaFeedback
}
