// 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"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/types"
)

type Braze string

const (
	BrazeBraze Braze = "braze"
)

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

type SourceBraze struct {
	// Braze REST API key
	APIKey string `json:"api_key"`
	// Rows after this date will be synced
	StartDate types.Date `json:"start_date"`
	// Braze REST API endpoint
	URL        string `json:"url"`
	sourceType Braze  `const:"braze" json:"sourceType"`
}

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

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

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

func (o *SourceBraze) GetStartDate() types.Date {
	if o == nil {
		return types.Date{}
	}
	return o.StartDate
}

func (o *SourceBraze) GetURL() string {
	if o == nil {
		return ""
	}
	return o.URL
}

func (o *SourceBraze) GetSourceType() Braze {
	return BrazeBraze
}
