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

const (
	SharetribeSharetribe Sharetribe = "sharetribe"
)

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

type SourceSharetribe struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	// The current access token. This field might be overridden by the connector based on the token refresh endpoint response.
	OauthAccessToken *string `json:"oauth_access_token,omitempty"`
	// The date the current access token expires in. This field might be overridden by the connector based on the token refresh endpoint response.
	OauthTokenExpiryDate *time.Time `json:"oauth_token_expiry_date,omitempty"`
	StartDate            time.Time  `json:"start_date"`
	sourceType           Sharetribe `const:"sharetribe" json:"sourceType"`
}

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

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

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

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

func (o *SourceSharetribe) GetOauthAccessToken() *string {
	if o == nil {
		return nil
	}
	return o.OauthAccessToken
}

func (o *SourceSharetribe) GetOauthTokenExpiryDate() *time.Time {
	if o == nil {
		return nil
	}
	return o.OauthTokenExpiryDate
}

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

func (o *SourceSharetribe) GetSourceType() Sharetribe {
	return SharetribeSharetribe
}
