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

const (
	TrackPmsTrackPms TrackPms = "track-pms"
)

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

type SourceTrackPms struct {
	APIKey         string   `json:"api_key"`
	APISecret      *string  `json:"api_secret,omitempty"`
	CustomerDomain string   `json:"customer_domain"`
	sourceType     TrackPms `const:"track-pms" json:"sourceType"`
}

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

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

func (o *SourceTrackPms) GetAPIKey() string {
	if o == nil {
		return ""
	}
	return o.APIKey
}

func (o *SourceTrackPms) GetAPISecret() *string {
	if o == nil {
		return nil
	}
	return o.APISecret
}

func (o *SourceTrackPms) GetCustomerDomain() string {
	if o == nil {
		return ""
	}
	return o.CustomerDomain
}

func (o *SourceTrackPms) GetSourceType() TrackPms {
	return TrackPmsTrackPms
}
