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

const (
	RollbarRollbar Rollbar = "rollbar"
)

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

type SourceRollbar struct {
	AccountAccessToken string    `json:"account_access_token"`
	ProjectAccessToken string    `json:"project_access_token"`
	StartDate          time.Time `json:"start_date"`
	sourceType         Rollbar   `const:"rollbar" json:"sourceType"`
}

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

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

func (o *SourceRollbar) GetAccountAccessToken() string {
	if o == nil {
		return ""
	}
	return o.AccountAccessToken
}

func (o *SourceRollbar) GetProjectAccessToken() string {
	if o == nil {
		return ""
	}
	return o.ProjectAccessToken
}

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

func (o *SourceRollbar) GetSourceType() Rollbar {
	return RollbarRollbar
}
