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

const (
	KissmetricsKissmetrics Kissmetrics = "kissmetrics"
)

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

type SourceKissmetrics struct {
	Password   *string     `json:"password,omitempty"`
	Username   string      `json:"username"`
	sourceType Kissmetrics `const:"kissmetrics" json:"sourceType"`
}

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

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

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

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

func (o *SourceKissmetrics) GetSourceType() Kissmetrics {
	return KissmetricsKissmetrics
}
