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

const (
	TimelyTimely Timely = "timely"
)

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

type SourceTimely struct {
	// The Account ID for your Timely account
	AccountID string `json:"account_id"`
	// The Bearer Token for your Timely account
	BearerToken string `json:"bearer_token"`
	// Earliest date from which you want to pull data from.
	StartDate  time.Time `json:"start_date"`
	sourceType Timely    `const:"timely" json:"sourceType"`
}

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

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

func (o *SourceTimely) GetAccountID() string {
	if o == nil {
		return ""
	}
	return o.AccountID
}

func (o *SourceTimely) GetBearerToken() string {
	if o == nil {
		return ""
	}
	return o.BearerToken
}

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

func (o *SourceTimely) GetSourceType() Timely {
	return TimelyTimely
}
