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

const (
	TwilioTwilio Twilio = "twilio"
)

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

type SourceTwilio struct {
	// Twilio account SID
	AccountSid string `json:"account_sid"`
	// Twilio Auth Token.
	AuthToken string `json:"auth_token"`
	// How far into the past to look for records. (in minutes)
	LookbackWindow *int64 `default:"0" json:"lookback_window"`
	// UTC date and time in the format 2020-10-01T00:00:00Z. Any data before this date will not be replicated.
	StartDate  time.Time `json:"start_date"`
	sourceType Twilio    `const:"twilio" json:"sourceType"`
}

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

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

func (o *SourceTwilio) GetAccountSid() string {
	if o == nil {
		return ""
	}
	return o.AccountSid
}

func (o *SourceTwilio) GetAuthToken() string {
	if o == nil {
		return ""
	}
	return o.AuthToken
}

func (o *SourceTwilio) GetLookbackWindow() *int64 {
	if o == nil {
		return nil
	}
	return o.LookbackWindow
}

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

func (o *SourceTwilio) GetSourceType() Twilio {
	return TwilioTwilio
}
