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

// SourceBraintreeUpdateEnvironment - Environment specifies where the data will come from.
type SourceBraintreeUpdateEnvironment string

const (
	SourceBraintreeUpdateEnvironmentDevelopment SourceBraintreeUpdateEnvironment = "Development"
	SourceBraintreeUpdateEnvironmentSandbox     SourceBraintreeUpdateEnvironment = "Sandbox"
	SourceBraintreeUpdateEnvironmentQa          SourceBraintreeUpdateEnvironment = "Qa"
	SourceBraintreeUpdateEnvironmentProduction  SourceBraintreeUpdateEnvironment = "Production"
)

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

type SourceBraintreeUpdate struct {
	// Environment specifies where the data will come from.
	Environment SourceBraintreeUpdateEnvironment `json:"environment"`
	// The unique identifier for your entire gateway account. See the <a href="https://docs.airbyte.com/integrations/sources/braintree">docs</a> for more information on how to obtain this ID.
	MerchantID string `json:"merchant_id"`
	// Braintree Private Key. See the <a href="https://docs.airbyte.com/integrations/sources/braintree">docs</a> for more information on how to obtain this key.
	PrivateKey string `json:"private_key"`
	// Braintree Public Key. See the <a href="https://docs.airbyte.com/integrations/sources/braintree">docs</a> for more information on how to obtain this key.
	PublicKey string `json:"public_key"`
	// UTC date and time in the format 2017-01-25T00:00:00Z. Any data before this date will not be replicated.
	StartDate *time.Time `json:"start_date,omitempty"`
}

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

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

func (o *SourceBraintreeUpdate) GetEnvironment() SourceBraintreeUpdateEnvironment {
	if o == nil {
		return SourceBraintreeUpdateEnvironment("")
	}
	return o.Environment
}

func (o *SourceBraintreeUpdate) GetMerchantID() string {
	if o == nil {
		return ""
	}
	return o.MerchantID
}

func (o *SourceBraintreeUpdate) GetPrivateKey() string {
	if o == nil {
		return ""
	}
	return o.PrivateKey
}

func (o *SourceBraintreeUpdate) GetPublicKey() string {
	if o == nil {
		return ""
	}
	return o.PublicKey
}

func (o *SourceBraintreeUpdate) GetStartDate() *time.Time {
	if o == nil {
		return nil
	}
	return o.StartDate
}
