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

// SourceVitallyStatus - Status of the Vitally accounts. One of the following values; active, churned, activeOrChurned.
type SourceVitallyStatus string

const (
	SourceVitallyStatusActive          SourceVitallyStatus = "active"
	SourceVitallyStatusChurned         SourceVitallyStatus = "churned"
	SourceVitallyStatusActiveOrChurned SourceVitallyStatus = "activeOrChurned"
)

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

type Vitally string

const (
	VitallyVitally Vitally = "vitally"
)

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

type SourceVitally struct {
	// Basic Auth Header
	BasicAuthHeader *string `json:"basic_auth_header,omitempty"`
	// Provide only the subdomain part, like https://{your-custom-subdomain}.rest.vitally.io/.  Keep empty if you don't have a subdomain.
	Domain string `json:"domain"`
	// sk_live_secret_token
	SecretToken string `json:"secret_token"`
	// Status of the Vitally accounts. One of the following values; active, churned, activeOrChurned.
	Status     SourceVitallyStatus `json:"status"`
	sourceType Vitally             `const:"vitally" json:"sourceType"`
}

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

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

func (o *SourceVitally) GetBasicAuthHeader() *string {
	if o == nil {
		return nil
	}
	return o.BasicAuthHeader
}

func (o *SourceVitally) GetDomain() string {
	if o == nil {
		return ""
	}
	return o.Domain
}

func (o *SourceVitally) GetSecretToken() string {
	if o == nil {
		return ""
	}
	return o.SecretToken
}

func (o *SourceVitally) GetStatus() SourceVitallyStatus {
	if o == nil {
		return SourceVitallyStatus("")
	}
	return o.Status
}

func (o *SourceVitally) GetSourceType() Vitally {
	return VitallyVitally
}
