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

const (
	PabblySubscriptionsBillingPabblySubscriptionsBilling PabblySubscriptionsBilling = "pabbly-subscriptions-billing"
)

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

type SourcePabblySubscriptionsBilling struct {
	Password   *string                    `json:"password,omitempty"`
	Username   string                     `json:"username"`
	sourceType PabblySubscriptionsBilling `const:"pabbly-subscriptions-billing" json:"sourceType"`
}

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

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

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

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

func (o *SourcePabblySubscriptionsBilling) GetSourceType() PabblySubscriptionsBilling {
	return PabblySubscriptionsBillingPabblySubscriptionsBilling
}
