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

type Brex string

const (
	BrexBrex Brex = "brex"
)

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

type SourceBrex struct {
	StartDate time.Time `json:"start_date"`
	// User token to authenticate API requests. Generate it from your Brex dashboard under Developer > Settings.
	UserToken  string `json:"user_token"`
	sourceType Brex   `const:"brex" json:"sourceType"`
}

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

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

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

func (o *SourceBrex) GetUserToken() string {
	if o == nil {
		return ""
	}
	return o.UserToken
}

func (o *SourceBrex) GetSourceType() Brex {
	return BrexBrex
}
