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

const (
	SourceQuickbooksUpdateAuthTypeOauth20 SourceQuickbooksUpdateAuthType = "oauth2.0"
)

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

type SourceQuickbooksUpdate struct {
	// Access token for making authenticated requests.
	AccessToken string                          `json:"access_token"`
	authType    *SourceQuickbooksUpdateAuthType `const:"oauth2.0" json:"auth_type,omitempty"`
	// Identifies which app is making the request. Obtain this value from the Keys tab on the app profile via My Apps on the developer site. There are two versions of this key: development and production.
	ClientID string `json:"client_id"`
	//  Obtain this value from the Keys tab on the app profile via My Apps on the developer site. There are two versions of this key: development and production.
	ClientSecret string `json:"client_secret"`
	// Labeled Company ID. The Make API Calls panel is populated with the realm id and the current access token.
	RealmID string `json:"realm_id"`
	// A token used when refreshing the access token.
	RefreshToken string `json:"refresh_token"`
	// Determines whether to use the sandbox or production environment.
	Sandbox *bool `default:"false" json:"sandbox"`
	// The default value to use if no bookmark exists for an endpoint (rfc3339 date string). E.g, 2021-03-20T00:00:00Z. Any data before this date will not be replicated.
	StartDate time.Time `json:"start_date"`
	// The date-time when the access token should be refreshed.
	TokenExpiryDate time.Time `json:"token_expiry_date"`
}

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

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

func (o *SourceQuickbooksUpdate) GetAccessToken() string {
	if o == nil {
		return ""
	}
	return o.AccessToken
}

func (o *SourceQuickbooksUpdate) GetAuthType() *SourceQuickbooksUpdateAuthType {
	return SourceQuickbooksUpdateAuthTypeOauth20.ToPointer()
}

func (o *SourceQuickbooksUpdate) GetClientID() string {
	if o == nil {
		return ""
	}
	return o.ClientID
}

func (o *SourceQuickbooksUpdate) GetClientSecret() string {
	if o == nil {
		return ""
	}
	return o.ClientSecret
}

func (o *SourceQuickbooksUpdate) GetRealmID() string {
	if o == nil {
		return ""
	}
	return o.RealmID
}

func (o *SourceQuickbooksUpdate) GetRefreshToken() string {
	if o == nil {
		return ""
	}
	return o.RefreshToken
}

func (o *SourceQuickbooksUpdate) GetSandbox() *bool {
	if o == nil {
		return nil
	}
	return o.Sandbox
}

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

func (o *SourceQuickbooksUpdate) GetTokenExpiryDate() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.TokenExpiryDate
}
